查询 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>

Available options: validating failed in_progress finalizing completed expired cancelling cancelled

input_file_idstring

Input file ID.

output_file_idstring

Output JSONL file when completed.

error_file_idstring

Error JSONL file when present.

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

Unix timestamp deadline.

metadataobject

Stored metadata.

errorsobject

Validation or platform errors when failed.

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  "input_file_id": "file_abc123",
7  "output_file_id": "file_output_xyz",
8  "error_file_id": null,
9  "completion_window": "24h",
10  "request_counts": {
11    "total": 2,
12    "completed": 2,
13    "failed": 0
14  },
15  "created_at": 1710000000,
16  "in_progress_at": 1710000060,
17  "completed_at": 1710003600,
18  "expires_at": 1710086400,
19  "metadata": {
20    "job": "nightly"
21  },
22  "errors": null
23}
此页面对您有帮助吗?