取消 batch

POST/v1/batches/{batch_id}/cancel

请求取消进行中的 batch。状态先变为 cancelling,平台在可能时调用上游取消接口,确认后变为 cancelled

已为终态的作业(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.

Available options: cancelling cancelled completed failed expired

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

request_countsobject

total, completed, failed counts when available.

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  "input_file_id": "file_abc123",
7  "output_file_id": null,
8  "error_file_id": null,
9  "completion_window": "24h",
10  "request_counts": null,
11  "created_at": 1710000000,
12  "expires_at": 1710086400,
13  "metadata": {
14    "job": "nightly"
15  }
16}
此页面对您有帮助吗?