Decoding LLM API Price Hikes: The Cost Logic Behind Input, Output, and Caching

    This article breaks down why a new-generation LLM API price increase does not translate directly into a multiplied bill. It explains the three-part pricing vector of uncached input, cached input, and output, and shows how the real cost per token is determined by two workload variables: the input-to-output ratio and the prefix cache hit rate. With quantitative comparisons across three workload types, a look at the inference-side cost structure, and practical cost-control patterns for the agent era, developers can learn how to plan capacity and keep budgets under control.

    1. The Trigger: A Pricing Update That Looks Like an Across-the-Board Increase

    After a model service released its next-generation version, its billing rates rose noticeably: the output price is roughly four times that of the previous generation, uncached input is about three times higher, and cached input increased more modestly. Looking at the list prices alone, the conclusion seems obvious: the same workload will cost several times more.

    In real production environments, however, that conclusion often does not hold. The reason is that LLM billing is not a single price but a three-dimensional price vector made up of uncached input, cached input, and output. Looking at only one of these dimensions leads to a seriously distorted judgment.

    Start by abstracting the price structure:

    • P_in_miss: unit price of uncached input
    • P_in_hit: unit price of cached input
    • P_out: unit price of output

    The key change in the new pricing is not just higher absolute values, but a wider spread between the ratios:

    • The ratio of uncached to cached input widened from about 6x to about 10x.
    • The ratio of output to cached input widened from about 25x to about 50x.

    These ratios are the key to understanding the price increase. The provider has shifted the center of gravity in its pricing from cheap cache hits to expensive output and cold-start input. In essence, it is using price signals to shape the form of the workload.

    2. The Cost Model: Real Unit Price Depends on Two Variables

    The actual cost of any single call can be written as:

    1. effective_cost = (I * (h * P_in_hit + (1 - h) * P_in_miss) + O * P_out) / (I + O)

    Here, I is the number of input tokens, O is the number of output tokens, and h is the prefix cache hit rate. Let the input-to-output ratio be r = I / O, then:

    1. effective_cost = (r * (h * P_in_hit + (1 - h) * P_in_miss) + P_out) / (r + 1)

    This equation shows that the bill is determined not by list prices but by the two workload characteristics (r, h). With the same model and the same list prices, the real unit cost can differ by several times depending on the workload.

    3. Quantifying Three Workload Types

    Using an illustrative scale of output 100, uncached input 20, and cached input 2 (in CNY per million tokens):

    Scenario A: Enterprise long-context agent. Input-to-output ratio of about 20:1, with heavy prefix reuse and a hit rate of about 90%.

    1. effective input price = 2*0.9 + 20*0.1 = 3.8
    2. blended price = (20*3.8 + 100) / 21 ≈ 8.4

    Scenario B: Occasional individual developer. Every prompt is different, with a hit rate of about 20% and an input-to-output ratio of about 5:1.

    1. effective input price = 2*0.2 + 20*0.8 = 16.4
    2. blended price = (5*16.4 + 100) / 6 ≈ 30.3

    Scenario C: Short conversational application. Input-to-output ratio close to 1:1, with a moderate hit rate (about 50%).

    1. effective input price = 2*0.5 + 20*0.5 = 11
    2. blended price = (11 + 100) / 2 ≈ 55.5

    The comparison is revealing: A’s unit cost is about 1/3.6 of B’s, while C is the most expensive because output makes up a large share. There is a whole layer of workload engineering between a “4x price increase” and actually paying 4x more.

    4. Why Providers Can Price This Way: The Real Cost Structure of Inference

    From an engineering perspective, this adjustment is not simply a price hike. It brings prices closer to the resource consumption curve:

    1. KV Cache memory usage grows linearly with context length. Long-context requests occupy memory for extended periods, reducing the number of requests that can run concurrently.
    2. Prefix reuse creates an amortization effect. A reused prefix only needs to be computed once, and the marginal cost of a cache hit is extremely low, so the low price is sustainable.
    3. Memory bandwidth during decoding is the main bottleneck. In the output stage, generating each token requires reading all weights and the KV Cache, making it inherently more expensive than the input stage.
    4. Disaggregated inference architecture (splitting prefill and decode across separate resource pools) can push the cache hit rate very high, which is the prerequisite for the low hit price.

    Therefore, widening the gap between cached and uncached input to 10x effectively turns cache reuse from an optimization into an economic necessity.

    5. The Agent Era: A Step Change in Cost Sensitivity

    In the chat era, a single interaction involved only tens to a few thousand tokens, so price fluctuations were barely noticeable. The agent era is completely different: a single task may involve thousands of tool-calling steps, consume hundreds of thousands of tokens cumulatively, or even run hundreds of agents in parallel continuously for days.

    Under such workloads, the input-to-output ratio is often extremely high (long contexts are fed back repeatedly), and cost is determined almost entirely by the input-side unit price and hit rate. Planning capacity with the old mental model of a “low output price” can easily lead to budget overruns. Practical measures include:

    • Stable prefixes: fix system prompts, tool definitions, and specification documents as an invariant prefix to maximize hits.
    • Context compression: summarize historical traces and feed them back via retrieval instead of replaying everything.
    • Structured output constraints: use schema constraints to reduce invalid generation and directly lower O.
    • Tiered model routing: send simple steps to smaller models and escalate to stronger ones only for complex reasoning.
    • Observability: attribute bills along the (r, h) dimensions with monitoring, alerting, and logging services instead of only looking at the total.

    6. Conclusion

    On the surface, this pricing adjustment is an across-the-board increase. In substance, it is a redistribution of the price structure: discounts for large-scale workloads with frequently reused prefixes, and list prices or even premiums retained for random, cold-start calls. The takeaway for developers is clear. Now that agents and long contexts are becoming mainstream, the cache hit rate and input-to-output ratio are as important as the choice of model. Cost engineering must be moved forward into the architecture design phase rather than handled by cutting budgets after the fact.