查询 batch

GET/v1/batches/{batch_id}

查询 batch 作业当前状态,含 request_counts 及 output/error 文件 ID(若已生成)。

轮询直至 status 为终态:completedfailedexpiredcancelled

Authentication

Authorization Bearer

Path Parameters

batch_idstringrequired

Batch ID returned by POST /v1/batches.

Response

idstring

Batch ID.

objectstring

batch

endpointstring

/v1/chat/completions

statusenum<string>
execution_preferencestring

请求路径:auto | provider | platform。

executionstring

实际解析路径:provider | platform。

fallback_from_providerboolean

auto 从 provider 回落到 platform 时为 true。

input_file_idstring

输入文件 ID。

client_modelstring

JSONL 中的公网模型名。

output_file_idstring

完成后的输出 JSONL。

error_file_idstring

错误 JSONL(若有)。

usage_billingobject

finalize 后的用量计费汇总(标价 vs 实付)。

request_countsobject
request_counts.totalinteger
request_counts.completedinteger
request_counts.failedinteger
created_atinteger

Unix timestamp.

in_progress_atinteger

Unix timestamp when upstream started.

completed_atinteger

Unix timestamp when completed.

failed_atinteger

Unix timestamp when failed.

expired_atinteger

Unix timestamp when expired.

cancelled_atinteger

Unix timestamp when cancelled.

expires_atinteger

估计截止时间(创建 + 24h)。platform 路径到期不会强行停任务。

metadataobject

Stored metadata.

errorsobject

Validation or platform errors when failed.

errors.messagestring

Human-readable error message.

errors.codestring

Machine-readable error code.

errors.typestring

Error category when returned.

errors.stagestring

Processing stage where the error occurred.

errors.upstream_http_statusinteger

Provider HTTP status when the error came from upstream.

errors.upstream_messagestring

Provider error message when available.

Polling guidance

  • Non-terminal: poll every 30–60 seconds, or use webhooks.
  • completed: download output_file_id (and error_file_id if set).
  • failed / expired: inspect errors and error file.

请求

1curl https://api.token360.ai/v1/batches/batch_01abc \
2  -H "Authorization: Bearer sk-your-api-key"

响应

JSON
1{
2  "id": "batch_01abc",
3  "object": "batch",
4  "endpoint": "/v1/chat/completions",
5  "status": "completed",
6  "execution_preference": "auto",
7  "execution": "platform",
8  "fallback_from_provider": false,
9  "input_file_id": "file_abc123",
10  "client_model": "gpt-4o-mini",
11  "output_file_id": "file_output_xyz",
12  "error_file_id": null,
13  "completion_window": "24h",
14  "request_counts": {
15    "total": 2,
16    "completed": 2,
17    "failed": 0
18  },
19  "created_at": 1710000000,
20  "in_progress_at": 1710000060,
21  "completed_at": 1710003600,
22  "expires_at": 1710086400,
23  "metadata": {
24    "job": "nightly"
25  },
26  "errors": null
27}
此页面对您有帮助吗?