Why LLM API Bills Can Differ by 2x at the Same Unit Price
Many teams compare LLM pricing pages cell by cell and conclude that all providers cost the same, only to find their monthly bills nearly double those of another team at identical call volume. This article explains why per-token unit price is just one coefficient in the cost formula, breaks the bill into input, cache, and output components, examines four commonly overlooked rules around cache lifetime, model deprecation, region factors, and free quotas or subscriptions, and provides a reusable estimation script plus a practical optimization checklist.
1. The Symptom: Identical Price Tables, Diverging Bills
When evaluating models, many teams pull each provider’s pricing page into a single table and compare three numbers cell by cell: input, cache hit, and output price per million tokens. When the table matches exactly, the conclusion is usually “it doesn’t matter which one we pick,” so a provider is chosen at random. Then the monthly bill arrives, and two teams with the same call volume find their spending differs by nearly 2x.
Nobody miscalculated. The per-token unit price is only one coefficient in the cost formula. What actually determines the bill is which tokens go through which billing channel, plus how each platform’s rules differ across caching, batch processing, subscriptions, free quotas, and regions. Same unit price, different rules, diverging bills.
This article covers no specific vendor. It abstracts these differences into a computable model and offers optimization steps you can apply.
2. Breaking the Bill into Three Parts: Input, Cache, Output
General LLM billing can usually be written as:
monthly cost = input tokens × input price+ cache write tokens × write price+ cache hit tokens × hit price+ output tokens × output price- free quota deduction× discount factor (batch / off-peak / subscription)× region factor
The key point: there is often an order-of-magnitude gap between the input price and the cache hit price (for example, 20 versus 2). This means the cache hit ratio is not a performance metric but a first-order variable in the bill.
Consider an illustrative comparison (prices are arbitrary and only demonstrate magnitude):
- Scenario A: 100 million input tokens, 0% cache hit ratio, all billed at the standard input price.
- Scenario B: the same 100 million input tokens, 70% hit ratio, only 30% billed at the standard price and the rest at the hit price.
With a 20 / 2 price gap, the input-side cost of B is roughly one third of A. In a workload where the system prompt, tool definitions, and knowledge base snippets are stable and reused as a long prefix, the hit ratio is naturally high. Conversely, if every request reassembles the context from scratch and mixes in timestamps or random IDs, the hit ratio drops close to 0 and the bill doubles outright.
3. Four Rules That Are Easy to Overlook
3.1 Caching Is “On by Default,” but Has a Limited Lifetime
Most platforms automatically enable caching for repeated prefixes and set a default time to live (commonly on the order of minutes). This has two consequences. First, a hit is not a free lunch: the write side is usually billed separately, often tiered by duration. Second, caches expire during traffic troughs, so a batch job running overnight may see a hit ratio far below that of daytime online traffic. Cost evaluation must use the real traffic curve, not an average.
3.2 The Retirement Schedule of Older Model Versions
When a model generation stops opening to new users and is scheduled for full retirement months later, teams still using it face a forced migration. Migration means re-tuning prompts, re-running evaluation sets, and possibly invalidating the cached prefix structure — an implicit cost reset. Model lifecycle should be part of the evaluation.
3.3 Region Factors
The same model may cost more in non-core regions, and the markup is not a clean multiple but a ragged decimal that bundles exchange rates and localization costs. Cross-border workloads that connect to the nearest region by default carry a premium on the bill that is easy to miss.
3.4 The Boundaries of Free Quotas and Subscriptions
New model launches often come with a one-time free quota, which suits load testing and evaluation but not steady production traffic. Subscription or plan-based pricing trades off-peak usage for a lower price and requires the workload to be deferrable. The batch channel works the same way: the price of cheap is latency, moving from seconds to minutes or even hours.
4. A Reusable Estimation Script
Upgrade model selection from “reading the pricing page” to “running your own traffic through it”:
def estimate(cost, tokens_in, tokens_out, hit_ratio,batch_ratio=0.0, idle_ratio=0.0,free_quota=0, region_factor=1.0):hit = tokens_in * hit_ratiomiss = tokens_in - hitbase = (miss * cost.in_price+ hit * cost.cache_hit_price+ tokens_out * cost.out_price)discount = (1 - batch_ratio) * (1 - idle_ratio)return max(base - free_quota, 0) * discount * region_factor
Usage notes: measure hit_ratio with a small amount of real traffic first, then plug it in; set batch_ratio and idle_ratio to non-zero values only when the workload tolerates latency.
5. Optimization Checklist
- Stable prefix: put the system prompt, tool descriptions, and fixed knowledge snippets first and keep them byte-for-byte stable; never insert timestamps or request IDs.
- Control write frequency: a long TTL suits stable prefixes, a short TTL suits reuse within a session; avoid paying write fees for one-off content.
- Context trimming: carry only the necessary history; output length is often more expensive than input, so limiting
max_tokenspays off significantly. - Traffic tiering: route online interaction through the standard channel and offline batch work through the discounted channel.
- Observability: log input, hit, and output tokens plus the hit ratio daily, and attribute cost to business lines.
6. Conclusion
An identical unit price only means the same starting point; bill differences come from rules, traffic shape, and engineering habits. Treating cost as an engineering metric that can be measured, attributed, and optimized — rather than a one-time comparison on a pricing page — is the right way to control LLM spending. For fuller cost governance, you can build a token usage dashboard on Baidu AI Cloud by combining monitoring and alerting with logging services, enabling continuous accounting per business dimension.
