OpenAI 检索容器
2026-11-12 14:59 更新
检索容器
get /containers/{container_id}
检索容器。
路径参数
container_id: string
返回值
id: string
容器的唯一标识符。
created_at: integer
创建容器时的 Unix 时间戳,单位为秒。
format: unixtime
name: string
容器的名称。
object: string
此对象的类型。
status: string
容器的状态,例如 active(活动)或 deleted(已删除)。
expires_after: optional object { anchor, minutes }
容器将在此时间段后过期。
anchor 是计算过期时间的基准时刻。
minutes 表示自基准时刻起、容器过期前经过的分钟数。
anchor: optional "last_active_at"
计算过期时间的基准时刻。
"last_active_at"
minutes: optional integer
自基准时刻起、容器过期前经过的分钟数。
last_active_at: optional integer
容器最近一次活动的 Unix 时间戳,单位为秒。
format: unixtime
memory_limit: optional "1g" or "4g" or "16g" or "64g"
为容器配置的内存上限。
"1g"
"4g"
"16g"
"64g"
network_policy: optional object { type, allowed_domains }
容器的网络访问策略。
type: "allowlist" or "disabled"
网络策略模式。
"allowlist"
"disabled"
allowed_domains: optional array of string
type 为 allowlist 时允许出站访问的域名。
示例
## 从环境变量读取 API 密钥;运行前替换容器、文件和技能等示例 ID。
curl https://api.openai.com/v1/containers/$CONTAINER_ID \
-H "Authorization: Bearer $OPENAI_API_KEY"
200 响应示例
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "object",
"status": "status",
"expires_after": {
"anchor": "last_active_at",
"minutes": 0
},
"last_active_at": 0,
"memory_limit": "1g",
"network_policy": {
"type": "allowlist",
"allowed_domains": [
"string"
]
}
}
示例
## 从环境变量读取 API 密钥;运行前替换容器、文件和技能等示例 ID。
curl https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \
-H "Authorization: Bearer $OPENAI_API_KEY"
响应示例
{
"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": "示例容器"
}以上内容是否对您有帮助:

TRAE-AI编程


更多建议: