LLM Inference Billing Explained: How Cache Hit Pricing Cuts Input Token Costs
This article explains a pricing structure change in which a model-as-a-service (MaaS) platform reduced the price of cache-hit input tokens to 20% of the original rate for a single model in one region, while keeping other billing items unchanged. It breaks down why cached input is billed separately, how prefix caching works during the prefill and decode stages, and the engineering constraints that determine hit rates, including exact longest-prefix matching, token-block granularity, cache invalidation, and TTL. It also provides a cost model showing that savings depend only on the number of hit input tokens, a practical checklist for cache-friendly prompt design, and common mistakes to avoid. The key takeaway is that inference billing is shifting toward fine-grained pricing of computation reuse, so developers should treat cache friendliness as an architectural constraint rather than an afterthought.
1. The Event in Abstract: A Typical Inference Billing Adjustment
A cloud provider announced that, starting at 00:00 Beijing time on November 23, 2026, it would reduce the price of “cache-hit input” for a specific model service on its model-as-a-service (MaaS) platform in the Guiyang region to 20% of the original price. All other billing items remain unchanged. There is roughly a one-month window between the announcement date and the effective date.
Setting aside the specific brand and model, this announcement contains only three engineering facts: billing dimensions are being further subdivided, input tokens that hit the cache are priced separately, and the discount applies to only one region and one billing item. Understanding these three points is more valuable than memorizing the size of a single price cut, because the subdivision of billing dimensions is an industry trend, while specific discounts can change at any time.
2. Why “Cache-Hit Input” Is Billed Separately
The input stage of large model inference (prefill) requires running all prompt tokens through a forward pass to generate the corresponding KV (Key/Value) cache. The output stage (decode) then uses these caches to generate tokens autoregressively, one at a time. The key fact here is that prefill computation is roughly linear in input length, while every decode step must read the entire historical KV cache.
This creates an obvious optimization opportunity: if multiple requests share the same prefix (system prompts, tool definitions, few-shot examples, long documents), the KV cache for that prefix can be reused without recomputation. This is the capability commonly known in the industry as prefix caching / context caching.
Since reuse delivers real compute savings, pricing the “hit” portion separately from the “miss” portion is a natural choice. Reducing the price to 20% of the original is essentially using a price signal to encourage developers to place reusable content at the front.
3. Engineering Constraints on Hit Determination (Which Decide How Much You Save)
Prefix caching is not fuzzy matching; it is strict longest common prefix matching. This introduces several hard constraints:
- Order sensitivity: The prefix must be byte-for-byte identical and located at the very front of the request.
- Minimum granularity: A hit typically occurs at the token-block level (for example, 16 or 64 tokens per block). The trailing portion that does not fill a full block does not receive the discount.
- Invalidation is all-or-nothing: If any character in the prefix changes, nothing after it can hit the cache.
- Limited lifetime: Cache entries have a TTL and are subject to capacity-based eviction. After a long idle period, the cache must be warmed up again.
An illustrative request orchestration example:
# Bad example: a timestamp makes the prefix different every time, so the cache never hitsbad_prompt = f"Current time {datetime.now()}, you are an assistant. User question: {q}"# Good example: put volatile content at the end; keep stable content at the front and fixed verbatimSYSTEM = "You are an enterprise knowledge base assistant. Answers must cite source IDs." # Constant, managed centrallyprompt = f"{SYSTEM}\n\n[Retrieved snippets]\n{retrieved}\n\n[User question]\n{q}"
4. Cost Model: Turning the Discount into Actionable Numbers
Let the miss input unit price be P, the cache-hit input unit price be 0.2P, and the output unit price be Q. For a single request with L input tokens, of which H tokens hit, and O output tokens:
Cost = (L - H) * P + H * 0.2P + O * Q= L * P - 0.8 * H * P + O * Q
The implication is straightforward: savings are proportional only to the number of hit tokens H and are independent of output length. Therefore, scenarios with long inputs and short outputs (document Q&A, code base understanding, batch classification) benefit the most, while scenarios with short inputs and long outputs (long-form writing) are barely affected.
In engineering practice, you should build a “scenario—hit rate—savings ratio” reference table and measure it with real traffic replays rather than relying on intuition.
5. Implementation Checklist
- Prompt layering: Stable layer (role, specifications, tool schema) → semi-stable layer (knowledge snippets) → volatile layer (user input, timestamps), concatenated strictly in order.
- Centralized template management: Put system prompts under version control to avoid prefix drift caused by different people copying them into separate branches.
- Batch and concurrency orchestration: Send requests with the same template as close together as possible to reduce repeated warm-ups caused by TTL expiration.
- Observability: Instrument your monitoring and alerting system to track the proportion of hit tokens, the cache hit rate, and the cost per call, and use a log service for long-term trend analysis.
- Capacity and fallback: When the cache is unavailable, automatically fall back to the full-computation path, prioritizing functional correctness over cost.
- Region differences: The discount may apply only in a specific region. For multi-region deployments, calculate costs separately by region and dynamically switch routing weights through a configuration center.
6. Common Misconceptions
- Assuming the bill drops proportionally with the price cut: The discount covers only the hit portion. If the hit rate is zero, the bill stays the same.
- Inserting dynamic variables at the very front of the prompt: A single timestamp can invalidate the entire prefix.
- Writing sensitive data into a reusable prefix: Cache reuse means sharing across requests, so you must evaluate data isolation and compliance boundaries.
- Ignoring output-side costs: When output tokens dominate, the optimization focus should shift to controlling output length and streaming truncation strategies.
7. Conclusion
The real signal from this price adjustment is not “it got cheaper,” but that inference billing is moving from a coarse input/output split toward fine-grained pricing of computation reuse behavior. For developers, the right response is to treat cache friendliness as an architectural constraint rather than an afterthought: fix the prefix, control the position of volatile content, and build a closed loop for observing hit rates. Do these three things, and the cost per effective token will keep falling regardless of how the specific discount changes.
