The Cache Economics Behind LLM API Price Hikes
This article breaks down a recent LLM API pricing update and shows why the headline increase matters less than the widening gap between cache hit and cache miss tiers. It abstracts API billing into a three-tier model, derives a formula for effective cost per request based on cache hit rate and input-to-output token ratio, and recalculates two contrasting scenarios that differ by more than 3x in unit cost. It also includes a sensitivity table, practical engineering steps for improving prefix reuse, and guidance for vendor selection and contract review.
1. The Trigger: An Across-the-Board Price Adjustment
A new-generation large model behind a recent AI coding tool published updated billing rates. Compared with the previous generation, the output price rose from roughly CNY 27 to CNY 100 per million tokens, close to 4x. On the input side, cache miss moved from about CNY 6.5 and cache hit from about CNY 1.1 to CNY 20 and CNY 2 respectively, roughly 3x. On the surface this is a blanket increase, but the structural change is more telling than the absolute numbers once you look at the ratios between tiers.
In the previous generation, miss-priced input was about 6x hit-priced input, and output was about 25x hit-priced output. The new generation stretches those ratios to 10x and 50x. In other words, the cache hit tier rose relatively modestly, the output tier rose the most, and the spread between hit and miss was widened significantly. This is not arbitrary: it makes the differences in the underlying cost structure explicit in the price list.
2. Abstracting the Price List into a Three-Tier Billing Model
Setting aside any specific product, mainstream LLM API billing can be reduced to three tiers:
- Input miss: the full prompt participates in computation, the most compute-intensive case;
- Input hit: the prefix reuses an existing KV cache and only the increment is computed;
- Output: generated token by token autoregressively, with no reuse possible and therefore rigid cost.
Let P_miss be the miss input price, P_hit the hit input price, P_out the output price, h the cache hit rate, and r the input-to-output token ratio (input tokens / output tokens). The blended cost of a unit request is:
effective_input = h * P_hit + (1 - h) * P_misscost_per_request = input_tokens * effective_input + output_tokens * P_outcost_per_1M_tokens_total = (r * effective_input + P_out) / (r + 1)
This formula is the core of the whole discussion: the real bill is not determined by the sticker price, but by h and r together.
3. Two Scenarios Recalculated: Same Model, More Than 3x Cost Difference
Scenario A: an enterprise-grade long-context coding agent with an input-to-output ratio of about 20:1 and heavy prefix reuse, at a 90% hit rate.
effective_input ≈ 2*0.9 + 20*0.1 = 3.8 CNY per million tokensblended cost ≈ (20*3.8 + 100) / 21 ≈ 8.4 CNY per million tokens
Scenario B: an occasional individual developer whose prompt differs every time, at a 20% hit rate and a 5:1 input-to-output ratio.
effective_input ≈ 2*0.2 + 20*0.8 = 16.4 CNY per million tokensblended cost ≈ (5*16.4 + 100) / 6 ≈ 30.3 CNY per million tokens
For the same model, the former’s unit cost is roughly one third to one quarter of the latter’s. The conclusion is clear: the new price list is effectively a discount for customers who reuse the same system prompt and prefix over the long term, and full price or even a premium for those who change context every single call.
4. Why the Hit Rate Is the First Cost Lever
The hit rate matters because it acts on both the largest term and the spread term in the formula. When P_miss is 10x P_hit, every 10-point drop in hit rate is amplified in the effective input price. A sensitivity check (r=20):
| Hit rate | Effective input price | Blended cost |
|---|---|---|
| 95% | 2.9 | 7.1 |
| 90% | 3.8 | 8.4 |
| 70% | 7.4 | 12.0 |
| 50% | 11.0 | 15.2 |
| 20% | 16.4 | 20.3 |
A drop in hit rate from 90% to 70% raises blended cost by about 43%, with no change in the sticker price at all. So the first priority in cost optimization is not switching models, but raising the prefix reuse rate.
5. What Engineering Teams Can Actually Do
- Normalize the prefix: put the system prompt, tool definitions, and few-shot examples at the very front in a fixed order, and never concatenate volatile content such as timestamps, random IDs, or user nicknames into the prefix. Fields like these are hit-rate killers.
# Recommended: stable prefix + volatile suffix[system prompt][tool schema][few-shot][stable repo context] | [user query][timestamp]
- Layer the context: summarize and chunk long documents and code search results, and place only the fragments needed for the current turn into context, instead of hauling the full content along every turn.
- Session stickiness: route multi-turn conversations to the same instance where possible to reduce the chance of the cache being evicted; for high-concurrency cases, apply grouping and quota isolation.
- Observability: instrument hit tokens, miss tokens, and output tokens separately, and build a unit-cost dashboard on top of monitoring, alerting, and logging services. Do attribution first, optimization second.
- Budget guardrails: set token budgets and rate-limit thresholds per business line, and validate admission for requests with extremely long context.
6. Selection and Contract Considerations
When evaluating an LLM service from a cloud provider or platform, do not compare sticker prices alone. Plug your own real traffic profile (the distribution of r and h) into the formula for a weighted estimate, and confirm whether the cache scope, invalidation policy, and billing definitions are publicly documented and transparent. If prefix reuse in your workload is low, prefer pay-as-you-go billing combined with a local caching layer; if reuse is high, fix the reusable context in place and turn the large tier spread in the price list into a cost advantage of your own. Cloud vendors such as Baidu AI Cloud typically offer a general combination of capabilities from container platforms to monitoring and alerting, which makes it easier for teams to build this cost governance chain themselves.
7. Summary
The size of the increase is only the surface. The real variables are the cache hit rate and the input-to-output ratio. Write the three-tier billing model into your own cost formula, measure h continuously with a dashboard, and enforce prefix stability through engineering conventions, and you can end up with entirely different unit costs under the very same price list.
