创建 batch
/v1/batches基于已上传的 JSONL 输入文件(purpose=batch)创建异步 batch 作业。平台会校验文件、要求全文件单一 body.model、解析执行路径(auto / provider / platform)并入队。
MVP 仅支持 endpoint=/v1/chat/completions 与 completion_window=24h。
JSONL 格式、双执行路径与约束见 批量任务。
Authentication
Authorization Bearer
Request Body
input_file_idstringrequiredPOST /v1/files(purpose=batch)返回的文件 ID。
endpointstring必须为 /v1/chat/completions(可省略,默认即此值)。
completion_windowstring必须为 24h(可省略,默认即此值)。
executionstringauto(默认)| provider | platform。auto 在可用时优先上游 Batch Infer,否则走平台 fan-out。
callback_urlstring可选 HTTPS。batch 进入 completed/failed/cancelled/expired 时 POST。覆盖控制台账户默认 Webhook。内网/回环地址会被拒绝。详见 Webhook 文档。
metadataobject可选键值元数据,保存在 batch 对象上。
Response
idstringBatch ID(batch_ 前缀)。
objectstringbatch
endpointstring/v1/chat/completions
statusstringvalidating,随后 in_progress 等
execution_preferencestring请求路径:auto | provider | platform。
executionstring实际解析路径:provider | platform。
fallback_from_providerbooleanauto 从 provider 回落到 platform 时为 true。
input_file_idstring输入文件 ID。
client_modelstringJSONL 中的公网模型名。
output_file_idstring完成后设置。
error_file_idstring存在部分失败或错误文件时设置。
completion_windowstring24h
request_countsobject可用时含 total、completed、failed。
request_counts.totalintegerTotal number of requests in the batch.
request_counts.completedintegerNumber of completed requests.
request_counts.failedintegerNumber of failed requests.
created_atintegerUnix 时间戳。
expires_atinteger估计截止时间(创建 + 24h)。platform 路径仅作展示,到期不会强行停任务。
metadataobject请求 metadata 回显。
常见错误
batch_multiple_models | 输入文件中出现多个不同的 body.model。 |
batch_invalid_jsonl | 行格式或字段非法。 |
batch_model_not_supported | 该账号下模型无法作为 batch 运行(无可用路由)。 |
batch_routing_unavailable | 模型无活跃 SKU。 |
missing_execution_api_key | 会话无法密封推理 API Key Bearer(请使用 API Key 的 Authorization)。 |