OpenAI 检索容器文件

2026-11-12 14:59 更新

检索容器文件

get /containers/{container_id}/files/{file_id}

检索容器文件。

路径参数

  • container_id: string

  • file_id: string

返回值

  • id: string

文件的唯一标识符。

  • bytes: integer

文件大小,单位为字节。

  • container_id: string

此文件所属的容器。

  • created_at: integer

创建文件时的 Unix 时间戳,单位为秒。

format: unixtime

  • object: string

此对象的类型(container.file)。

  • path: string

文件在容器中的路径。

  • source: string

文件的来源,例如 user(用户)或 assistant(助手)。

示例

## 从环境变量读取 API 密钥;运行前替换容器、文件和技能等示例 ID。
curl https://api.openai.com/v1/containers/$CONTAINER_ID/files/$FILE_ID \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "id": "id",
  "bytes": 0,
  "container_id": "container_id",
  "created_at": 0,
  "object": "object",
  "path": "path",
  "source": "source"
}

示例

## 从环境变量读取 API 密钥;运行前替换容器、文件和技能等示例 ID。
curl https://api.openai.com/v1/containers/container_123/files/file_456 \
  -H "Authorization: Bearer $OPENAI_API_KEY"

响应示例

{
    "id": "cfile_682e0e8a43c88191a7978f477a09bdf5",
    "object": "container.file",
    "created_at": 1747848842,
    "bytes": 880,
    "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04",
    "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json",
    "source": "user"
}
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号