Skip to main content

Two flavors, one lifecycle

Both collections expose the same five operations. Everything below is written against /v1/messages/batches; substitute the path and item shape for the OpenAI flavor.

Create a batch

Send an inline requests array. Each item carries a custom_id (yours, for matching results) and a params object — the same body you would send to the live endpoint.
Create

Lifecycle

Processing is asynchronous. processing_status flows in_progress → ended (via canceling if you cancel). Poll the status endpoint; fetch /results only once the batch has ended — before that it returns 409.

Results

Results are JSONL — one line per request, keyed by your custom_id, with a discriminated result.type of succeeded | errored | canceled | expired. Order is not guaranteed to match submission order; always match on custom_id.
Results (JSONL, one line per request)
Batch items draw from the same monthly included-usage pool as live requests, at the same public list rates — see Plans & limits.