文件与批处理

获取文件内容

下载文件内容。

GET
/v1/files/{file_id}/content

下载批处理输入、输出或错误文件。携带 Anthropic Files 请求头时,也可以下载当前工作区的 Anthropic 格式文件。

示例

请求

cURL
curl -X GET "https://api.tokenlab.sh/v1/files/file_abc123/content" \
  -H "Authorization: Bearer sk-your-api-key" \
  --output batch-output.jsonl

使用说明

  • 使用 custom_id 把输出与输入记录一一对应。
  • 批处理完成后,响应才会出现 output_file_id 和 error_file_id。

内容类型

批处理文件以 JSONL 或纯文本返回;图片参考文件以二进制返回。

响应示例

响应

200 OK
{"custom_id":"request-1","response":{"status_code":200,"body":{"id":"chatcmpl_abc123"}}}
{"custom_id":"request-2","error":{"code":"invalid_request_error","message":"Invalid model"}}

重要字段

bodybinary|string
文件内容。请根据 Content-Type 保存或解析;JSONL 应逐行解析。
custom_idstring
批处理输入项和结果之间的对应 ID。

授权

BearerAuth
AuthorizationBearer <token>

API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。

位置: header

路径参数

file_id*string

响应

text/plain

application/json