The Cache Economics Behind LLM API Price Hikes: How to Evaluate True Inference Costs

    Recent price hikes for large language model (LLM) APIs have sparked concerns over rising costs, but a closer look at the pricing structure reveals a reallocation of weights based on cache hit rates. This article breaks down the new pricing tiers, explains why cache hit rates determine your actual inference costs, and provides scenario-based cost models along with engineering strategies to optimize cache reuse and reduce your overall API bills.

    (Note: The following article is the body text.)

    Recently, a major LLM vendor released a new generation of models with significantly higher API pricing compared to the previous generation: the output price reached 100 CNY/million tokens, the input price for cache misses was 20 CNY/million tokens, and the price for cache hits was 2 CNY/million tokens. News of this immediately sparked discussions about prices “quadrupling or quintupling.” However, if we deconstruct the pricing structure, we find that the situation is far more complex than a simple across-the-board price increase. This is a reallocation of pricing weights, and the actual cost changes borne by developers with different usage patterns can vary by several multiples.

    1. Examining the Price Tags: The Real Increases Across Three Tiers

    Comparing the pricing to the previous generation, the increases can be broken down into three dimensions:

    • Output side: Increased from 27 CNY/million tokens to 100 CNY, nearly 4 times, marking the steepest hike.
    • Input side (cache miss): Increased from 6.5 CNY to 20 CNY, roughly 3 times.
    • Input side (cache hit): Increased from 1.1 CNY to 2 CNY, roughly 1.8 times, representing the mildest increase.

    More noteworthy is the change in the ratio between tiers. In the previous generation, the cache miss input price was about 6 times the cache hit price; in the new generation, this gap has widened to 10 times. The ratio of output to cache hit has expanded from about 25 times to 50 times. In other words, the vendor is deliberately widening the price gap between hitting and missing the cache. This isn’t an arbitrary pricing game but a clear signal: those who can efficiently utilize caching will receive substantial discounts.

    2. Why Cache Hit Rate Became the Core of Pricing

    To understand this pricing logic, we must return to the cost structure of inference systems. LLM inference is divided into two phases: Prefill and Decode. The Prefill phase requires attention computation over the entire input sequence, with computational complexity growing almost quadratically or linearly with context length (depending on optimization techniques), making it a compute-intensive process. The Decode phase, on the other hand, is memory bandwidth-bound.

    When multiple requests share the same prefix (e.g., fixed system prompts, tool definitions, few-shot examples), the inference engine can reuse the pre-computed KV cache for these prefixes, skipping redundant Prefill computations. The industry’s common disaggregated inference architecture (deploying Prefill and Decode on separate nodes with a global KV cache pool scheduler) is designed precisely for this. In scenarios with high prefix reuse, such as coding assistants and enterprise-grade agents, cache hit rates can exceed 90%.

    For vendors, cache hits mean lower marginal costs. For users, the 10x price difference between the hit and miss tiers means that the degree of prompt engineering reuse directly dictates the bill size. The pricing structure is essentially “directing traffic” to optimize the scheduling of the inference system.

    3. Building a Scenario-Based Cost Model

    While the sticker price is linear, the actual cost is scenario-dependent. Let’s run a quantitative analysis using two typical scenarios.

    Scenario A: Enterprise Coding Agent. Characteristics include ultra-long context, fixed system prompts, and high prefix reuse. Assuming an input-output ratio of 20:1 (common in coding agents where each request carries a massive amount of code context but the model outputs only minor modifications) and a 90% cache hit rate:

    • Effective input unit price ≈ 2 0.9 + 20 0.1 = 3.8 CNY/million tokens
    • Comprehensive cost ≈ (20 3.8 + 1 100) / 21 ≈ 8.4 CNY/million tokens

    Scenario B: Individual Developer. Occasional calls, different prompts every time, with almost no prefix reuse. Assuming a 20% cache hit rate and an input-output ratio of 5:1:

    • Effective input unit price ≈ 2 0.2 + 20 0.8 = 16.4 CNY/million tokens
    • Comprehensive cost ≈ (5 16.4 + 1 100) / 6 ≈ 30.3 CNY/million tokens

    For the same model at the same sticker price, the unit cost in Scenario A is only about one-third of that in Scenario B. This is the truth behind the “price hike”: for enterprise clients with high prefix reuse, this is a structural discount; for low-reuse, scattered calls, it is the true original price or even a premium.

    You can use a simple piece of code to perform a sensitivity analysis on your own business:

    1. def effective_cost(input_output_ratio, hit_rate,
    2. in_miss=20, in_hit=2, out=100):
    3. in_price = in_hit * hit_rate + in_miss * (1 - hit_rate)
    4. return (input_output_ratio * in_price + out) / (input_output_ratio + 1)
    5. # Scan comprehensive costs at different hit rates
    6. for hit in [0.2, 0.5, 0.8, 0.9, 0.95]:
    7. print(f"Hit rate {hit:.0%}: {effective_cost(20, hit):.1f} CNY/million tokens")

    4. Engineering Strategies to Improve Cache Hit Rate

    Since the hit rate directly equates to the discount rate, the optimization directions are clear:

    1. Fix the prefix, front-load static content. Place system prompts, tool schemas, and examples at the very beginning of the prompt, and place changing user inputs and conversation history at the end. Caching matches by prefix; any change in front-loaded content invalidates all subsequent caches.
    2. Avoid high-entropy fields in the prefix. Timestamps, random IDs, and dynamically concatenated text instantly zero out the hit rate if placed in the prefix. Dynamic information should be pushed back or injected into user messages.
    3. Session persistence and batch scheduling. Route continuous requests from the same session to the same inference endpoint. Initiate batch tasks together to reduce the probability of KV cache eviction due to timeouts.
    4. Control the proportion of output tokens. The output tier is the most expensive (100 CNY). Compressing output through structured output constraints, limiting max generation length, or having the model plan before generating is often more immediately effective than optimizing input.
    5. Establish cost observability. Feed the number of hit tokens, missed tokens, and output tokens per call into your monitoring and alerting system. Calculate unit costs by business line to detect cache hit rate degradation promptly.

    5. Advice for Model Selection

    Faced with the new pricing, it is not recommended to simply compare raw sticker prices horizontally. The correct evaluation path is to first gather your business’s input-output ratio and historical cache hit rate, plug them into the model above to calculate the effective unit price, and then compare with alternative solutions. For teams planning to run agent-type workloads long-term on cloud platforms, you can also leverage general cloud capabilities such as container platform auto-scaling and log service trace analysis to build a complete closed loop from call metering to cost attribution.

    In conclusion, this round of price adjustments is less a “price hike” and more an explicit manifestation of cost signals: the watershed for inference cost lies not in the model itself, but in your prompt architecture and invocation patterns. Understanding the pricing structure and using engineering practices to fully capitalize on cache dividends is the key to extracting cost-effectiveness from the new generation of models.