The Economics of Caching and Inference Costs Behind LLM Price Changes

    LLM pricing cannot be evaluated by comparing headline token rates alone. This article presents a practical cost model covering input, output, cache-hit rates, workload structure, inference architecture, and qualified-task cost, with examples showing why the same pricing change can produce very different bills. It also outlines engineering strategies for reducing real-world costs without sacrificing task quality.

    1. Use a Consistent Basis When Evaluating Price Changes

    When the prices of input tokens, output tokens, and cached tokens all change at the same time, asking whether “the price increased by several times” does not have a single straightforward answer. Different billing tiers may change by different amounts, and applications consume those tiers in very different proportions.

    A meaningful pricing analysis should distinguish at least three levels:

    1. Published price changes: how the listed price per million tokens changes.
    2. Workload changes: how input volume, output volume, and cache-hit volume vary in actual use.
    3. Business outcome changes: how many calls, retries, and human corrections are required to complete one qualified task.

    The following illustrative prices are used to demonstrate the calculation method. They are examples for cost modeling only and do not represent the current rates of any specific service.

    Billing item Baseline plan Revised plan Price multiple
    Cache-miss input CNY 6.5 per million tokens CNY 20 per million tokens Approximately 3.08×
    Cache-hit input CNY 1.1 per million tokens CNY 2 per million tokens Approximately 1.82×
    Output CNY 27 per million tokens CNY 100 per million tokens Approximately 3.70×

    These figures do not support describing all tiers as having “increased fivefold.” The output price is approximately 3.70 times the original price, equivalent to an increase of about 270%. The cache-miss input price is approximately 3.08 times higher, while the cache-hit input price rises much more moderately.

    If pricing information contains both “CNY 1 per million cached tokens” and “CNY 2 per million cached tokens,” the applicable billing plan must be identified first. The cache rate directly affects calculations for workloads with high reuse, so different cache prices must not be mixed within the same analysis.

    The calculations below consistently use the illustrative cache-hit input price of CNY 2 per million tokens.

    2. Build a Cost Model: Three Variables Matter More Than One Price

    Assume that a task generates:

    • (I): total input tokens;
    • (O): total output tokens;
    • (h): input-token cache-hit rate;
    • (P_u): cache-miss input price;
    • (P_c): cache-hit input price;
    • (P_o): output price.

    The cache-hit rate should be calculated by input-token volume, not by request count. If nine out of ten requests have partial cache hits, that does not mean that 90% of the input tokens were served from cache.

    Assuming that billing includes only input and output tokens and no additional fees, the total cost is:

    [
    C=\frac{I[(1-h)P_u+hP_c]+OP_o}{10^6}
    ]

    The effective input price is:

    [
    P_{\text{in}}=(1-h)P_u+hP_c
    ]

    Now define the input-to-output ratio:

    [
    r=\frac{I}{O}
    ]

    The weighted cost per million total tokens is then:

    [
    P{\text{avg}}=\frac{rP{\text{in}}+P_o}{r+1}
    ]

    This metric is useful for describing token-consumption patterns, but it is not a complete business metric. Two plans may have the same cost per million total tokens while producing very different delivery costs because of differences in output length and task-success rate.

    Actual billing may also include cache creation, cache retention, tool execution, or other charges. Whether those items apply depends on the billing rules of the service. Cache access should not automatically be assumed to be the only cache-related cost.

    3. Why the Same Published Prices Can Produce Very Different Bills

    3.1 High-input, high-reuse enterprise agent workloads

    Suppose a code-analysis task repeatedly reads a large amount of project context. Its input-to-output ratio is 20:1, and its token-based cache-hit rate is 90%.

    Using the illustrative prices from the revised plan:

    [
    P_{\text{in}}=20\times0.1+2\times0.9=3.8
    ]

    The cost per million total tokens is:

    [
    P_{\text{avg}}=\frac{20\times3.8+100}{21}\approx8.38\text{ CNY}
    ]

    If one task generates 200,000 input tokens and 10,000 output tokens, its cost is approximately:

    [
    C=0.2\times3.8+0.01\times100=1.76\text{ CNY}
    ]

    Although the cache-miss input price is CNY 20 per million tokens, a high cache-hit rate reduces the effective input price to CNY 3.8.

    However, “low output volume” does not mean that output costs are negligible. In this example, output costs CNY 1 and account for approximately 57% of the total bill. Even when input volume is much larger than output volume, output may still be the largest expense.

    3.2 Low-reuse, temporary workloads

    Now consider a workload with an input-to-output ratio of 5:1 and a cache-hit rate of 20%:

    [
    P_{\text{in}}=20\times0.8+2\times0.2=16.4
    ]

    The cost per million total tokens is approximately:

    [
    P_{\text{avg}}=\frac{5\times16.4+100}{6}\approx30.33\text{ CNY}
    ]

    If one task uses 50,000 input tokens and generates 10,000 output tokens, its cost is approximately:

    [
    C=0.05\times16.4+0.01\times100=1.82\text{ CNY}
    ]

    This task uses only one-quarter as many input tokens as the previous example, yet its total cost is slightly higher because cache reuse is limited.

    The unit cost per token differs by approximately 3.6 times between the two workloads. This does not mean that high-reuse users receive a special contractual discount. It means that the same billing rules produce different effective prices because the consumption structures are different.

    Enterprise status does not guarantee cache savings, and individual developers may achieve high hit rates through stable prefixes. The key factors are request structure and actual cache behavior.

    4. Caching Can Reduce the Impact of a Price Increase, but It Does Not Turn an Increase into a Discount

    A pricing analysis should compare the cost of the same workload under both pricing plans.

    For the workload with an input-to-output ratio of 20:1 and a 90% cache-hit rate, the effective input price under the baseline plan is:

    [
    6.5\times0.1+1.1\times0.9=1.64\text{ CNY}
    ]

    Its cost per million total tokens is approximately:

    [
    \frac{20\times1.64+27}{21}\approx2.85\text{ CNY}
    ]

    Under the revised plan, the cost is approximately CNY 8.38, or about 2.94 times higher.

    For the workload with an input-to-output ratio of 5:1 and a 20% cache-hit rate, the baseline effective input price is CNY 5.42, and the cost per million total tokens is approximately CNY 9.02. Under the revised plan, the cost is approximately CNY 30.33, or about 3.36 times higher.

    The more accurate conclusion is:

    Cache reuse can reduce absolute costs and soften the impact of a price increase. However, when all billing tiers become more expensive, the cost of the same workload will usually still rise.

    A high-reuse workload may be cheaper than a low-reuse workload, but that does not mean it has become cheaper than it was under the previous plan.

    5. Why Long Contexts Are Expensive: Separate Compute, Memory, and Scheduling Costs

    LLM inference can generally be divided into an input-processing phase and an autoregressive generation phase. These phases have different resource characteristics.

    5.1 Input processing

    The model processes the prompt and creates the internal state required for subsequent generation. Longer inputs generally require more compute resources.

    In a standard full-attention architecture, attention computation may grow approximately quadratically with sequence length. However, actual costs also depend on the model architecture, implementation, parallelization strategy, and hardware utilization. It is therefore inaccurate to assume that all long-context models have costs that grow strictly quadratically.

    Local attention, hybrid attention, and similar techniques can change this relationship, but the actual improvement must be supported by the architecture and benchmark results.

    5.2 Generation

    Autoregressive generation has strong sequential dependencies and is generally more difficult to parallelize as effectively as input processing.

    When generating each new token, the model may need to read model weights and historical key-value cache entries. As the context grows, cache bandwidth, memory consumption, and scheduling pressure may also increase. This provides a resource-based explanation for why output tokens may cost more than cache-hit input tokens.

    However, resource-consumption patterns alone cannot prove that a price is justified. Pricing may also reflect capacity reservations, research and development, service guarantees, and market strategy.

    5.3 Caches are not free storage

    A key-value cache stores attention states for previously processed tokens and avoids repeating the same computation. In a standard full-attention architecture, cache storage generally grows approximately linearly with sequence length. It is also affected by the number of layers, the number of key-value heads, head dimensions, and numerical precision.

    Caches introduce additional costs, including retention periods, eviction policies, cross-device transfers, and hit management. A lower cache-read price may reflect reduced repeated computation, but it does not mean that the service provider has no cache-related costs.

    Likewise, interface prices and model size alone cannot establish whether a previous plan was unprofitable. That conclusion would require evidence about throughput, hardware costs, utilization, service levels, and revenue structure.

    6. Sparse Architectures Do Not Automatically Make Inference Cheap

    Mixture-of-experts architectures select only a subset of experts for each token, reducing the amount of computation activated per token.

    Several factors should be separated when analyzing these systems:

    • Total parameter count: affects weight storage and deployment scale;
    • Activated parameter count: affects the compute burden for each token;
    • Expert placement: affects communication between devices;
    • Routing balance: affects overall throughput and tail latency.

    Even if only a small number of experts are activated for each token, a large amount of model weight may still need to reside across the accelerator cluster or be loaded and scheduled. Token dispatch across devices, result aggregation, and uneven expert utilization can all reduce the practical benefit of theoretical compute savings.

    Therefore, “the activation ratio is low, so the service should be cheap” is not a valid conclusion. Conversely, “the total parameter count is large, so a high price must be justified” is also insufficient.

    A more reliable analysis should focus on actual throughput, latency, resource utilization, and task quality rather than on parameter count alone.

    7. How Developers Can Reduce the Cost of Real Tasks

    7.1 Optimize stable prefixes instead of simply compressing prompts

    For services that support prefix caching, place stable system instructions, general policies, and long-lived background context at the beginning of the prompt. Put dynamic questions and fresh data afterward.

    Avoid unnecessary variations such as inserting a different timestamp or random identifier into every request, or changing document order without a reason. The exact cache-hit conditions depend on the service implementation and should be verified through cache metrics. Semantically similar content should not be assumed to produce a cache hit.

    Caching must also respect authorization and data-freshness requirements. User isolation, sensitive information, and knowledge updates are more important than maximizing the hit rate.

    7.2 Control output that provides no value

    For structured extraction, classification, and data-validation tasks, define the required fields, format, and explanation scope clearly. This helps avoid large amounts of repetitive explanation.

    Reducing output should not come at the expense of task quality. For example, key test steps and risk explanations in a code-repair task may be more valuable than the small amount of token usage they require.

    The goal is to reduce output with no business value, not to minimize all output indiscriminately.

    7.3 Remove irrelevant context and repeated calls

    Long-context capability does not mean that every request should include the entire conversation or document history. Relevant-fragment selection, historical summaries, duplicate removal, and tool-result trimming can reduce irrelevant input.

    For multi-step agents, set limits on loop iterations, define failure exit conditions, and establish a tool-call budget. These controls prevent low-value retries from continuously increasing costs.

    Historical summaries must preserve key facts, constraints, and source references. Otherwise, context compression may introduce errors that require additional retries and eliminate the expected savings.

    7.4 Route tasks by difficulty

    Lower-cost models can handle format conversion, simple extraction, and initial classification, while more expensive models are reserved for complex planning, multi-step reasoning, and high-risk decisions.

    Escalation should be triggered by observable signals, such as failed rule checks, unsuccessful tests, missing structured fields, or insufficient evidence. It should not rely solely on a model’s self-reported confidence.

    A tiered strategy should be evaluated on a representative task set to verify whether it actually improves quality, latency, and total cost.

    8. The Metric That Ultimately Matters: Cost per Qualified Task

    API token prices are useful for budget estimation, but they do not fully represent the economic value of a model.

    A more practical metric is:

    [
    C_{\text{qualified}}=
    \frac{\text{model invocation cost}+\text{tool and infrastructure cost}+\text{human review and correction cost}}
    {\text{number of qualified completed tasks}}
    ]

    If a more expensive plan substantially reduces retries and manual corrections, the cost per qualified task may decrease. If the task involves only simple classification or short-text extraction, and the model’s additional capabilities do not produce additional value, a price increase may simply raise expenses.

    For real workloads, teams should continuously track:

    • Input tokens, output tokens, and cache-hit tokens;
    • Cache-hit rate calculated by input-token volume;
    • Cumulative calls and cost per task;
    • End-to-end latency and high-percentile latency;
    • First-pass success rate, retry rate, and human correction time;
    • Qualification rate according to business requirements.

    Testing should also distinguish cold-cache and warm-cache conditions. Otherwise, prewarmed results may underestimate the cost of new tasks, while testing only the first call may ignore the long-term benefits of reuse.

    Overall, LLM pricing is not merely a question of how much output costs. Caching determines the marginal cost of repeated input, the input-output mix determines how the bill is distributed, inference architecture affects resource requirements, and task quality determines final business value. Only by including all of these factors in a unified model can teams determine whether a price increase is a cost change that engineering optimization can absorb or a signal that the application architecture needs to be redesigned.