LLM API Cache Hit Pricing: A Technical Breakdown of Discounted Cached Input Billing
This article explains a price reduction that applies only to cached input tokens in a large language model API, and why it matters for long-context applications. It breaks down the inference cost structure behind prompt caching, presents a cost formula showing how savings scale with the cached prefix length, and outlines engineering practices for raising cache hit rates: keeping prefixes stable, avoiding timestamps and random values in the prefix, controlling cache key granularity, tuning TTL and eviction, tracking observability metrics, and building fallback paths. It also lists common anti-patterns and an action checklist for measuring traffic, restructuring prompts, and running sensitivity analysis. The key takeaway is that the benefit depends on prompt engineering and cache governance rather than the unit price itself.
1. Background: A Price Cut That Only Touches Cached Input
A cloud provider’s model-as-a-service (MaaS) platform announced that, starting at 00:00 Beijing time on November 23, 2026, it would lower the price of a general-purpose LLM service deployed in a single region (Guiyang). The adjustment applies to one billing item only: cached input. That item is now priced at 20% of its original rate, while all other billing items stay unchanged.
The announcement is small in scope, but it is a signal worth unpacking carefully for teams building long-context applications: what got cheaper is not compute per se, but the price of repeated input.
Note that adjustments like this typically come with a specific region and effective time. They are a local pricing strategy, not a global or long-term price commitment. The right engineering move is to treat this as a window in which the cost structure has shifted, recalculate the cost per request, and avoid hard-coding it into your business model as a fixed assumption.
2. Why Discount Only Cached Input
To understand this change, start with the cost structure of LLM inference. Input-side cost for a request comes from two parts: the forward computation over the prompt to produce intermediate state, and the memory and bandwidth required to keep that state alive across a long context. When multiple requests share an identical prefix (the same system prompt, the same product manual, the same codebase context), the first part can be reused. That is exactly what prompt caching is built on.
So the billing model naturally splits into three tiers: uncached input, cached input, and output. A cache hit means the platform can reuse the already-computed prefix state, and the marginal compute cost drops sharply. Pricing the hit portion at 20% of the original rate is therefore internally consistent from a cost standpoint. Output pricing is untouched, which means the resource assumptions for the generation phase have not changed. Uncached input is untouched too, which means the real cost of computing a prefix for the first time still exists.
3. Cost Model: Do the Math on Your Bill
Let L be the number of input tokens in a request, H the length of the cached prefix, O the number of output tokens, P_in the unit price of uncached input, P_hit = 0.2 × P_in the unit price of cached input, and P_out the unit price of output. Then:
Cost = (L - H) * P_in + H * P_hit + O * P_out= L * P_in - 0.8 * H * P_in + O * P_out
The conclusion is straightforward: savings are proportional to H and to the 0.8 discount factor. When H/L approaches 1 (the typical long, fixed-prefix scenario), input-side cost can fall to roughly 20% of what it was. When H is 0, the bill does not change at all. This means the first optimization priority is not compressing the prompt, but increasing the share of a reusable prefix.
One easily overlooked point: a cache hit usually also reduces time to first token (TTFT), because the repeated prefix computation is skipped. The benefit of this adjustment is therefore twofold, cost and latency, and for interactive applications the perceived improvement is often more noticeable than the bill.
4. Engineering Practice: How to Raise the Hit Rate
4.1 Prioritize Prefix Stability
Cache reuse requires the prefix to be byte-for-byte identical. Split the prompt into a stable part and a dynamic part. Put system instructions, tool descriptions, domain knowledge, and few-shot examples in the stable part; put user input and retrieval results in the dynamic part. Always keep the stable part first.
[Stable prefix: system role + tool schema + domain manual + fixed examples][Semi-stable part: conversation summary (rolled forward at a fixed granularity)][Dynamic part: this round's retrieved snippets + user question]
4.2 Be Careful with Timestamps and Random Values
Injecting the current time, a request ID, or a randomly ordered candidate set into the stable prefix changes the prefix every round and drives the hit rate to zero. If the business genuinely needs time information, move it to the dynamic part, or quantize it to minute or hour granularity.
4.3 Control the Granularity and Number of Cache Keys
Caches are organized as prefix plus key. Too large a key space causes frequent eviction; too fine a key space lowers reuse. A practical approach is to divide keys along business dimensions (tenant, knowledge base version, tool set version) into a limited set, and to switch versions explicitly when the knowledge base updates rather than letting old caches expire naturally.
4.4 TTL and Eviction Policy
Set an explicit lifetime and capacity limit for the cache, and distinguish stable prefixes that are read often but written rarely from session prefixes that change frequently. For capacity planning, make a rough estimate using peak concurrency × prefix length × replica factor, then leave a safety margin.
4.5 Observability
Treat hit rate as a first-class metric and wire it into logging and alerting. At minimum, cover: share of cached tokens, cache creation count, eviction count, and the TTFT distribution.
metrics:- cache_hit_ratio # H / L, the core north-star metric- cache_write_count # prefix write/refresh frequency- cache_evict_count # eviction frequency; a spike signals capacity or key design issues- ttft_p50 / ttft_p99 # verify whether the latency benefit materializes
4.6 Fallback and Fault Tolerance
Caching is an optimization, not a correctness dependency. Implement a fallback path that reverts to full input when the cache is unavailable, and ensure both paths produce semantically identical output. Also build a rollback mechanism for prompt versions so a single prompt change does not cause a cliff in the hit rate.
5. Common Anti-Patterns
- Concatenating retrieval results at the very front, so the prefix changes every round;
- Embedding high-frequency variables such as usernames or session IDs in a long prefix;
- Focusing only on the unit-price discount without monitoring the hit rate, so the bill does not improve;
- Assuming the discount is permanent and hard-coding it into the financial model;
- Ignoring regional differences and applying the same cost assumptions outside the target region.
6. Action Checklist
- Sample one week of real traffic, measure the distributions of L, H, and O, and identify long-prefix workloads;
- Restructure prompts into layers, move stable content to the front, and version it;
- Build a dashboard for hit rate and TTFT, and alert when the hit rate falls below a threshold;
- Run a sensitivity analysis with the cost formula above to assess the combined effect of the discount factor and hit rate on the bill;
- Complete the fallback and rollback plan, then gradually expand cache key coverage.
In short, a price adjustment limited to cached input and to a single region is essentially making the cost of repeated computation explicit and passing part of it back. Whether you capture that benefit depends on how well prompt engineering and cache governance are executed, not on the unit price itself.
