Understanding LLM API Cache Pricing: Why a Price Hike Can Lower Your Actual Costs
This article breaks down the pricing logic behind recent large language model API price increases, focusing on the three-tier billing model of cache misses, cache hits, and output tokens. Using the published price ratios and weighted cost formulas, it compares two usage profiles to show how cache hit rate and input-to-output ratio determine real unit costs. It also provides a practical optimization checklist for improving prefix reuse, controlling output length, and building cost observability.
1. The Phenomenon: Across-the-Board Increases, but Uneven in Practice
A recent pricing update for a new-generation model API from an AI coding tool drew attention: the output price is roughly 4x the previous generation, the uncached input price is about 3x, while the cache-hit tier saw a more moderate increase. On the surface, this looks like a blanket price hike. But comparing the three tiers as ratios reveals that the structural shift matters more than the absolute increase.
- In the previous generation, the uncached input price was about 6x the cache-hit price; the new generation widens that gap to roughly 10x.
- The ratio of output price to cache-hit price expanded from about 25x to about 50x.
These two ratio changes show that the pricing focus has clearly shifted toward repeated computation. In other words, the vendor is using price signals to encourage callers to increase prefix reuse and reduce redundant inference overhead. For developers, this means the key variable for cost optimization has moved from “which model to choose” to “how to structure requests.”
2. The General Model Behind Three-Tier Billing
Most mainstream LLM APIs split the cost of a single call into three tiers:
- Input cache miss: the prompt prefix for this request does not exist in the cache and must be fully computed;
- Input cache hit: the prefix matches cached content, intermediate computation results can be reused, and the unit price is significantly lower;
- Output: each token generated by the model, usually the most expensive tier.
The effective input unit price for a request can be written as:
Effective input unit price = hit price × hit rate + miss price × (1 - hit rate)
The blended unit cost is weighted by the input-to-output ratio:
Blended cost = (input tokens × effective input unit price + output tokens × output unit price) / total tokens
These two formulas are the core of this article: for the same model, different calling patterns can produce actual costs that differ by several times.
3. Quantifying Two Usage Scenarios
Using the published price magnitudes (input miss 20 CNY, hit 2 CNY, output 100 CNY, in CNY per million tokens) for an illustrative calculation.
Scenario A: an enterprise-grade long-context coding assistant with an input-to-output ratio of about 20:1 and a cache hit rate of 90%.
Effective input unit price ≈ 2 × 0.9 + 20 × 0.1 = 3.8Blended cost ≈ (20 × 3.8 + 1 × 100) / 21 ≈ 8.4
Scenario B: a low-frequency individual developer whose prompts differ every time, with a 20% hit rate and an input-to-output ratio of 5:1.
Effective input unit price ≈ 2 × 0.2 + 20 × 0.8 = 16.4Blended cost ≈ (5 × 16.4 + 1 × 100) / 6 ≈ 30.3
The conclusion is clear: the unit cost in Scenario A is a little more than one-third of Scenario B. The so-called “5x price increase” looks more like a discount for callers with high reuse and long contexts; for scattered calls with low reuse, it is close to the original price or even a premium. In the industry, cache hit rates above 90% in long-context scenarios are not uncommon. This usually relies on general architectural techniques such as disaggregated inference and prefix-tree reuse, rather than a proprietary feature from any single vendor.
4. Who Is Paying for the Increase
Plugging the formulas into different user profiles yields three takeaways:
- Teams with long sessions, fixed system prompts, and repository-level context: high hit rates mean the effective increase is far below the list-price increase;
- Callers with short prompts, one-off tasks, and frequently changing templates: they absorb nearly the full uncached price and are the main group under pressure from this pricing round;
- Output-intensive tasks (such as large-scale code generation and long-document summarization): regardless of hit rate, the output unit price is the dominant term, so optimization should focus on reducing generation length.
5. An Actionable Optimization Checklist
- Stabilize the prefix: place system prompts, tool definitions, and example samples at the very front of the request and keep them byte-for-byte stable; avoid inserting volatile content such as timestamps or random IDs.
- Layer the context: assemble “stable layer—session layer—temporary layer” separately, with temporary content placed last to prevent prefix cache pollution.
- Control output: use structured output, field trimming, and segmented generation to compress output tokens and directly cut the most expensive tier.
- Make hit rate observable: log the hit status and token composition of each call at the gateway, and build a cost dashboard with logging services and monitoring alerts, attributed by business line.
- Architecture choices: high-concurrency scenarios can adopt general approaches such as disaggregated inference and prefix cache pooling; batch tasks can combine message queues for peak shaving and merging to reduce cold starts of repeated prefixes.
- Cost guardrails: set budget thresholds and fallback policies for different businesses, automatically switching to a more economical calling mode when the hit rate is low.
6. Conclusion
Evaluating an API price change requires more than looking at the output price multiple. Only by plugging the hit rate and input-to-output ratio into the weighted formula can you calculate your true unit cost. For developers, cache hit rate is an engineering metric that can be actively optimized; incorporating it into architecture design and observability is more valuable than debating the list price.
