DEV Community

Cover image for When Batch Inference Is Cheaper Than Real-Time LLM Calls
Eric Thompson
Eric Thompson

Posted on

When Batch Inference Is Cheaper Than Real-Time LLM Calls

Batch inference is listed at half the price of real-time calls at Anthropic, OpenAI and Google. It is actually cheaper for your workload when four conditions hold:
The work can wait minutes to hours, because nobody is waiting on each result.
The savings pay back the pipeline. In our model, a batch queue costs about $7,000 to build. It pays back in six months if you move about $2,700 a month of real-time spend to batch, and never pays back below about $350 a month.
Prompt caching does not already win. When requests share a large prompt prefix, real-time calls with caching can cost less than batch. In our shared-prefix scenario, real-time with caching cost $4,800 a month against $10,000 for batch without caching; batch only won once its own cache hit rate passed about 68%.
Expired and failed requests stay rare. If 5% of batch requests must be rerun in real time, the saving falls from 50% to 47.5%.
For small or uncertain volumes, a flex tier, which offers batch-level prices on ordinary API calls at OpenAI and Google, can capture most of the saving without building a pipeline. The rest of this article shows each condition and its arithmetic.

The sourced prices

All three major providers discount batch by half; caching and flex tiers change how much of that discount is unique to batch.
Anthropic: Claude Sonnet 5.5 costs $2 per million input tokens and $10 per million output at standard rates, $1 and $5 in batch. Cache reads cost $0.10 per million, five-minute cache writes $2.50 (Anthropic pricing). Batch and caching discounts stack, but cache hits in batch are best-effort, typically 30–98% depending on traffic. Most batches finish within an hour; requests not finished within 24 hours expire (Anthropic batch docs).
OpenAI: flex processing charges Batch API rates on ordinary synchronous calls, which are slower and may be refused when capacity is short; refused requests are not charged (OpenAI flex docs).
Google Gemini API: Batch mode and a Flex tier are both 50% off; Flex targets 1–15 minute responses. Context caching gives 90% off cached tokens plus a storage charge (Google docs).
One derived figure: this article assumes a cache read inside a batch costs $0.05 per million on Sonnet 5.5, applying the batch discount to the $0.10 cache price because Anthropic says the two discounts stack. Confirm the exact rate on your invoices.

Condition 1: the work can wait

Batch is only an option for requests where a delay of minutes to hours costs nothing. The test is simple: is a person, or a live process, waiting for this specific answer?

Usually fine to wait

Classifying, tagging and extracting data from documents, tickets or records
Enriching CRM or catalog entries
Building summaries or embeddings for search
Running evaluation suites after a change
Overnight reports and digests
Re-processing historical data after a prompt or model change

Cannot wait

Chat and customer support replies
Search answers and in-app assistants
Agent actions inside a user's session
Decisions that block a transaction, such as fraud or moderation checks
In between: minutes, not hours. A summary a user will check later, or a background task that should finish within a quarter of an hour, fits a flex tier better than a 24-hour batch window. Flex offers batch-level prices on ordinary calls, at the cost of slower and occasionally refused responses.
Count only the deferrable share of your spend when estimating savings. Teams often overestimate it.

Condition 2: savings outrun the pipeline cost

A 50% discount on a small bill does not pay for the engineering needed to use it. Calculate payback before building.

What the pipeline costs (illustrative)

A production batch pipeline needs a queue, scheduled submission within batch size limits, result matching by request ID, retry and expiry handling, result download before retention ends, and cost tagging. In our model:
Build: 80 hours at $87 an hour = $6,960
Upkeep: 2 hours a month = $174 a month

The payback formula

\text{Payback months} = \frac{\text{Build cost}}{0.5 \times \text{monthly deferrable spend} - \text{monthly upkeep}}
Payback at different spend levels
$200 a month of deferrable real-time spend: saves $100, less than upkeep. Never pays back.
$1,000 a month: saves $326 net. About 21 months.
$2,668 a month: saves $1,160 net. 6 months.
$5,000 a month: saves $2,326 net. 3 months.
$7,000 a month: saves $3,326 net. About 2 months.
The threshold for a one-year payback is about $1,500 a month of deferrable spend; for six months, about $2,700. Below roughly $350 a month, savings never cover upkeep.

Ways to lower the bar

Use a flex tier where offered: same discount, no new pipeline.
Reuse an existing job scheduler rather than building one.
Share one pipeline across every deferrable workload, so the build cost is paid once.

Condition 3: caching does not already win

When most of each request is the same text, prompt caching can cut real-time cost by more than batch does. Then the question is not batch versus real-time, but how reliably each one hits the cache.

A shared-prefix workload (illustrative)

