Pular para o conteúdo principal

Não há mais suporte para esse navegador.

Atualize o Microsoft Edge para aproveitar os recursos, o suporte técnico e as atualizações de segurança mais recentes.

Baixar o Microsoft Edge Mais informações sobre o Internet Explorer e o Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Containers

Create a container

POST /openai/v1/containers

Creates a container from the supplied request.

Corpo da solicitação

The request body.

Content-Type: application/json
name string exigido

Name of the container to create.

file_ids string[]

IDs of files to copy to the container.

expires_after OpenAI.CreateContainerBodyExpiresAfter
anchor enum exigido
last_active_at
minutes integer exigido
skills OpenAI.ContainerSkill[]

An optional list of skills referenced by id or inline data.

memory_limit enum

Optional memory limit for the container. Defaults to "1g".

1g4g16g64g
network_policy disabled | allowlist

Network access policy for the container.

Um dos seguintes:
disabled OpenAI.ContainerNetworkPolicyDisabledParam
type enum exigido

Disable outbound network access. Always disabled.

disabled
allowlist OpenAI.ContainerNetworkPolicyAllowlistParam
type enum exigido

Allow outbound network access only to specified domains. Always allowlist.

allowlist
allowed_domains string[] exigido

A list of allowed domains when type is allowlist.

Respostas

The request has succeeded.

Corpo

Content-Type: application/json
id string exigido

Unique identifier for the container.

object string exigido

The type of this object.

name string exigido

Name of the container.

created_at integer exigido

Unix timestamp (in seconds) when the container was created.

status string exigido

Status of the container (e.g., active, deleted).

last_active_at integer

Unix timestamp (in seconds) when the container was last active.

expires_after OpenAI.ContainerResourceExpiresAfter
anchor enum
last_active_at
minutes integer
memory_limit enum

The memory limit configured for the container.

1g4g16g64g
network_policy disabled | allowlist

Network access policy for the container.

Um dos seguintes:
disabled OpenAI.ContainerNetworkPolicyDisabledParam
type enum exigido

Disable outbound network access. Always disabled.

disabled
allowlist OpenAI.ContainerNetworkPolicyAllowlistParam
type enum exigido

Allow outbound network access only to specified domains. Always allowlist.

allowlist
allowed_domains string[] exigido

A list of allowed domains when type is allowlist.

Client error

Corpo

Content-Type: application/json
error OpenAI.Error exigido
code string | null exigido
message string exigido
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Qualquer uma das seguintes opções:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string exigido

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Corpo

Content-Type: application/json
error OpenAI.Error exigido
code string | null exigido
message string exigido
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Qualquer uma das seguintes opções:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string exigido

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Solicitar

curl https://api.openai.com/v1/containers \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "name": "My Container",
        "memory_limit": "4g",
        "skills": [
          {
            "type": "skill_reference",
            "skill_id": "skill_4db6f1a2c9e73508b41f9da06e2c7b5f"
          },
          {
            "type": "skill_reference",
            "skill_id": "openai-spreadsheets",
            "version": "latest"
          }
        ],
        "network_policy": {
          "type": "allowlist",
          "allowed_domains": ["api.buildkite.com"]
        }
      }'
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const container = await client.containers.create({ name: 'name' });

console.log(container.id);
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
container = client.containers.create(
    name="name",
)
print(container.id)
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    container, err := client.Containers.New(context.TODO(), openai.ContainerNewParams{
        Name: "name",
    })
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", container.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.ContainerCreateParams;
import com.openai.models.containers.ContainerCreateResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        ContainerCreateParams params = ContainerCreateParams.builder()
            .name("name")
            .build();
        ContainerCreateResponse container = client.containers().create(params);
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

container = openai.containers.create(name: "name")

puts(container)

Resposta

{
    "id": "cntr_682e30645a488191b6363a0cbefc0f0a025ec61b66250591",
    "object": "container",
    "created_at": 1747857508,
    "status": "running",
    "expires_after": {
        "anchor": "last_active_at",
        "minutes": 20
    },
    "last_active_at": 1747857508,
    "network_policy": {
        "type": "allowlist",
        "allowed_domains": ["api.buildkite.com"]
    },
    "memory_limit": "4g",
    "name": "My Container"
}
pt-br
Suas escolhas de privacidade
  • Aviso de isenção de responsabilidade sobre a IA
  • Versões anteriores
  • Blog
  • Contribuir
  • Privacidade
  • Privacidade da Integridade do Consumidor
  • Termos de Uso
  • Marcas Comerciais
  • © Microsoft 2026