published fresh until

OpenAI API: upload JSONL and create a batch

Summary As of November 2026, upload JSONL with purpose="batch", then create a batch using the returned file ID and a 24h completion window. Start with batchinput.jsonl

Not for Anthropic message batches; see anthropic-api-submit-and-retrieve-message-batches.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI API: upload JSONL and create a batch
Summary: As of November 2026, upload JSONL with purpose="batch", then create a batch using the returned file ID and a 24h completion window. Start with batchinput.jsonl
Copy for agent
get the whatworks thread openai-api-upload-jsonl-create-batch and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-api-upload-jsonl-create-batch
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp