batch
Create a batch
Start processing an uploaded input file. The batch is returned in validating; poll it until status is terminal. Every line must target /v1/chat/completions and name the same model, custom_id must be unique within the file, and stream: true is rejected. Billed per completed request at half the model's synchronous rate, including requests that complete before a cancel or expiry.
post/v1/batches
Request body
Example request
{
"input_file_id": "file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f",
"endpoint": "/v1/chat/completions",
"completion_window": "24h",
"metadata": {
"job": "nightly-summaries"
}
}Response
The new batch, in validating.
Example response
{
"id": "batch_5f4e3d2c-1b0a-4f9e-8d7c-6b5a4f3e2d1c",
"object": "batch",
"endpoint": "/v1/chat/completions",
"input_file_id": "file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f",
"completion_window": "24h",
"metadata": {
"job": "nightly-summaries"
},
"created_at": 1780000000,
"status": "in_progress",
"model": "morph-glm53flash",
"output_file_id": null,
"error_file_id": null,
"in_progress_at": 1780000012,
"finalizing_at": null,
"completed_at": null,
"failed_at": null,
"expired_at": null,
"expires_at": 1780086400,
"cancelling_at": null,
"cancelled_at": null,
"request_counts": {
"total": 2,
"completed": 1,
"failed": 0
},
"errors": null,
"usage": {
"input_tokens": 824,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 36,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 860
}
}Changes
Changed in 1 of the 3 revisions of this API.1
- ○
endpoint added
endpoint-added
- ○