Batch APIs: Lower AI Costs Mean Designing for Delayed Results

A document-labeling task that can wait until tomorrow has different requirements from an answer someone needs now. Batch APIs let developers submit work for asynchronous processing at a lower processing price. The tradeoff is that the application must track a job and collect its results later.
That changes more than the request path. Before moving work to batch processing, decide how much delay is acceptable, how to recover unfinished items, and what to do when a submission's outcome is unclear.
Start with the deadline, not the discount
OpenAI documents its Batch API with a 50% discount compared with synchronous APIs, separate rate limits, and a 24-hour completion window. Its listed uses include evaluations, dataset classification, and embedding repositories. These are useful starting points for identifying work that does not need an immediate response.
Consider a hypothetical nightly evaluation dataset. If nobody needs the scores until a later review, delayed processing may be acceptable. If a user cannot continue until a document has been classified, that same delay may make batch processing unsuitable for that step.
The published discount describes processing prices. It does not establish that the total application bill will fall by half. Job tracking, reconciliation, and recovery still need an implementation. Treat the discount as one input to the decision, alongside the cost of operating a delayed workflow.

Treat submission as the start of a job
The OpenAI batch guide describes a file-based lifecycle: prepare and upload an input file, create a batch, check its status, and retrieve the result file. Input uses JSONL, with one API request per line. Each request needs a unique custom_id, and one input file can contain requests for only a single model.
Those identifiers deserve attention before submission. As an engineering recommendation, use them to connect each returned item to the original work record. A useful local record would also preserve the submitted input and the provider's job identifier, so another process can resume tracking without reconstructing what happened.
Keep submission and result consumption separate. The component that starts a job should not have to remain alive until the work finishes. A later worker can check status and reconcile downloaded results against the original inputs.
OpenAI currently accepts 24h for the completion_window creation parameter. Its Batch API FAQ also states that streaming is not supported. Design the consumer around output files rather than a stream of responses.
Separate job status from item outcomes
A job's status is not enough to decide whether every input has a usable result. OpenAI's documented expiration behavior makes this distinction concrete: unfinished requests are cancelled when a batch expires, completed responses remain available, and tokens consumed by completed requests are billed. Expired requests appear in the error file.
For recovery, the unit of work should therefore be the individual request, not automatically the entire input file. Preserve successful responses, identify which items remain unresolved, and decide which failures are appropriate to retry. Repeating the whole batch would submit already completed work again.
A practical reconciliation record should distinguish an accepted result from an error or an unresolved item. Downloading a file is only one step; the application still needs to associate its contents with the submitted work and decide what happens next.
Gemini's batch documentation likewise recommends inspecting per-request errors after completion. A completed job should trigger that inspection, not replace it. These are workflow recommendations derived from the documentation, not measured recovery results.

Read each provider's timing and submission rules
The word “batch” does not define one shared contract. Gemini documents pricing at 50% of the standard interactive cost for the equivalent model. It describes 24 hours as a target or service-level objective. Its status documentation separately says a job pending or running for more than 48 hours can expire with no results to retrieve.
That wording should influence deadline planning. Do not translate a target into a promise that every item will be ready the next morning, or assume that expiration produces the same artifacts across providers.
Input constraints differ too. The OpenAI guide specifies up to 50,000 requests and a 200 MB input file per batch. Queued prompt-token limits depend on the model. Batch usage has a separate rate-limit pool, but that is not unlimited capacity. Gemini supports inline requests for total request sizes under 20 MB and JSONL input files up to 2 GB.
Gemini also explicitly says batch creation is not idempotent: submitting the same creation request twice creates two jobs. If a submission response is lost, an automatic retry could create another job. Track submission attempts and define how to investigate an uncertain outcome before resubmitting. Do not assume that a request identifier prevents duplicate job creation.
Check retention before choosing the workload
OpenAI's Batch API FAQ says zero data retention does not apply to the Batch API, even for organizations with ZDR enabled. Batch artifacts follow the relevant configured retention policies. That does not establish a universal retention duration.
Check those policies against the proposed input before submitting it. The review should also cover application-managed copies of input files, downloaded results, and errors. A retention requirement belongs in the workload-selection decision, not at the end of implementation.

Define recovery before moving the first workload
For a first candidate, choose a bounded, non-urgent dataset with an explicit deadline. Before implementation, write down:
- The acceptable delay and the action to take if results miss the deadline.
- The selected model's eligibility and applicable submission limits.
- The identifiers connecting inputs, jobs, and individual results.
- Where job state will persist between status checks.
- How every submitted item will be reconciled, including failures.
- Which items can be retried and how uncertain submissions will be investigated.
- The retention requirements for provider artifacts and local copies.
Start by defining what happens to one successful item, one failed item, and one submission whose outcome is unknown. If those paths are unclear, resolve them before increasing the workload. A cheaper processing rate is useful only when the application can account for the work it submitted.
Sources
- Batch API · OpenAI
- Batch API FAQ · OpenAI Help Center
- Batch API — Gemini API · Google AI Studio

