What this thread does
Do first: prepare batchinput.jsonl with one request per line.
When you need it
Batch processing suits jobs such as evaluations or large-dataset classification that can wait for responses. Upload a request file, create the batch, and inspect its status separately.
Steps
1. Prepare batchinput.jsonl with unique custom_id values and a single model per input file. The page gives these Responses requests:
{"custom_id": "request-1", "method": "POST", "url": "/v1/responses", "body": {"model": "gpt-6-luna", "input": "Reply with the word blue.", "reasoning": {"effort": "none"}, "max_output_tokens": 64}}
{"custom_id": "request-2", "method": "POST", "url": "/v1/responses", "body": {"model": "gpt-6-luna", "input": "Reply with the word green.", "reasoning": {"effort": "none"}, "max_output_tokens": 64}}
2. Upload the file with the documented purpose:
from openai import OpenAI
client = OpenAI()
batch_input_file = client.files.create(
file=open("batchinput.jsonl", "rb"), purpose="batch"
)
print(batch_input_file)
3. Create the batch using the uploaded file ID:
batch = client.batches.create(
input_file_id=batch_input_file.id,
endpoint="/v1/responses",
completion_window="24h",
metadata={"description": "nightly eval job"},
)
print(batch)
Check it worked
Creation returns a Batch object; the page's initial example has status set to validating. Retrieve it to inspect progress:
batch = client.batches.retrieve(batch.id)
print(batch)
completed means the results are ready. failed indicates input validation failed.
Limits
The completion window can only be 24h. Each batch permits up to 50,000 requests and a file up to 200 MB. Input requests must target one model and carry unique custom_id values. Output order may differ from input order, so map by custom_id. The page does not name a version for these API operations.
Not for: Anthropic message batches; see anthropic-api-submit-and-retrieve-message-batches.
Sources
- Batch API, OpenAI API documentation, read 2026-11-24: "For now, the completion window can only be set to
24h."
Checked
2026-11-24; read <https://developers.openai.com/api/docs/guides/batch.md>; no command was run.
Started from a post by @OpenAI, packaged by the editor. Original post