跳至主要内容

此浏览器不再受支持。

请升级到 Microsoft Edge 以使用最新的功能、安全更新和技术支持。

下载 Microsoft Edge 有关 Internet Explorer 和 Microsoft Edge 的详细信息
microsoft-foundry.rest.security.o-auth2-auth

Containers

Get a container

GET /openai/v1/containers/{container_id}

Retrieves a container by its identifier.

路径参数

container_id string 必需

The ID of the container.

响应

The request has succeeded.

正文

Content-Type: application/json
id string 必需

Unique identifier for the container.

object string 必需

The type of this object.

name string 必需

Name of the container.

created_at integer 必需

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

status string 必需

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.

下列类型作之一:
disabled OpenAI.ContainerNetworkPolicyDisabledParam
type enum 必需

Disable outbound network access. Always disabled.

disabled
allowlist OpenAI.ContainerNetworkPolicyAllowlistParam
type enum 必需

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

allowlist
allowed_domains string[] 必需

A list of allowed domains when type is allowlist.

Client error

正文

Content-Type: application/json
error OpenAI.Error 必需
code string | null 必需
message string 必需
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
以下任何项:
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 必需

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

正文

Content-Type: application/json
error OpenAI.Error 必需
code string | null 必需
message string 必需
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
以下任何项:
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 必需

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

请求

curl https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \
  -H "Authorization: Bearer $OPENAI_API_KEY"
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.retrieve('container_id');

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.retrieve(
    "container_id",
)
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.Get(context.TODO(), "container_id")
    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.ContainerRetrieveParams;
import com.openai.models.containers.ContainerRetrieveResponse;

public final class Main {
    private Main() {}

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

        ContainerRetrieveResponse container = client.containers().retrieve("container_id");
    }
}
require "openai"

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

container = openai.containers.retrieve("container_id")

puts(container)

响应

{
    "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863",
    "object": "container",
    "created_at": 1747844794,
    "status": "running",
    "expires_after": {
        "anchor": "last_active_at",
        "minutes": 20
    },
    "last_active_at": 1747844794,
    "memory_limit": "4g",
    "name": "My Container"
}
zh-cn
你的隐私选择
  • AI 免责声明
  • 早期版本
  • 博客
  • 参与
  • 隐私
  • 消费者健康隐私
  • 使用条款
  • 商标
  • © Microsoft 2026