Understanding Input Cache Misses in Large Model APIs

    This article explains what an input cache miss (Cache Miss) means in large model API billing, why it is billed separately from cache hits, and how it is determined by prefix matching, cache expiration, and server-side eviction. It covers how hit and miss tokens combine in multi-turn cost structures, how peak and off-peak pricing can affect miss rates, and practical ways to reduce miss costs through stable prefixes, prefix drift control, context trimming, and scheduling. The goal is to help developers build predictable token-level cost control.

    1. Why “Input Cache Miss” Deserves Its Own Explanation

    In the context of usage-based billing for large model APIs, cost is no longer a simple two-part structure of “input tokens + output tokens.” As context reuse has become common, the input side has been split into two parallel billing items: input cache hits and input cache misses (often called “regular input” in the industry).

    An input cache miss, commonly written as Cache Miss in English, refers to the portion of tokens in a request that cannot reuse an existing context KV cache and must undergo a full prefill computation. In contrast, a cache hit means the server has already loaded the same prefix into the context cache, so no repeated prefill is needed, and those tokens are billed at a lower discounted rate.

    For developers and enterprise users, the significance of understanding misses is that they are the “most expensive and least compressible” part of input cost. Every point of improvement in hit rate is essentially converting miss tokens into hit tokens.

    2. Definition and Technical Meaning

    2.1 Conditions for a Miss

    Whether a request’s input hits the cache is usually determined by the server through prefix matching. Common miss conditions fall into three categories:

    • The prefix did not exist before: the token sequence (or its prefix) has never been loaded by the server and is appearing for the first time.
    • The cache exceeded its lifetime: cache entries have a lifecycle and expire after a timeout, requiring a new prefill.
    • The cache was evicted by the server: due to capacity and scheduling pressure, the server reclaims cache space according to policy, making a previously reusable prefix unavailable.

    2.2 Why Hits and Misses Coexist

    In a single request, hits and misses usually exist at the same time: the stable prefix portion is billed as a hit, while the newly added suffix portion is billed as a miss, and the two together make up the full input cost of the request. The following logic can help illustrate this:

    1. Input cost ≈ hit tokens × hit price + miss tokens × standard input price
    2. Total request cost = input-side cost + output tokens × output price

    Illustrative pseudocode (expressing only the billing split idea, not any specific API):

    1. def estimate_cost(prompt_tokens, cached_prefix_tokens, out_tokens,
    2. price_hit, price_miss, price_out):
    3. miss_tokens = prompt_tokens - cached_prefix_tokens
    4. input_cost = cached_prefix_tokens * price_hit + miss_tokens * price_miss
    5. return input_cost + out_tokens * price_out

    2.3 Cost Structure in Multi-Turn Conversations

    Multi-turn conversations are the scenario where the value of the miss mechanism is most obvious. The system caches historical context, and subsequent turns only charge full price for the “newly added” portion, significantly reducing the cumulative cost of long conversations. Conversely, if every turn causes a miss due to prefix changes, the cost of a long conversation will grow roughly linearly with the number of turns.

    3. Billing Details: Peak and Off-Peak Pricing and Miss Unit Price

    Finer billing granularity is an industry trend: after the input side is split into hits and misses, some platforms further introduce peak and off-peak pricing, so the miss input unit price for the same model differs across time periods.

    According to public information, a cloud vendor advanced in this direction in 2026: in April it announced the billing method for a new generation of Pro-tier model APIs, in June it announced the introduction of peak and off-peak billing, and in August it adopted peak and off-peak pricing with the launch of the full series of official versions and put it into effect; from late August, Saturdays and Sundays no longer distinguish peak from off-peak and are uniformly charged at the off-peak standard, while workday peak and idle periods are also delineated; from mid-September, Flash-class lightweight models also enabled peak and off-peak billing. During the same period, another cloud platform directly listed an “input (cache miss)” item in its model billing details and distinguished idle from busy periods.

    The direct implication for users is that the unit price of miss tokens is no longer a constant, but a function of “model tier × time period × hit or not.” Cost estimation must introduce a time dimension.

    4. Engineering Practice: Systematically Reducing Miss Costs

    4.1 Prioritize Stable Prefixes

    Placing unchanging content at the very front of the prompt is the most effective way to improve hit rate. System prompts, tool definitions, output format constraints, and a few examples (few-shot) should be concentrated in the prefix area, and volatile fields such as timestamps, random IDs, and request sequence numbers should be avoided.

    1. [Stable prefix] System role + tool schema + output spec + fixed examples
    2. [Semi-stable area] Conversation summary (appended per turn)
    3. [Volatile suffix] Current turn's user input

    4.2 Control Prefix Drift

    Prefix drift is the most common hidden source of misses. Common causes include: unstable order of dynamically concatenated context, changes in serialized field order, and variable metadata embedded in templates. It is recommended to normalize the prefix (fix field order, remove whitespace differences) and monitor hit rate changes during the canary phase.

    4.3 Context Trimming and Summarization

    Long history does not equal high value. Sliding windows, relevance-based retrieval, and summary compression of early conversations can shorten the miss length. Note that summaries change the prefix and should be rewritten uniformly at “turn boundaries” to avoid rewriting every turn, which would keep invalidating the cache.

    4.4 Call Orchestration and Batching

    • Aggregate highly similar requests to increase the probability of prefix reuse;
    • Avoid unnecessary model or parameter switching, since a tier change usually means the cache cannot be reused;
    • Schedule deferrable tasks to off-peak periods as much as possible to take advantage of time-based price differences;
    • Control concurrency peaks to reduce the probability of the server evicting caches due to capacity pressure.

    4.5 Observability and Cost Accounting

    It is recommended to use general-purpose logging services and monitoring and alerting capabilities to record, by business line, each call’s total input tokens, hit tokens, miss tokens, output tokens, time period label, and estimated cost, forming a drill-down cost dashboard. Core metrics include: cache hit rate, average miss length, input cost per request, and off-peak period share.

    5. Common Misconceptions

    • Misconception 1: Believing that input is not billed after a cache hit. A hit only means a lower unit price; it is still billed.
    • Misconception 2: Believing that identical content will always hit. Validity periods and eviction policies can cause the same prefix to reappear on the miss side.
    • Misconception 3: Treating a miss as an anomaly. It is the normal state of first requests and new content; the optimization goal is the ratio, not zero.
    • Misconception 4: Ignoring the time factor. Under peak and off-peak pricing, the same miss tokens cost differently in different periods.

    6. Summary

    An input cache miss is the incompressible base cost item on the input side, determined jointly by prefix absence, cache expiration, and server-side eviction; it is billed alongside the hit item and may be affected by peak and off-peak unit prices. In engineering, hit rate should be improved through stable prefixes, suppressing prefix drift, context trimming, and reasonable scheduling, and general-purpose logging and monitoring capabilities should be used to establish token-level cost accounting, thereby achieving predictable and sustainable cost control in long conversations and high-concurrency scenarios.