How Cached Input Pricing Changes LLM Inference Costs

    Cached input pricing can significantly reduce the cost of long-context and repeated LLM workloads, but the actual savings depend on cache hit rate, input-to-output token ratios, and request design. This article explains the pricing model, how prefix caching works, how to estimate per-request costs, and how to improve cache reuse without compromising correctness, security, or maintainability.

    How Cached Input Pricing Changes LLM Inference Costs

    Recently, some cloud providers announced pricing changes in specific regions: the price of “cached input” for model-as-a-service (MaaS) workloads was reduced to 20% of the standard input price, while other billing items remained unchanged.

    For developers, this is more than a change in pricing. It is a reason to reconsider the structure of inference costs:

    • Which parts of an input can be reused consistently?
    • Which changes can prevent a cache hit?
    • How does cache hit rate affect the cost per request?
    • How can engineering teams improve reuse without sacrificing correctness?

    This article presents a practical framework covering pricing abstraction, caching principles, cost modeling, and engineering governance.

    1. Turn the Pricing Change into a Cost Model

    Model inference services typically charge by token, with input and output tokens as the two primary categories. Some platforms further divide input tokens into cached and uncached input tokens. Cached input is discounted because the service can reuse computation from an existing context.

    Under the pricing change discussed here:

    • Cached input is charged at 20% of the standard input price.
    • Uncached input pricing remains unchanged.
    • Output pricing remains unchanged.

    The cost of a single request can therefore be represented as:

    1. Cost = uncached input tokens × input price
    2. + cached input tokens × input price × discount factor
    3. + output tokens × output price

    When the discount factor is 0.2, cached input costs one-fifth of the standard input price.

    However, this does not mean that total request cost automatically falls by 80%. If output tokens account for a large share of the bill, or if the cache hit rate is low, the overall reduction will be much smaller than the nominal input discount.

    A useful metric is the effective input price:

    1. Effective input price = input price × [(1 - hit rate) + hit rate × discount factor]

    For example, with a 60% cache hit rate and a discount factor of 0.2:

    1. (1 - 0.6) + 0.6 × 0.2 = 0.4 + 0.12 = 0.52

    The effective input price is therefore approximately 52% of the standard price. The higher the hit rate, the greater the savings on the input side. The final benefit must still be evaluated together with the proportion of output tokens.

    2. Why Cache Hits Reduce Costs

    Cached input pricing is generally based on context reuse. During autoregressive inference, the model generates substantial intermediate computation results for the input context, including key-value cache data. If a later request shares a sufficiently consistent prefix with an existing context, the platform may reuse part of that computation under its caching policy. This reduces repeated computation and allows the cached portion to be billed at a lower rate.

    Commonly reusable input components include:

    1. Fixed system prompts: role definitions, output formats, safety constraints, and tool instructions that remain stable over time.
    2. Multi-turn conversation history: earlier context that is repeated across requests in the same session.
    3. Retrieval-augmented generation templates: fixed retrieval instructions, document-processing rules, and citation formats.
    4. AI agent tool definitions: tool lists, parameter specifications, and invocation constraints that change infrequently.
    5. Batch-processing templates: shared instructions and formatting requirements used across offline tasks.

    A cache hit is not guaranteed simply because some text is repeated. In most cases, the prefix must remain stable, the ordering must be consistent, and the content must match. Cache lifetime, tenant isolation, and platform-specific policies may also affect reuse.

    For example, placing timestamps, random IDs, user names, or real-time inventory information at the beginning of a prompt can prevent a longer fixed section that follows from forming a stable prefix. This can reduce the cache hit rate.

    3. Workloads That Benefit Most

    Cached input discounts are most valuable for workloads with long, repeated prefixes and a high request volume. Typical examples include:

    • Long-context, multi-turn conversations: system instructions and earlier dialogue can be reused while each new turn adds only incremental content.
    • Retrieval-augmented generation: retrieval templates, instructions, and formatting constraints remain fixed while the retrieved documents change.
    • AI agent orchestration: tool definitions and workflow constraints are long but relatively stable.
    • Batch content processing: many requests share the same classification rules, extraction fields, or output format.
    • Code assistance and structured extraction: coding guidelines, schema definitions, and examples can be placed in a stable prefix.

    The benefit is more limited when each request is highly random, dynamic content accounts for most input tokens, or output tokens greatly exceed input tokens. In those cases, teams should also focus on general optimization techniques such as controlling output length, defining appropriate stop conditions, combining batch requests, caching results, and routing requests across models.

    4. Estimate Costs with Code

    The following platform-independent example compares request costs with and without a cached-input discount. The prices are variables for demonstration only and do not represent any specific provider’s rates.

    1. def request_cost(
    2. input_tokens: int,
    3. cached_input_tokens: int,
    4. output_tokens: int,
    5. input_price_per_million: float,
    6. output_price_per_million: float,
    7. cached_discount: float = 0.2,
    8. ):
    9. """
    10. Generic cost estimation:
    11. - input_tokens is the total number of input tokens
    12. - cached_input_tokens is the number of input tokens served from cache
    13. - cached_discount is the cached input price as a fraction of the standard price
    14. """
    15. if cached_input_tokens > input_tokens:
    16. raise ValueError("cached_input_tokens cannot exceed input_tokens")
    17. uncached = input_tokens - cached_input_tokens
    18. input_cost = (
    19. uncached * input_price_per_million
    20. + cached_input_tokens * input_price_per_million * cached_discount
    21. ) / 1_000_000
    22. output_cost = output_tokens * output_price_per_million / 1_000_000
    23. return input_cost + output_cost
    24. def compare(input_tokens, cached_tokens, output_tokens, in_price, out_price):
    25. no_discount = request_cost(
    26. input_tokens, 0, output_tokens, in_price, out_price, cached_discount=1.0
    27. )
    28. with_discount = request_cost(
    29. input_tokens, cached_tokens, output_tokens, in_price, out_price, cached_discount=0.2
    30. )
    31. saving = 1 - with_discount / no_discount if no_discount else 0
    32. return {
    33. "cost_without_cached-input discount": round(no_discount, 6),
    34. "cost_with_cached-input discount": round(with_discount, 6),
    35. "cost reduction": f"{saving:.2%}",
    36. }
    37. # Example: 100,000 input tokens, 60,000 cached tokens, and 10,000 output tokens
    38. print(compare(100_000, 60_000, 10_000, in_price=1.0, out_price=1.0))

    The value of this model is that it converts a pricing change into measurable operational metrics:

    • Total input tokens
    • Cached input tokens
    • Output tokens
    • Input and output prices
    • Cost per request
    • Cost reduction

    Teams can use these values to build dashboards for individual requests, sessions, or every thousand calls instead of evaluating the impact based only on the headline price change.

    5. Engineering Practices for Improving Cache Hit Rates

    5.1 Keep Stable Content at the Front

    Place system prompts, output formats, tool descriptions, and retrieval rules at the beginning of the input. Keep their wording and ordering consistent. Put timestamps, random IDs, user inputs, and other dynamic variables later in the prompt.

    This structure makes it easier to form a reusable prefix.

    5.2 Version Prompts

    Frequent changes to a system prompt can reduce reuse stability. Prompt templates should therefore be version-controlled. When a prompt changes, release it gradually and monitor cache hit rate, correctness, and cost together.

    A prompt should not be left unchanged indefinitely just to maximize cache hits if it has clear quality problems.

    5.3 Enforce Session and Tenant Isolation

    Cache reuse must respect the platform’s isolation mechanisms and the application’s security policies. Sensitive information, personal data, and cross-tenant content should not be designed as reusable shared prefixes.

    Applications should also avoid placing sensitive dynamic data inside shared templates.

    5.4 Layer the Context

    Context can be divided into four layers:

    1. Globally stable context
    2. Task-stable context
    3. Session-dynamic context
    4. Request-dynamic context

    The first two layers are good candidates for reuse. The latter two can be appended as needed. This structure makes it easier to optimize caching and trim excessively long contexts.

    5.5 Monitor Hit Rate and Effective Cost

    At a minimum, teams should monitor:

    • The percentage of input tokens served from cache
    • The percentage of uncached input tokens
    • The percentage of output tokens
    • Cost per request
    • Cost per thousand sessions
    • The relationship between prompt versions and cache hit rates
    • Cache expiration and invalidation reasons

    A high cache hit rate combined with declining accuracy may indicate context contamination or an inappropriate reuse strategy. In that case, the system should be able to roll back the optimization.

    6. Risks and Governance Boundaries

    Cached input pricing is a cost optimization mechanism, not a guarantee of correctness. Four categories of risk deserve particular attention:

    1. Consistency risk: expired or incorrectly reused context may cause the model to process information that is no longer applicable.
    2. Isolation risk: shared prefixes must remain within data security and tenant-isolation boundaries.
    3. Misjudged savings: when output tokens account for a large portion of total usage, the overall cost reduction may be limited.
    4. Over-optimization: making prompts harder to read or maintain simply to increase cache hits can reduce system quality.

    From a governance perspective, cost metrics should be evaluated alongside quality metrics, including accuracy, human review rate, timeout rate, retry rate, and cost per task.

    High-value tasks may require stricter isolation and shorter cache lifetimes. Lower-risk batch workloads may support a higher degree of reuse.

    After a pricing change, teams should run a new benchmark using realistic traffic patterns. The actual benefit should be estimated from the workload’s input-output structure and observed hit rate rather than calculated through a simple linear extrapolation from the nominal discount.

    7. Conclusion

    Reducing cached input pricing to 20% of the standard rate creates a financial incentive to improve context reuse. The key variables are not just the unit price, but also:

    • Cache hit rate
    • The structure of input and output tokens
    • Task-specific quality and safety constraints

    Stable prefixes, dynamic content placement, prompt versioning, context layering, and cost monitoring can provide more consistent inference cost savings for long-context conversations, retrieval-augmented generation, batch processing, and AI agent workloads.

    At the same time, teams must preserve tenant isolation, context consistency, security, and correctness. Maximizing cache hits should never come at the expense of system reliability.