Batches

Create a batch inference job

Submit a batch from an uploaded input file (input_file_id) or inline request objects (requests); provide exactly one of the two. The batch completes within the 24h window at a discounted rate; poll it with get, then download results via the output and error file ids.

post/v1/batches

Request body

completion_window'24h' required

Time budget for the batch; only "24h" is supported.

endpoint'/v1/chat/completions' | '/v1/completions' | '/v1/embeddings' required

The API family every record in the batch calls.

input_file_idstring

Id of an uploaded JSONL input file (from the file upload).

metadataobject

Up to 16 key-value pairs echoed back on the batch object.

modelstring

Optional display hint shown on the batch immediately; validation settles the authoritative value from the input file.

priority'standard' | 'expedited'

Scheduling tier. standard (the default) runs at the discounted batch rate. expedited is granted a freeing pool slot ahead of any waiting standard batch, grows the fleet to a tighter drain target, and is billed at the online rate with no batch discount; it is available to every organization unless an operator has disabled it for yours, in which case the request is rejected with 400. There is no completion deadline on either tier.

Response

OK

cancelled_atinteger
completed_atinteger
completion_window'24h' required
created_atinteger required

Unix timestamp (seconds).

endpointstring required

The API family every record in the batch calls.

error_file_idstring

Present once results are written; fetch its content for failed records.

expired_atinteger
expires_atinteger

When the completion window closes (created_at + 24h).

failed_atinteger
idstring required

Batch id (batch_…).

input_file_idstring required
metadataobject

Your key-value pairs, echoed back unchanged.

modelstring

Model id, settled from the input file during validation.

object'batch' required
output_file_idstring

Present once results are written; fetch its content for successful records.

priority'standard' | 'expedited' required

The scheduling tier this batch runs and is billed at. Batches created before the tier existed read as standard.

status'validating' | 'in_progress' | 'finalizing' | 'completed' | 'failed' | 'expired' | 'cancelling' | 'cancelled' required

Lifecycle state. validating → in_progress → finalizing → completed | failed | expired; cancelling → cancelled.

Changes