Enterprise Batch Workloads · Updated November 2026

AI gateway batch API support in 2026: async jobs, discounts and failure recovery

An AI gateway that handles ordinary chat completions may not support the provider's asynchronous Batch API. Batch jobs are attractive for evaluations, bulk classification and document processing because providers offer discounted processing and separate throughput pools. But batch submission, polling, result files, partial failures and data handling create a different integration contract from a single synchronous request.

Practical engineering guidance. Verify provider-specific capabilities, pricing, and support before deployment.

Key takeaways

  • OpenAI and Anthropic document 50% batch discounts relative to their synchronous API pricing, but eligible endpoints, model support and data handling must be checked separately.
  • An OpenAI-compatible chat endpoint is not proof that file upload, batch creation, polling, cancellation and results retrieval work through a gateway.
  • Use stable per-item IDs and reconcile every successful, failed, expired and retried item; result order is not guaranteed.
  • Anthropic's current batch documentation explicitly marks its batch feature as not eligible for ZDR or HIPAA use, an important procurement distinction.

Batch is a workflow, not a cheaper chat-completions switch

OpenAI's Batch API accepts a JSONL input file, creates a batch with a 24-hour completion window, exposes status and cancellation operations, and provides result and error files. Its guide says batch processing costs 50% less than synchronous calls and uses a separate rate-limit pool. This is not simply a normal chat request with a cheaper model name. A gateway must support the file and batch lifecycle, or the application must deliberately call the provider's batch endpoints directly.

Anthropic's Message Batches API accepts independently identified Messages requests, processes them asynchronously, and returns results after processing ends or the 24-hour window expires. Anthropic also documents a 50% price reduction. The input structure and result API differ from OpenAI's JSONL file workflow. A vendor claiming 'multi-provider API compatibility' has not thereby demonstrated batch parity across the two providers.

  • Inventory create, upload, status, list, cancel and result-download endpoints for each provider.
  • Record which operations are handled by the gateway and which bypass it directly.
  • Verify that gateway authentication, audit and spend policies apply to each path rather than only chat requests.

Compare endpoint support before selecting a gateway

Kong's AI Proxy documentation describes RESTful batch routes in newer gateway versions and native-format Anthropic batch support in its provider table. That is useful evidence of a supported architecture, not proof of every feature on every deployment. Cloudflare's dynamic routing documentation explicitly limits dynamic routes to OpenAI chat-completions-shaped requests, even though Cloudflare's broader AI REST API exposes additional formats. Treat these as different products and request paths, not as a single binary 'batch supported' field.

LiteLLM and other gateways document multiple supported endpoint families, but the only reliable procurement evidence is a working test of the exact batch operation on the selected version and plan. For OpenRouter, Bifrost/Maxim, Portkey, TrueFoundry, Helicone and AetherGate, mark batch support unknown until you see a documented route and a passing end-to-end test. Never assume a unified base URL automatically proxies provider-specific file and batch management.

  • Test one small OpenAI batch and one Anthropic Message Batch with synthetic input.
  • Confirm that result and error files can be retrieved and associated with the original caller's project.
  • Check that provider-native parameters are preserved or rejected explicitly rather than silently stripped.

Result reconciliation: the item ID matters more than the output order

OpenAI's batch guide warns that output lines may arrive in a different order than input lines and instructs clients to join using custom_id. Anthropic also identifies each request by custom_id and reports succeeded, errored, canceled and expired outcomes. A robust application stores a durable record for each logical item before submission and joins the provider result to that record. Treating output line 100 as input line 100 is a correctness bug.

Design a state machine with queued, submitted, running, succeeded, failed, expired and canceled states. Save the provider batch ID, individual custom_id, submission time, model and prompt-version hash. Keep a separate record for each resubmission attempt so an expired or ambiguous item is not blindly billed or processed twice. This is especially important when a batch produces customer-facing content or writes to downstream business systems.

  • Enforce unique custom_id within each batch and idempotent downstream result application.
  • Reconcile input count against succeeded, failed, canceled and expired totals before declaring a job complete.
  • Do not assume cancellation refunds already completed work or that expiration means no billable results.

Calculate net savings after partial retries and operating costs

A simple illustration: if a representative workload would cost $1,000 at the provider's synchronous token rates, a 50% batch discount would make the same billable tokens $500 before gateway charges, additional attempts and operational work. This is arithmetic, not a benchmark or a promise of a $500 invoice reduction. If ten percent of items need an additional full-price retry, or the workflow requires expensive preprocessing and quality checks, the realized difference changes.

