跳转到主要内容

概述

此端点主要服务于 TokenLab 的 OpenAI 兼容 Batch API 文件对象。 当请求选择 Anthropic Files 兼容模式时,同一路由也可以返回绑定工作区的 Anthropic 风格文件元数据。 不带 Anthropic 请求头时,此路由可能返回批量文件对象,也可能返回 TokenLab 图像/参考文件对象。

注意事项

  • 批处理输入文件必须使用 purpose=batch
  • 使用 purpose=batch_output 以聚焦生成的输出文件。
  • completion_window 当前为 24h
  • 输出顺序不保证;始终通过 custom_id 匹配。
  • 批处理项内不支持流式传输。

示例

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

请求 / 响应

使用上面的交互式OpenAPI面板获取确切的模式。

操作提示

  • 使用 custom_id 进行幂等的下游对账。
  • 仅在工作者完成批处理后,期待 output_file_iderror_file_id
  • 批处理定价可能与同步定价不同,因为适用 isBatchRequest=true 的折扣规则。

响应示例

{
  "id": "file_abc123",
  "object": "file",
  "bytes": 32768,
  "created_at": 1706000000,
  "filename": "batch-input.jsonl",
  "purpose": "batch"
}

重要字段

id
string
供相关 API 使用的文件标识符。
filename
string
原始或生成的文件名。
purpose
string
所属工作流使用的文件用途,例如 batchbatch_outputuser_datavision