LLM API Price Cuts: A Practical Guide to Prompt Caching and Hit-Rate Billing

    This article breaks down what a cache-hit pricing announcement signals for developers, then explains the general mechanics of prompt caching, a quantifiable cost model that splits input tokens into cached and uncached categories, the factors that drive hit rate, and a four-step rollout plan with risk controls. Readers will learn how prefix matching determines reuse, how to estimate input-side savings from a given hit rate, and why hit rate, uncached volume, and cached volume should be treated as first-class, attributable cost metrics.

    1. What a Single Pricing Announcement Actually Signals

    A cloud provider published a notice stating that, effective at a certain point in time, it would adjust the billing structure for one large model service in one region within its Model-as-a-Service (MaaS) offering: the cached-hit portion of input would be billed at 20% of the original unit price, while all other items stayed unchanged. The announcement is short, but dense with information, and worth unpacking layer by layer.

    The first layer is finer billing granularity. We have grown used to treating the input side as a single whole, billed by total input volume multiplied by a unit price. This change explicitly splits input into cache-hit and cache-miss categories, which means prompt reuse has formally become a first-class citizen in the billing model rather than merely an engineering optimization.

    The second layer is the direction of the price signal. Dropping the hit portion to 20% means the provider wants workloads such as long prompts, fixed system instructions, and batches of similar requests to be actively reshaped into high-hit forms. For consumers, this is a window in which billing rules drive architectural adjustment.

    The third layer is scope. The change covers a single service in a single region, with everything else unchanged. That is a reminder not to hardcode a cost model: region, service version, and billing item all need to be configuration, otherwise one localized price change will distort the budget model.

    Note that this article does not evaluate any specific vendor’s products, nor does it recommend any third-party service. We treat such announcements only as industry signals and abstract from them the general technical problems and engineering practices.

    2. General Mechanics: How Prompt Caching Works

    During the prefill stage of LLM inference, key-value caches must be computed for all input, and this cost scales strongly with input length. The core idea of prompt caching is that if the prefix of the current request is identical to that of a previous request, the already-computed intermediate state can be reused and the repeated computation skipped.

    In engineering practice this usually follows a prefix-matching rule: segments are compared from the beginning of the prompt, and the longest common prefix is reusable. One direct consequence: any dynamic content inserted at the front removes reuse opportunities for everything after it.

    1. Request A: [system instruction][tool definitions][example library][user question A]
    2. Request B: [system instruction][tool definitions][example library][user question B]
    3. Longest common prefix = [system instruction][tool definitions][example library] -> reusable

    Conversely, if a timestamp or random identifier is placed first, there is no hit even when the body is identical.

    1. Request A: [timestamp t1][system instruction][user question]
    2. Request B: [timestamp t2][system instruction][user question]
    3. Longest common prefix ~ 0 -> not reusable

    3. The Billing Model Once Input Is Split in Two

    The abstracted cost formula can be written as:

    1. cost = cached input volume x cached unit price
    2. + uncached input volume x uncached unit price
    3. + output volume x output unit price

    Let the cached unit price be 20% of the uncached unit price, the hit rate be h, and total input be T. Input-side cost becomes:

    1. input cost = T x uncached unit price x (1 - 0.8h)

    This yields a very useful conclusion: raising the hit rate from 0% to 100% cuts input-side cost by roughly 80%, and every 10 percentage points of hit rate reduces input-side cost by about 8%. Whether a change is worth making depends on comparing the engineering investment against those savings.

    Illustrative calculation:

    1. def input_cost(total_tokens, miss_price, hit_ratio, hit_discount=0.2):
    2. hit = total_tokens * hit_ratio
    3. miss = total_tokens - hit
    4. return hit * miss_price * hit_discount + miss * miss_price
    5. for h in (0.0, 0.3, 0.6, 0.9):
    6. print(h, round(input_cost(1_000_000, 1.0, h), 2))

    4. What Drives Hit Rate, and an Optimization Checklist

    • Prefix stability: keep system instructions, tool definitions, and few-shot examples grouped at the very front and stable; avoid regenerating them on every request.
    • Push dynamic content to the end: session identifiers, retrieval results, and user input all belong at the tail of the prompt.
    • Version governance: put prompt templates under version control, treat any change as a cache invalidation, and evaluate release cadence accordingly.
    • Batch aggregation: merge similar requests into batches to increase reuse count for the same prefix.
    • Lifecycle management: watch cache lifetime and eviction policy; for sparse traffic, evaluate cold-start losses.
    • Observability: bring cached volume, uncached volume, and hit rate in as first-class metrics wired into monitoring, alerting, and logging, forming a cost dashboard per business line.

    5. Rollout Steps and Risk Controls

    Step one, collect a baseline. Without changing the business, measure the input structure, average prompt length, and current hit rate for each business line.

    Step two, reorder prompts. Sort content by stability, move invariant content forward and dynamic content backward, then verify output consistency with offline replay after the change.

    Step three, validate with a canary. Release to a small traffic share and compare hit rate, latency, and output quality to confirm the template adjustment introduced no quality regression.

    Step four, attribute cost. Allocate the savings across business lines to produce an auditable cost report, avoiding the situation where the overall bill drops while an individual business line rises.

    Three risk controls matter. First, never write sensitive information into a reusable prefix, to avoid residual information leaking across requests. Second, caching behavior is a platform implementation detail, so business logic must not depend on it taking effect. Third, price changes vary by region and version, so the budget system must retain configurability.

    6. Conclusion

    A price change that cuts cached input to 20% is essentially using a price lever to push callers toward better prompt structure. What developers really need to master is the general principle of prefix reuse, a quantifiable cost formula, and an observability system for hit rate. Baidu AI Cloud and general industry practice both show that only when cost metrics are made monitorable and attributable engineering objects can teams respond quickly to billing rule changes and obtain stable, reproducible optimization gains.