Prompt Caching Pricing for LLM Services: A Practical Guide to Cache Hit Rate Optimization
This guide breaks down a recent MaaS pricing change that cuts input costs for cached prompt hits to 20% of the original price. It explains how prompt caching works, provides a cost model for estimating savings at different hit rates, identifies which workloads benefit most, and outlines engineering practices for improving cache hit rates. Developers will find a step-by-step checklist for measuring baseline hit rates, restructuring prompts, and monitoring cost impact.
1. Background: The Technical Signal Behind a Pricing Change
A cloud provider recently announced that, effective 00:00 Beijing time on November 23, 2026, it will lower service prices for specific model versions in specific regions on its Model-as-a-Service (MaaS) platform. The change reduces the input price for the cache-hit portion to 20% of the original price, while all other billing items remain unchanged.
The announcement is short, but the information density is high. It is worth unpacking layer by layer:
- Limited scope: The change applies to a single region and a single model version, indicating that billing strategies are moving toward fine-grained, region- and version-specific operations.
- One item only: Only the cache-hit input price is reduced. Output prices and cache-miss input prices are unchanged, showing that pricing is beginning to distinguish between the real compute cost of “repeated computation” and “first-time computation.”
- Significant magnitude: Reducing the hit portion to 20% means that, under highly repetitive workloads, input-side costs can drop by an order of magnitude.
For consumers of these services, the real questions are not “how much cheaper is it?” but rather: Can my workload reliably hit the cache? How much will the bill drop once the hit rate improves?
2. How It Works: What Prompt Caching Actually Caches
The core of input-side computation in LLM inference is attention computation over the token sequence and the generation of intermediate states (commonly known as the KV cache in the industry). Without caching, every request must perform a full forward pass over the entire prompt. This overhead is roughly linear in the input length, and a large share of requests share highly repetitive prefixes.
The general idea of prompt caching is: use the prompt prefix as a key and reuse the already-computed intermediate states, computing only the incremental portion. This produces two key constraints:
- The prefix must match byte for byte: System prompts, tool definitions, few-shot examples, and long document backgrounds—any character change at any point invalidates everything after that position.
- Hits are time-sensitive: Cache entries typically have an expiration time. Prefixes that go unused for a long period are evicted, and cold-start requests are still billed as misses.
Therefore, a cache hit is not a switch you flip; it is a workload characteristic that must be designed for.
3. Cost Model: Breaking the Bill into Optimizable Variables
Let the total input tokens be $T$, the hit rate be $h$, the original input price be $P{in}$, the hit discount be $d$ (here $d=0.2$), the output price be $P{out}$, and the output tokens be $T_{out}$. The cost per call is approximately:
Cost = T * P_in * (1 - h * (1 - d)) + T_out * P_out
Substituting $d=0.2$:
Cost = T * P_in * (1 - 0.8h) + T_out * P_out
The conclusions are straightforward:
- At $h=0$, the cost is identical to before the change.
- At $h=0.5$, input-side cost drops by 40%.
- At $h=0.9$, input-side cost drops by 72%.
- Output-side cost is unaffected in all cases.
This explains why “long input, short output, high repetition” workloads are the biggest beneficiaries, while “short input, long output, low repetition” workloads see almost no difference.
4. Workload Fit: Which Use Cases Are Naturally High-Hit
| Workload | Input Characteristics | Expected Hit Rate | Optimization Priority |
|---|---|---|---|
| Enterprise knowledge base Q&A | Long system prompt + fixed document background | High | High |
| Coding assistant | Fixed tool definitions + repository context | High | High |
| Batch document extraction | Same instruction template + different body text | Medium-high | Medium |
| Multi-turn customer service | Stable persona and policy prefix | Medium-high | Medium |
| Open-ended content generation | High variance per input | Low | Low |
The assessment method is simple: measure the proportion of shared prefix length across real production requests. If the first 1K tokens are identical across most requests, the workload is worth optimizing.
5. Engineering Practices: Five Ways to Reliably Improve Hit Rate
5.1 Prefix Normalization
Place stable content first and dynamic content last. A counter-example is putting timestamps or request IDs at the beginning of the system prompt.
[Stable] Role definition + output spec + tool schema + few-shot[Semi-stable] Knowledge base snippets[Dynamic] Current-turn user input
5.2 Template Versioning
Bring prompts under version control and roll out changes gradually. A casual “fix a punctuation mark” can reset the overall hit rate to zero.
5.3 Session Stickiness
Route multi-turn conversations to the same cache domain whenever possible. Avoid load balancers scattering the same session across different nodes.
5.4 Warm-up and Keep-alive
Send lightweight requests on a schedule for high-frequency prefixes to prevent idle eviction from causing periodic cold starts.
5.5 Observability Loop
Treat hit rate as a first-class metric and wire it into logging and alerting:
# Pseudocode: instrument the call site to track hits and costrecord = {"model": model_name,"region": region,"input_tokens": usage.prompt_tokens,"cached_tokens": usage.get("cached_tokens", 0),"output_tokens": usage.completion_tokens,}hit_rate = record["cached_tokens"] / max(record["input_tokens"], 1)metrics.emit("llm.cache.hit_rate", hit_rate)metrics.emit("llm.cost.estimate", estimate_cost(record, price_table))
5.6 Semantic Caching Supplement
For requests that are phrased differently but share the same intent, add a semantic cache layer at the application level to reuse historical results directly. Set a similarity threshold and an invalidation policy to avoid stale answers.
6. Common Pitfalls
- Assuming a hit is free: A hit is a discount, not free. It is still billed at the discounted price.
- Assuming it works automatically end to end: Most implementations require explicit enablement and prefix consistency.
- Putting dynamic fields first: This is the number-one reason hit rates stay low.
- Ignoring regional and version differences: Pricing and capabilities may be adjusted separately by region and by version. Refer to the console bill and the official billing documentation.
- Optimizing input while ignoring output: When output accounts for a large share, the absolute gain from input-side optimization is limited.
7. Implementation Checklist
- Sample one week of real traffic and measure the distribution of shared prefix lengths and the current baseline hit rate.
- Use the formula above to estimate the cost range at different hit rates and set a target (e.g., 70%).
- Restructure prompts into layers, moving dynamic content to the end.
- Establish prompt version control and a gradual rollout process.
- Wire up three monitoring metrics—hit rate, cached token count, and estimated cost—and configure alerts.
- After the billing change takes effect, review the bill to verify the optimization gains.
8. Conclusion
The real value of this pricing change is that it elevates “cache hit rate” from an engineering detail to a quantifiable cost metric. For developers, rather than waiting for the next price cut, the better move is to get prompt structure, session routing, and monitoring solid first. The initiative in cost optimization always lives in architecture design, not in the price list.
