Use the OpenAI Batch API when work can wait through the documented completion window and you still have time to validate and deliver the results. Keep deadline-critical requests on a synchronous path if your measured throughput fits the remaining time. If neither path fits, reduce the scope or move the delivery time before accepting the job.
OpenAI documents a 24-hour Batch completion window and an expired state for jobs that do not finish within it. Official source
Work backward from delivery
Start with the time a verified result must reach its destination. Subtract the time needed for download, reconciliation, output checks and delivery. Subtract any preparation time still ahead of you, including building and checking the input file. If the remaining runway covers the Batch window, Batch is an option. A tight boundary calls for more margin when a reviewer or downstream dependency has limited availability.
| Situation | Route | Evidence to check before submitting |
|---|---|---|
| Offline work with room for the completion window and delivery buffer | Batch | The chosen endpoint and model support Batch, and queued capacity fits the workload |
| Deadline falls inside the full window | Synchronous if feasible | Measured sustained throughput, rate limits and recovery slack support delivery |
| Only a subset blocks delivery | Split by priority | The two paths own disjoint input IDs and the consumer accepts incremental delivery |
| Neither path fits the amount of work | Reduce scope or change the cutoff | A named owner accepts the revised deliverable |
Estimate the synchronous path over representative traffic under the concurrency and rate limits you can actually use. Include waits and retries. A single fast request does not tell you how soon a large file will clear. If you have no recent measurement, treat the synchronous estimate as unknown and make a smaller, time-bounded probe before making a delivery commitment.
An illustrative submission cutoff
Suppose a catalog team owes validated classifications by Thursday at 18 UTC. It reserves two hours to reconcile and deliver the results. The batch input is already prepared. Using the documented window, Thursday at 18 UTC minus two hours of delivery buffer and 24 hours of Batch time gives an illustrative latest submission time of Wednesday at 16 UTC. Official source
In the same illustrative case, if the input first becomes ready Wednesday at 17 UTC, the team has 23 hours before reconciliation must start. It could run the deadline-critical subset synchronously if the throughput evidence supports it and queue the rest for a later delivery. If the destination requires a complete file, it should confirm a revised scope or deadline before starting either route. An early Batch return may free up time. Base the deadline commitment on the documented window and the delivery buffer you can verify against the workload.
Reconcile work by input ID
Batch input requests require unique custom_id values, and their output rows may appear in a different order from the input. Official source
Before submission, freeze the expected ID set and retain the batch identifier. At collection, join the output and error files to that set. Check independently for repeated IDs, unexpected IDs and missing IDs. Count a completed response as ready for delivery only after it passes your application checks. Re-read the destination and compare accepted IDs to the exact release set before declaring the job delivered.
When a batch expires, OpenAI makes completed responses available in its output file and records expired requests in its error file. Official source
At your cutoff, reconcile the batch state and available files before directing unresolved IDs to another route. If a batch might still return work after fallback begins, keep destination writes unique by logical input and revision. Pick which result can win the write and make that rule explicit. If the files or provider state are unavailable, label the affected IDs unresolved. Deliver the verified subset only if the downstream consumer has agreed to use it. How to return partial AI workflow results
Before changing the production route, run one fixture with output rows shuffled and one with an expired request. The fixture passes when every delivered ID has exactly one validated result, the expired ID remains visible, and nothing outside the frozen input set reaches the destination.
sinc-LLM