Batch API
The Batch API is for asynchronous, high-volume inference jobs where you do not need an answer immediately.
Workflow
- Prepare a request bundle
- Create a batch with
POST /v1/batches - Poll
GET /v1/batches/{batch_id}— results are included inline once complete
1 & 2. Create the batch
Pass your requests inline — no separate file upload required.
curl
Node.js SDK
Python SDK
Go SDK
Java SDK
Request item fields
Each entry in requests supports:
The batch create call also accepts an optional metadata object (arbitrary key-value pairs) alongside completion_window.
Limits
- A batch may not mix models — all requests must target the same model, or the create call returns
400 mixed_models. - You can have at most 10 batches in a non-terminal state at once; an eleventh returns
429 batch_limit_exceeded.
3. Poll and read results
Poll until status is a terminal value. When completed, the response includes a results array — no separate file download needed.
Common statuses:
validatingin_progressfinalizingcompletedfailedcancellingcancelledexpired
Notes
- All requests in a batch must use the same model.
- Batch jobs are best for throughput, not low-latency interactive use.
- Use
GET /v1/batchesto list recent batches andPOST /v1/batches/{batch_id}/cancelto cancel one. - Results are matched by
custom_id— the output order is not guaranteed.