Why LLM API Bills Can Differ by 2x at the Same Token Price
This article explains why teams running identical workloads on different cloud platforms can receive LLM API bills that differ by nearly double, even when the published per-million-token prices match. It breaks down the common three-part pricing structure, shows how output tokens, cache hits, and cache writes shape the real cost, and details four frequently overlooked billing rules: cache TTL windows, standalone cache write charges, batch discounts, and the retirement of older model tiers. With sample calculations and a cost formula, it outlines how on-demand, batch, and subscription or off-peak scheduling affect the final bill, and closes with practical guidance on provider abstraction, real-time versus offline routing, cache-friendly design, and observability.
1. The Problem: Same Unit Price, Different Bills
A recurring source of confusion in enterprise LLM adoption is this: put the pricing pages of several cloud platforms side by side, and the per-million-token price for the same model tier is almost identical. Yet at month-end reconciliation, two teams running the same workload can end up with bills that differ by nearly 2x.
The conclusion first: the on-demand unit price only sets the sticker price. What actually determines the bill is four rules — how usage is metered (how input, cache hits, and output are split), batch discounts, the billing details of caching and cache writes, and subscription or off-peak scheduling mechanisms. Among four platforms with identical unit prices, 100% of the difference comes from the last three.
One point worth stressing: this article does not lock in any specific model. An important lesson from engineering practice is that making your business’s dependence on model capability replaceable through an adapter layer is what allows low-cost migration when prices and rules change.
2. A Unified Billing Model: Do the Math First
On-demand billing across mainstream platforms generally follows a three-part structure, in currency units per million tokens:
| Capability tier | Input | Cache hit | Output |
|---|---|---|---|
| Flagship | 20 | 2 | 100 |
| Balanced | 13 | 1.3 | 68 |
| Lightweight code | 6.5 | 1.3 | 27 |
(The above are illustrative list prices at common industry magnitudes, used to explain the cost structure. Refer to each platform’s official pricing page for actual figures.)
This gives the per-request cost formula:
def cost_per_call(in_tok, hit_tok, out_tok, price):p_in, p_hit, p_out = price # currency units per million tokensreturn (in_tok * p_in + hit_tok * p_hit + out_tok * p_out) / 1e6
Three structural facts to remember:
- Output costs roughly 5x more than input, so controlling generation length (max_tokens, structured output, summary-style answers) is more effective than compressing prompts.
- The cache hit price is about 1/10 of the input price; long system prompts, long documents, and fixed few-shot prefixes are the main battleground for hit rates.
- Cache writes are billed separately, with write costs tiered by TTL (commonly a 5-minute tier and a 1-hour tier). Only prefixes that get reused make caching worthwhile.
3. Four Overlooked Rule Details
Rule 1: Caching is enabled automatically, but TTL determines the hit window. Repeated prefixes usually hit automatically, with a default TTL that is often 5 minutes. This means a scheduled task that “runs every ten minutes” will almost certainly be billed at full input price every time. Batching similar tasks into requests within a 5-minute window can change the hit rate by an order of magnitude.
Rule 2: Cache writes are a standalone cost item. A one-off, very long document that runs only once means the write fee is a net loss. The test is simple:
If hit_count × (input_price - hit_price) > write_price, then caching pays off
Rule 3: Batch (offline asynchronous) discounts. The mainstream approach bills the asynchronous batch API at 50%–60% of the standard price, at the cost of no guaranteed real-time return. Offline evaluation, log labeling, data cleaning, and bulk translation should all go through batch.
Rule 4: The retirement pace of older model tiers. Platforms typically announce that an older series will stop opening to new users and will be gradually phased out, with official guidance to migrate to the new balanced tier. Architecturally, you must avoid hard-coding model names in business code.
4. Bill Projections for Three Typical Usage Patterns
Assume monthly usage: 300 million input tokens, 60% of which can hit the cache, and 60 million output tokens, at flagship-tier prices.
- Pure on-demand real-time: roughly 20×3×0.4 + 2×3×0.6 + 100×0.6 ≈ 87.6 (scales linearly with volume).
- Full batch (60% of standard price): about 52.6, a 40% reduction.
- Subscription + overage on-demand + off-peak scheduling: the subscription plan covers baseline traffic, and overage is billed on-demand; scheduling about half of deferrable calls into off-peak windows can reduce the total by another 12%–24%, and if off-peak usage exceeds half, the reduction can approach 48%.
def monthly(vol, price, batch_ratio=0.0, sub_cover=0, offpeak_ratio=0.0, offpeak_cut=0.0):billable = max(vol - sub_cover, 0)onpeak = billable * (1 - offpeak_ratio)offpeak = billable * offpeak_ratio * (1 - offpeak_cut)return (onpeak + offpeak) * (1 - batch_ratio * 0.4)
5. Selection and Implementation Recommendations
- Do not lock in capability: abstract a unified adapter layer, switch tiers and platforms via configuration, and preserve the right to migrate.
- Split real-time and offline: route real-time traffic to on-demand or subscription, and send all offline work to batch. This is the largest and most reliable cost-reduction lever.
- Cache-friendly refactoring: move fixed prefixes to the front, stabilize system prompts, and batch requests into windows to fully use the TTL.
- Access nearby: for workloads already on a given cloud, choosing a same-priced model service on the same cloud saves cross-network transfer and operations costs, at the same price as the original provider.
- Observability: tag and report token usage and cache hit rates by business line; do attribution before optimization. Cost governance relies on monitoring, alerting, and logging services, not on looking at the bill at month-end.
- When deploying on Baidu AI Cloud, it is likewise recommended to model with the three common billing factors, and combine batch async, caching, and quota alerts into a closed loop, avoiding being misled by a single price number.