Build the cost ledger at the attempt level. Track provider, model, input and output tokens, cache categories, discount type, attempt status, and the provider's actual bill. Separate batch inference from storage, file uploads, gateway subscriptions and any resubmission. When using a BYOK gateway, the upstream provider remains the source of truth for actual inference charges. A dashboard estimate should not be presented as a settled invoice.

  • Cost per accepted result = (all provider attempts + platform + processing overhead) / accepted results.
  • Compare a representative sample of identical tasks synchronously and in batch for quality and total cost.
  • Keep rejected and partial outcomes visible; excluding them can make the apparent unit cost misleading.

Privacy and data retention are not inherited from synchronous APIs

Batch workflows create durable input and output artifacts, so a synchronous API's privacy configuration may not apply. Anthropic's current batch-processing documentation explicitly labels Message Batches as not eligible for zero data retention or HIPAA use. Its results are available for a documented retention period. OpenAI's guide describes uploaded files and output artifacts with their own lifecycle. A buyer must review each provider's current data-processing terms for the specific batch endpoint, not infer them from a gateway's marketing.

Use synthetic data for the first tests. Before real production data, establish who can upload and download batch files, whether the gateway logs bodies, where files are stored, how they are deleted and whether a provider's region or contractual terms permit the workflow. If a task requires an unsupported privacy guarantee, use an approved alternative rather than routing around the restriction.

  • Check endpoint-specific ZDR, data residency, retention and contractual eligibility.
  • Prove that one tenant cannot list or download another tenant's batch results.
  • Document deletion and incident procedures for input files, output files and derived artifacts.

A minimum acceptance test for enterprise batch procurement

Run a controlled batch with twenty synthetic items: twelve valid, four intentionally invalid, two long-running, and two designed to exercise a retry or cancellation path. Use the same fixture set on direct-provider APIs and through the candidate gateway. Do not assume every provider allows identical error injection; where behavior differs, document the limitation and test the closest supported case. Measure submission success, result reconciliation, job completion, retries, auditability and invoice accuracy.

Pass the gateway only if every accepted result maps to one intended logical item, all partial failures are visible, the intended access policy applies to the batch lifecycle, and the observed provider cost can be reconciled. If the gateway does not support batch natively, an explicit, documented direct-provider bypass may be operationally acceptable, but it changes the security, observability and spending-control boundary. Add that bypass to the enterprise gateway RFP rather than hiding it.

  • Require a written route matrix: supported, unsupported, passthrough and untested for every lifecycle operation.
  • Capture the gateway version, provider API version, account plan and sanitized test outputs.
  • Retest after major model or gateway upgrades; batch support is an endpoint-level contract.

Sources

Evaluate the gateway on your own workload

Compare an actual gateway request with your direct-provider baseline. Review pricing, security controls and measured behavior before migrating production traffic.

Gateway evaluation resources

Continue from the concept to a practical cost, security or migration decision.

Continue reading

Related gateway comparisons

Frequently asked questions

Can I use a chat-completions gateway endpoint for OpenAI Batch API?

Not automatically. OpenAI Batch requires file upload, batch creation, polling and result retrieval. Verify that your gateway supports those endpoints or deliberately call the provider directly.

Do batch jobs always save 50%?

OpenAI and Anthropic document 50% discounts for eligible batch inference, but total workflow savings depend on completed items, retries, extra processing, gateway fees and model pricing.

Are Anthropic Message Batches eligible for zero data retention?

Anthropic's current batch documentation explicitly marks the feature as not ZDR eligible and not HIPAA eligible. Verify the latest provider documentation and your contractual requirements before using sensitive data.

Put the advice into practice

Optimize AI work with Foreman

Give the team a job. Foreman weighs the work, model capabilities and price, then explains its choices. Enable web tools for public research. Review, edit or decline proposed actions before they run.

Give Foreman a job →
Technical details

Reasoning-model task routing, persisted specialist/reviewer workflows, web search, Chromium browsing and approval-gated browser/HTTP writes. Fresh public sessions; no signed-in accounts or arbitrary code execution.

Set a limit before the work starts

Per-key spending controls. Each request reserves its estimated cost before it's sent, and parallel calls are only admitted while those reservations fit under the cap.

Set spending controls →
Technical details

Atomic catalog-priced cost reservations, per-key caps, and retained reservations for uncertain charges. Provider invoices, taxes and special rates can differ.