How batches run
A batch processes its lines one at a time, so per-request latency sets its throughput: 1,000 lines that take 3 seconds each finish in about 50 minutes. Separate batches run in parallel, so split a large job across several batches to finish it sooner. Batch lines do not count against your API key’s rate limits. If your organization uses judge-based auto-routing, a line withmodel: "auto" still counts against the selected model’s own rate limits, and a line that exceeds them fails with rate_limit_exceeded.
Batch requests are billed at the same rates as synchronous requests.
Plan for each batch to finish within its 24-hour completion window.
A batch that overruns is stopped and returns no results, even for lines that completed.
Its status stays in_progress, so give your poller its own deadline.
Supported endpoints
All requests in a single batch must target the same endpoint.
Lifecycle
A batch moves through these statuses:Step 1 — Prepare the input file
Create a JSONL file where each line is one request. Every line has four fields:body takes the same parameters as a synchronous Responses request, with these rules:
- Leave out
streamandbackground, or set them tofalse. A line that sets either one totruefails. - To set reasoning effort, send both keys of the
reasoningobject, for example"reasoning": {"effort": "low", "summary": null}. See Control reasoning.
store: false because the output file already holds each result. Leave it out if you also want to retrieve each response by ID later.
A single batch can contain up to 10,000 requests.
The input file can be up to 25 MB; a larger upload is rejected with HTTP 413.
Step 2 — Upload the input file
Upload the JSONL file using the Files API withpurpose: "batch".
Step 3 — Create the batch
Pass the uploaded file ID, the target endpoint, and the completion window.Step 4 — Check batch status
Poll the batch until it reaches a terminal status.Step 5 — Download the results
Once the batch iscompleted, download the output file. It is a JSONL file where each line contains the custom_id you provided, the response, and any error.
response is null and error contains the details:
error_file_id containing only the failed entries.
Cancel a batch
Cancel a batch that is still in progress. Requests that have already completed remain in the output.cancelling while in-flight requests finish, then to cancelled.
List batches
Retrieve all batches for the current account, newest first. Supports pagination.after parameter with a batch ID to page through results.
Example: batch chat completions
The same flow works for chat completions. Change theurl in each JSONL line and the endpoint when creating the batch.
Example: batch embeddings
The same flow works for embeddings. Change theurl in each JSONL line and the endpoint when creating the batch.
Validation errors
If the input file has formatting issues, the batch moves tofailed immediately.
Common causes:
- Invalid JSON — a line is not valid JSON.
- Missing fields — a line is missing
custom_id,method,url, orbody. - Wrong method —
methodmust be"POST". - URL mismatch — the
urlin a line does not match theendpointdeclared when creating the batch. - Duplicate
custom_id— eachcustom_idmust be unique within the file.
batch.errors.data for the specific error messages and line numbers.
See also
- Generate a response for the synchronous request that each Responses line mirrors.
- Files and vector stores for the Files API used to upload batch inputs.