Cache Hit Rate and the Real Cost of Next-Generation LLMs
This article examines how cache hit rate and input-to-output ratio affect the real cost of next-generation LLM APIs. Using published price tiers, it derives effective input and blended unit costs, compares an enterprise coding agent with ad hoc developer usage, and explains why high cache reuse can lower marginal cost while unstable prompts keep costs near uncached rates. It also reviews architecture and pricing implications and provides a pre-selection checklist.
Start with pricing: changes across three tiers
The price figures below come from a cloud provider’s next-generation model and are stated in RMB per million tokens. The source does not specify the measurement date, tax treatment, or model version, so treat these numbers as calculation examples. Before choosing a model, check the provider’s current official pricing.
| Pricing tier | Previous generation (RMB) | Next generation (RMB) | Increase |
|---|---|---|---|
| Input (cache miss) | 6.5 | 20 | About 3.1x |
| Input (cache hit) | 1.1 | 2 | About 1.8x |
| Output | 27 | 100 | About 3.7x |
The largest increase is on the output side, and the smallest is in the cache-hit tier. Two other changes in the price structure are worth noting. First, the ratio of cache-miss input to cache-hit input widened from about 6x to 10x. Second, the ratio of output to cache-hit input widened from about 25x to 50x. This shows that the provider has widened the price gap between cache hits and other tiers. For users, whether cache hits can be sustained directly affects the final bill.
Why cache hit rate determines cost
LLM inference has two stages: prefill and decode. The prefill stage processes the full input context, while the decode stage generates output tokens one by one. If the server can retain the computed results for the same prefix (the KV Cache), later requests can reuse them instead of recomputing. This is the basic principle behind cache hits.
The input to coding agents is often made up of a stable prefix: system prompts, tool definitions, codebase summaries, and similar content. When the prefix is stable, there are more opportunities for cache reuse. The source reports a hit rate above 90%, but this is a result for a specific scenario, not a default value. Cache hits require three conditions: stable prefix content, cache reuse across requests, and a sufficiently high hit rate. If any one condition fails, actual cost will be close to the cache-miss price.
The source calculation does not include cache write costs or cache expiration time. If prefixes change frequently in your workload, the extra overhead from writes and expiration may offset part of the discount.
Cost calculation: two scenarios and assumptions
To make the calculation reproducible, define the variables first:
- Cache-hit input price M: RMB 2 per million tokens
- Cache-miss input price N: RMB 20 per million tokens
- Output price O: RMB 100 per million tokens
- Cache hit rate h: the share of input tokens that hit the cache among all input tokens
- Input-to-output ratio r: the number of input tokens is r times the number of output tokens
The formula for the effective input price is:
P = M × h + N × (1 − h)
The formula for the blended unit cost, weighted by all tokens, is:
C = (r × P + O) / (r + 1)
Scenario 1: Enterprise coding agent. Take r = 20 and h = 0.9.
- Effective input price P = 2 × 0.9 + 20 × 0.1 = RMB 3.8
- Blended unit cost C = (20 × 3.8 + 100) / 21 ≈ RMB 8.4
Scenario 2: Individual developer making ad hoc calls. Take r = 5 and h = 0.2.
- Effective input price P = 2 × 0.2 + 20 × 0.8 = RMB 16.4
- Blended unit cost C = (5 × 16.4 + 100) / 6 ≈ RMB 30.3
The unit cost differs by about 3.6x between the two scenarios. That figure changes both variables at the same time. If only one variable changes, the results are as follows:
- Keeping r = 20 and lowering the hit rate from 90% to 20% raises cost from RMB 8.4 to RMB 20.4, about 2.4x.
- Keeping h = 0.9 and lowering the input-to-output ratio from 20 to 5 raises cost from RMB 8.4 to RMB 19.8, about 2.4x.
Only when both changes are combined does the result reach 3.6x. Therefore, 3.6x applies only to this set of parameters from the source and should not be generalized to all users.
The table below shows blended unit cost (RMB per million tokens) as hit rate and input-to-output ratio vary:
| Cache hit rate | r = 20 | r = 5 |
|---|---|---|
| 90% | 8.4 | 19.8 |
| 70% | 11.8 | 22.8 |
| 50% | 15.2 | 25.8 |
| 20% | 20.4 | 30.3 |
Each step down in hit rate raises cost, but the input-to-output ratio also has a clear effect. In the enterprise scenario, output tokens account for only about 1/21 of all tokens but contribute about 57% of cost (100 / 176). This shows that the output price has a much larger impact on total cost than its share of token volume suggests.
Architecture background: limits of the source parameters
The source describes the next-generation model as a Mixture-of-Experts (MoE) architecture with about 2.8 trillion parameters, 896 experts, and 16 experts activated per inference. Those figures are not sourced or versioned, so this article does not rely on the specific numbers.
Even without relying on specific parameters, the architectural impact on cost can be understood. All expert weights in an MoE model must remain resident in GPU memory, even if only a small subset is activated each time. Expert routing requires data to be transferred between devices, which adds communication overhead. KV Cache size grows with context length, and the decode stage places higher demands on memory bandwidth.
Agent workloads differ substantially from ordinary chat. A normal chat interaction involves only tens to hundreds of tokens, whereas an agent task may call tools multiple times, accumulate context continuously, and run for hours or longer. Under this workload, memory and bandwidth pressure on the server increases noticeably. Cache reuse therefore becomes one of the main levers for reducing marginal cost, but its effect depends on prefix stability and hit rate. It cannot solve all cost problems on its own.
Understanding the pricing logic
From the price structure, the provider uses cache hit rate to segment usage. Enterprise users with frequent reuse and stable prefixes can spread unit cost through a high hit rate. Individual developers who change the prompt every time are unlikely to obtain cache discounts, and their effective unit price stays close to the cache-miss price.
This pricing approach affects different users very differently. Looking only at “how much did the price rise” can easily lead to one-sided conclusions. A more reasonable approach is to estimate your own hit rate and input-to-output ratio first, then apply the price list to calculate cost.
Pre-selection checklist
- Measure Prompt repetition in real call logs.
