v2

latestOpenAPI 3.1.02026-08-07139158192.4 KB
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.

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.

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

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