Back to Home
Cost optimization8 min readSource: Admesh 技术团队

Batch API or real-time calls: how to choose the right channel for different workloads

Both Anthropic and OpenAI offer batch processing channels, trading a lower unit price for longer response times. This article provides an actionable decision framework: which tasks should go through batch, which must go real-time, and how to manage both types of traffic with the same gateway.

First, distinguish the two time scales

LLM calls vary enormously in their sensitivity to time. A user waiting for a reply in a chat box tolerates seconds; a team's daily report generation task may tolerate hours. The batch channel is designed for the latter: it queues requests, processes them in bulk, and trades a longer completion time for a lower per-token price.

Anthropic's [batch processing docs](https://platform.claude.com/docs/en/build-with-claude/batch-processing) and [pricing page](https://claude.com/pricing) both list batch-tier prices separately; OpenAI also has corresponding batch and batch processing discounts. What they share is a discount off the standard price; what differs is the submission method and completion window.

Decision framework: four questions

  1. Is someone synchronously waiting for this result? Yes → real-time. No → continue.
  2. Can the result be a few hours late? Yes → batch candidate. Must be minute-level → real-time.
  3. Is the request set something that can be enumerated offline? Yes (a batch of documents, a batch of tickets, a batch of evaluation samples) → batch is a very good fit.
  4. Is the cost of rerunning on failure high? High → real-time for immediate feedback; low → batch retries in bulk are more cost-effective.

Typical batch scenario checklist

  • Content classification and tagging: a unified tagging system for hundreds of thousands of products, reviews, and tickets.
  • Offline data cleaning: extracting unstructured text into structured fields in bulk.
  • Regression evaluation: running a fixed evaluation set for comparison before changing prompts.
  • Bulk summarization / translation: offline organization of document libraries, customer service records, and meeting minutes.
  • Synthetic data generation: generating samples in bulk for training or evaluation.

The pitfalls of batch: partial success and retries

A batch job is not 'all or nothing'. In a job of several hundred requests, a few usually fail due to parameter errors, overly long inputs, content policy, and so on. Engineering must ensure:

  • Record results per item; do not treat the success or failure of the whole batch as a single boolean.
  • Distinguish retryable from non-retryable: 429 / 5xx are retryable; retrying a 400 parameter error is useless.
  • Idempotency keys: resubmitting the same business data must not cause duplicate billing or duplicate writes.
  • Cost rehearsal: estimate an upper bound by tokens before submission to avoid an unexpected bill from a single job.

Manage both channels with one gateway

Splitting real-time and batch into two independent sets of accounts, keys, and bills is the most common architectural debt: when prices change you have to update two places, and troubleshooting failures means digging through two backends.

Admesh's approach is one Base URL, one set of keys, and one bill: on the business side you use task type to decide which channel to use, while the model catalog and unit prices always come from the same backend configuration, so margin and usage are visible in one place.

Admesh live rates (excerpt)

Prices come from the live Admesh configuration, in USD per million tokens. See the model catalog for the full list.

Admesh.ai Model Price List: Prices and Context Windows for 8 Enabled Models
Model Name and IDContext WindowEnter price / 1MOutput Price / 1MCache Hits / 1M
Claude Fable 5anthropic/claude-fable-5
1M$3.25 / 1M$16.25 / 1M$0.325 / 1M
Claude Fable 5.1anthropic/claude-fable-5-1
1M$3.25 / 1M$16.25 / 1M$0.08125 / 1M
Claude Haiku 4.5anthropic/claude-haiku-4-5-20251001
200K$0.325 / 1M$1.625 / 1M$0.0325 / 1M
Claude Haiku 5.5anthropic/claude-haiku-5-5
1M$0.0325 / 1M$0.1625 / 1M$0.00325 / 1M
Claude Opus 4.5anthropic/claude-opus-4-5-20251101
200K$1.625 / 1M$8.125 / 1M$0.1625 / 1M
Claude Opus 4.6anthropic/claude-opus-4-6
1M$1.625 / 1M$8.125 / 1M$0.1625 / 1M
Claude Opus 4.7anthropic/claude-opus-4-7
1M$1.625 / 1M$8.125 / 1M$0.1625 / 1M
Claude Opus 4.8anthropic/claude-opus-4-8
1M$1.625 / 1M$8.125 / 1M$0.1625 / 1M

The above are the standard unit prices for public channels; billing is based on actual token usage. View the complete model catalog

View rate limit and concurrency documentation →

FAQ

How much can batch save?
Batch discounts vary by vendor and model and are adjusted across generations, so hardcoding percentages in an article is not advisable. The right approach is to confirm on the current pricing page, or compare real-time and batch prices directly in the gateway's price list.
How long does a batch job usually take to complete?
It depends on the vendor's queuing policy and job volume, and may range from tens of minutes to over ten hours. The business side should not rely on the assumption that it will 'definitely complete within N hours'; it should be built as an async task with callbacks/polling plus a timeout fallback.
Can the same business mix batch and real-time?
Not only can it, it is recommended. A typical structure is: the user's immediate actions in the interface go through the real-time channel, while background bulk organization, evaluation, and archiving go through the batch channel, with both sharing the same model catalog and price configuration.

References

Call these models through one gateway

Admesh provides a unified OpenAI-compatible API: one Base URL and one key for Claude, GPT, DeepSeek and more. New accounts get trial credit that never expires.