Understanding Cache Pricing Behind Large Model API Price Increases

    This article breaks down why a new-generation general-purpose LLM's API price increase is not a simple across-the-board hike once cache hit and miss tiers are compared by ratio. It explains how disaggregated inference turns KV cache into a separately priced resource, provides a blended-cost formula with two contrasting scenarios, lists the four factors that determine cache hit rate, and offers a practical optimization checklist for controlling costs under cache-based billing.

    1. The Signal: A Price Update That Looks Like an Across-the-Board Increase

    When a new-generation general-purpose LLM published its API pricing, community discussion focused on the size of the increase: the output tier rose from 27 CNY per million tokens in the previous generation to 100 CNY, nearly 4x; the input tier moved from 6.5 CNY (cache miss) and 1.1 CNY (cache hit) to 20 CNY (miss) and 2 CNY (hit), roughly 3x. Looking at these three numbers alone, the conclusion seems to be a uniform price increase.

    But once you lay out the ratios between tiers, the picture becomes more complicated:

    Ratio Previous generation New generation
    Miss input / hit input ~6x 10x
    Output / hit input ~25x 50x

    Two key facts emerge: the cache-hit tier is the most moderate increase, while the output tier rises the most sharply. In other words, the change in price structure is far larger than the change in price itself. This is usually not something a “cost increase” can explain; it is the billing structure reallocating incentives.

    2. Why Vendors Widen the Ratios: Disaggregated Inference Changes the Cost Model

    To understand this structure, you need to go back to the cost composition of inference serving. The cost of a request is roughly made up of four parts: prefill (the forward pass over the input that produces the KV cache), decode (token-by-token autoregressive generation), storage and movement of the KV cache, and queuing and scheduling overhead.

    Traditional “monolithic” deployment places prefill and decode on the same GPU, even though the two have completely different resource profiles: prefill is compute-intensive, bursty, and batchable; decode is memory-access-intensive, long-tailed, and latency-sensitive. Co-locating them causes mutual interference, and GPU utilization is “averaged” downward.

    Disaggregated inference architectures (a common industry approach) split the two into separate resource pools: the prefill pool aims to max out compute, while the decode pool aims for memory bandwidth and concurrency. This split produces a side effect—the KV cache becomes an independent resource that can be explicitly priced and reused for the first time. On a cache hit, prefill is almost entirely skipped, leaving only the cost of storage reads and network movement, so the hit price can be pushed extremely low; on a miss, the full prefill compute must be paid for, so the price is naturally high. Widening the ratios is essentially turning “whether you reuse” into the most sensitive lever on the bill.

    3. Doing the Math: Two Contrasting Scenarios

    Let the input-to-output ratio be $r$ (input tokens / output tokens) and the cache hit rate be $h$. The blended unit price is:

    1. input_effective = P_hit * h + P_miss * (1 - h)
    2. cost_per_1M_total = (r * input_effective + P_out) / (r + 1)

    Scenario A: enterprise-grade coding agent, $r=20$, $h=0.9$

    1. input_effective = 2*0.9 + 20*0.1 = 3.8
    2. total = (20*3.8 + 100) / 21 ≈ 8.4 CNY per million tokens

    Scenario B: individual developer, $r=5$, $h=0.2$

    1. input_effective = 2*0.2 + 20*0.8 = 16.4
    2. total = (5*16.4 + 100) / 6 ≈ 30.3 CNY per million tokens

    Calling the same model, A’s unit cost is about 1/3.6 of B’s. The so-called “5x increase” is a discount for A and the original price or even a premium for B. It must be emphasized here that $h=0.9$ is the result of a specific architecture under a specific workload, not a general promise; the hit rate depends heavily on the business shape and should not be written into a budget as a default assumption.

    4. Four Factors That Determine the Hit Rate

    1. Prefix stability: whether the system prompt, tool definitions, and few-shot examples change from request to request. Even inserting a single timestamp invalidates the entire prefix.
    2. Session structure: whether multi-turn conversations “append” rather than “rewrite”. Rewriting history means actively giving up all historical cache.
    3. Routing and concurrency: whether requests land on the same cache shard; batch size, timeouts, and retry policies all affect the reuse window.
    4. Eviction policy and capacity: whether hot prefixes get pushed out and long-tail requests get recomputed repeatedly.

    5. An Actionable Optimization Checklist

    • Layer the prefix: split content into stable layer (system / tool schema) → semi-stable layer (knowledge snippets) → volatile layer (user input), and always place volatile content last.
    • Templatize: use placeholders instead of runtime concatenation, and never embed random IDs or timestamps at the top of the prompt.
    • Append history only: keep the message sequence monotonically growing in multi-turn scenarios.
    • Semantic caching: cache results for high-frequency similar requests, with a similarity threshold and invalidation policy to avoid incorrect hits.
    • Observability: bring cache_hit_ratio, prefill and decode latency, and token distribution into monitoring and alerting, and attribute costs by business line.
    • Capacity planning: use the formula above for sensitivity analysis, sweep $h$ from 0.2 to 0.9, and observe the total cost curve instead of budgeting from a single-point price.

    Illustrative cost evaluation code:

    1. def blended_cost(r, h, p_hit=2.0, p_miss=20.0, p_out=100.0):
    2. eff_in = p_hit * h + p_miss * (1 - h)
    3. return (r * eff_in + p_out) / (r + 1)
    4. for h in (0.2, 0.5, 0.7, 0.9):
    5. print(h, round(blended_cost(20, h), 2))

    6. Conclusion

    Evaluating any API price change should not rely on the headline multiplier alone; it should look at three things: how the ratios between tiers change, where your own input/output ratio and hit rate sit, and whether prefix engineering has already squeezed out the reusable portion. For high-reuse workloads, cache pricing is a cost-reduction tool; for low-reuse workloads, it is a risk signal. If you need elastic compute and supporting general-purpose cloud capabilities in data, caching, and monitoring to carry the architecture above, you can combine them on demand within the general product portfolio of platforms such as Baidu AI Cloud, but the cost conclusion should still be derived from your own workload profile, not from the list price.