If your pipeline already knows which documents need labeling, embeddings, or evaluation, waiting for each API response is mostly theater. OpenAI's Batch API gives eligible requests a 50% discount against synchronous pricing. The catch is simple: you trade immediate answers for a completion window of up to 24 hours.

That is a good trade for a nightly catalog refresh. It is a terrible trade for a customer staring at a spinner. Here is how to decide, estimate the savings, and wire a batch without losing track of which result belongs to which input.
When the 50% discount is worth the wait
OpenAI names evaluations, large dataset classification, and repository embedding as fitting tasks. The shared trait is that a person does not need the answer during the request that created it. Product descriptions, support-ticket labels, offline evals, and document indexing often fit. Chat replies, fraud decisions blocking a checkout, or an agent choosing its next action do not.
A practical test: if the job is still useful tomorrow, and your application can store its inputs while it waits, try Batch. If a user or dependent service must act on the answer now, keep that call synchronous. The published window is 24 hours, not a promise that every job completes in a few minutes. Design against the full window.
The arithmetic is less exciting than the marketing. If supported synchronous requests would cost $100 for the same token usage, Batch costs $50 before engineering and storage overhead. If only 30% of your token bill comes from offline jobs, total API spend falls by 15%, not 50%. The discount applies to the eligible slice, not your entire account. That distinction matters when you decide whether a queue, status tracking, and result reconciliation are worth maintaining.
Batch also has separate rate limits from standard requests, so it can move bulk work without consuming the normal per-model rate-limit pool. But queued-token limits still apply, and a batch input file is limited to 50,000 requests and 200 MB. Check your organization's model-specific queue limit before splitting a large job. More files do not magically raise that token ceiling.
A batch workflow that does not lose results
The input is JSONL: one request object per line. Give every row a stable, unique custom_id; it is the join key you will need when responses come back. Each row names the HTTP method and supported endpoint, then carries the same request body you would send to that endpoint. One input file can target only one model.
For example, a Responses API input row has this shape:
{"custom_id":"product-0042","method":"POST","url":"/v1/responses","body":{"model":"YOUR_SUPPORTED_MODEL","input":"Classify this product description as clothing, home, or other: ..."}}
Write one such object per line, validate that every line parses and every ID is unique, then upload the file with purpose batch. Create the batch with that file ID, the same endpoint used by the rows, and completion_window set to 24h. The exact SDK calls vary by language, but the service flow is always input file, batch creation, status check, then output and error files.
Do not build the result importer around line order. OpenAI explicitly says output lines may arrive in a different order than input lines. Parse each output JSON object and look up the original work item by custom_id. Persist that ID in your database before submitting; do not rely on an in-memory list that disappears when a worker restarts.
Keep the batch ID and its status alongside your job record. On completion, process the output file and error file independently. Successful requests appear in the output; request failures are recorded in the error file. If a batch expires, unfinished requests are cancelled, completed work remains available, and completed requests are still billable. Retry only failed or expired IDs, not the whole original dataset. This avoids duplicate downstream writes and unnecessary model calls.
A small operational checklist is worth the few lines of code: reject malformed JSONL before upload, enforce unique IDs, save the batch ID after creation, poll or otherwise monitor status, map every result by ID, and make downstream writes idempotent. Keep source records until all IDs have either a success or a recorded terminal failure. That last step is boring, which is exactly why it prevents a painful cleanup later.
What to move first
Start with one offline slice you can measure, such as a nightly set of 500 product labels or a fixed evaluation suite. Record its ordinary API spend, wall-clock completion time, failed-request count, and any manual repair time. Then compare the Batch run against those same measures. The advertised 50% price reduction is only one part of the bill if your team spends an afternoon recovering results from a fragile importer.
Do not switch every call in a codebase because an example job worked. User-facing latency and a batch's 24-hour service window are different contracts. Keep both paths if the product needs both: synchronous for interaction, Batch for queued work. Route by the job's deadline, not by a vague preference for cheaper calls.
Sources
- OpenAI Batch API guide: official request format, discount, limits, result matching, and expiry behavior
- OpenAI Batch API FAQ: pricing, completion window, supported models, and partial completion billing