取消 batch

POST/v1/batches/{batch_id}/cancel

请求取消进行中的 batch。状态先变为 cancelling,随后 cancelled

  • platform 路径:Token360 在本地停止尚未执行的 fan-out。已经成功落盘的行仍可能计费(usage_billing)。
  • provider 路径:在可能时还会调用上游取消接口。

已为终态的作业(completedfailedexpiredcancelled)直接返回当前对象。

Authentication

Authorization Bearer

Path Parameters

batch_idstringrequired

Batch ID to cancel.

Response

idstring

Batch ID.

objectstring

batch

endpointstring

/v1/chat/completions

statusenum<string>

Usually cancelling or cancelled.

input_file_idstring

Input file ID.

output_file_idstring

Output JSONL file when already completed.

error_file_idstring

Error JSONL file when present.

completion_windowstring

24h

executionstring

Resolved path: provider | platform.

usage_billingobject

Aggregated usage billing when lines have been settled.

request_countsobject

total, completed, failed counts when available.

request_counts.totalinteger

Total number of requests in the batch.

request_counts.completedinteger

Number of completed requests.

request_counts.failedinteger

Number of failed requests.

created_atinteger

Unix timestamp.

cancelled_atinteger

Unix timestamp when cancellation is complete.

expires_atinteger

Unix timestamp deadline.

metadataobject

Stored metadata.

请求

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

响应

JSON
1{
2  "id": "batch_01abc",
3  "object": "batch",
4  "endpoint": "/v1/chat/completions",
5  "status": "cancelling",
6  "execution": "platform",
7  "input_file_id": "file_abc123",
8  "output_file_id": null,
9  "error_file_id": null,
10  "completion_window": "24h",
11  "request_counts": null,
12  "created_at": 1710000000,
13  "expires_at": 1710086400,
14  "metadata": {
15    "job": "nightly"
16  }
17}
此页面对您有帮助吗?