1 million requests a month, each with an 8,000-token shared prefix (a policy manual, product catalog or long instructions), 500 tokens of unique content and 300 output tokens.
Real-time, no caching: 8,500 million input × $2 + 300 million output × $10 = $17,000 + $3,000 = $20,000 a month
Real-time with caching, near-100% hits at steady traffic: 8,000 million × $0.10 + 500 million × $2 + $3,000 = $800 + $1,000 + $3,000 = $4,800
Batch, no caching: 8,500 million × $1 + 300 million × $5 = $8,500 + $1,500 = $10,000
Batch with caching at a 50% hit rate: 4,000 million × $0.05 + 4,000 million × $1 + 500 million × $1 + $1,500 = $200 + $4,000 + $500 + $1,500 = $6,200
Batch with caching at a 90% hit rate: 7,200 million × $0.05 + 800 million × $1 + $500 + $1,500 = $360 + $800 + $500 + $1,500 = $3,160

What this shows

Batch without caching costs about twice as much as real-time with caching here.
Batch with caching beats cached real-time only when its cache hit rate exceeds about 68%. Anthropic describes batch cache hits as best-effort, typically 30–98%, so measure yours before assuming.
Output tokens ($3,000 real-time, $1,500 batch) do not benefit from caching. The more of your bill is output, the more batch's discount matters.
Cache write costs are left out here. They are small when the same prefix is reused many times, but matter for workloads with many different prefixes.

Condition 4: expiries and reruns stay small

Requests that do not finish inside the batch window expire. If they must then be rerun at real-time prices, part of the saving disappears.

Effective cost relative to real-time (illustrative)

If a share of batch requests expires and is rerun at full price:
\text{Effective cost} = (1 - e) \times 0.5 + e \times 1.0
where e is the share rerun in real time.
2% rerun: 51% of real-time cost, a 49% saving
5% rerun: 52.5%, a 47.5% saving
10% rerun: 55%, a 45% saving
25% rerun: 62.5%, a 37.5% saving
Even at high rerun rates batch stays cheaper. The bigger risk is operational: expired requests nobody notices leave gaps in your data.

How to keep reruns low

Resubmit expired requests to the next batch rather than real time, unless the deadline is close
Submit large jobs early, so there is time to retry within the same day
Track status per request, not per batch, since some requests can fail while others succeed
Download results promptly; Anthropic keeps batch results for 29 days
Worked scenarios side by side (illustrative)
The same discount produces very different results depending on volume, shared content and whether a pipeline already exists.

A. Document classification at volume: batch wins clearly

1 million documents a month, 2,000 input and 300 output tokens each, no shared prefix.
Real-time: 2,000 million × $2 + 300 million × $10 = $7,000 a month
Batch: 2,000 million × $1 + 300 million × $5 = $3,500 a month
Net saving after $174 upkeep: $3,326 a month; the $6,960 pipeline pays back in about two months

B. Shared-prefix workload: cached real-time competes

The Condition 3 example.
Real-time with caching: $4,800
Batch with caching: $3,160 to $6,200, depending on cache hit rate
Batch wins only above about a 68% batch cache hit rate. Measure before moving.

C. Small deferrable workload: batch does not pay

$200 a month of deferrable real-time spend.
Batch saves $100 a month, less than the $174 monthly upkeep
Use a flex tier, or a scheduler you already run, or stay real-time

D. Mixed traffic: split the lanes

A product with $10,000 a month of model spend, 40% of it deferrable.
Moving the $4,000 deferrable share to batch saves $2,000 a month, $1,826 after upkeep

Payback on the pipeline: about four months

The remaining $6,000 of interactive traffic stays real-time, with caching where prefixes repeat

Decision rules

Work through these in order for each workload.
Is anyone waiting on each result? If yes, stay real-time. Use caching for repeated prefixes.
Can it wait minutes but not hours? Use a flex tier where your provider offers one.
Can it wait hours? It is a batch candidate. Go on.
Is your deferrable spend above about $1,500 a month, or do you already have a batch pipeline? If not, batch rarely pays back; use flex or stay real-time.
Do requests share a large prefix? Compare real-time with caching against batch with caching, using your measured batch cache hit rate. Batch wins in our example only above about 68%.
Is the output share of your bill large? Output tokens never benefit from caching, so batch's discount on them is decisive.
Can you handle expiries? Track requests individually and resubmit; even a 10% rerun rate keeps a 45% saving.
Rerun this review whenever prices change or a new deferrable workload appears; adding a workload to an existing pipeline costs little.

FAQs

Is batch inference always 50% cheaper?

The list price is half at Anthropic, OpenAI and Google. Your actual saving is lower once you count the pipeline, expired requests, and the fact that prompt caching may already cut your real-time cost.

How much spend do I need before building a batch pipeline?

In our model, about $1,500 a month of deferrable real-time spend for a one-year payback and $2,700 for six months. Below about $350 a month, the saving never covers upkeep.

Can prompt caching beat batch?

Yes, when requests share a large prefix. In our example, real-time with caching cost $4,800 a month against $10,000 for batch without caching. Batch with caching won only above about a 68% cache hit rate.

Do batch and caching discounts combine?

At Anthropic, yes, though cache hits inside batches are best-effort, typically 30–98%.

What is a flex tier?

A synchronous API option priced like batch, offered by OpenAI and Google. Responses are slower and can be refused when capacity is short, but no batch pipeline is needed.

What happens if batch requests expire?

They must be resubmitted. Rerunning even 10% of requests at real-time prices still leaves a 45% saving, but expired requests nobody notices leave gaps in your data.

Top comments (0)