Understanding LLM API Cache Hit Pricing: How Prompt Caching Cuts Input Costs to 20%
This article breaks down a cloud provider's price adjustment that reduces cached input tokens to 20% of the original rate while leaving other billing items unchanged. It explains how prompt caching works at the prefill stage, why token hit rate becomes a core cost variable, and how to model input cost with a simple formula. You will find a practical optimization checklist covering prefix layering, stable retrieval ordering, append-only conversation history, batch scheduling, observability, and quality regression, plus guidance on regional rollout, canary validation, and common pitfalls to avoid.
1. Background: A Price Cut on a Single Billing Item
A cloud provider announced that its Model-as-a-Service (MaaS) platform will lower LLM service prices in a specific region starting November 23, 2026, 00:00 (Beijing time). The adjustment applies only to the “cached input” billing item, which is set to 20% of its original price. All other billing items remain unchanged.
The significance here is not the price cut itself, but the fact that only one item changed. The platform is further splitting the cost structure on the input side: input that hits the cache is priced separately and significantly below input that misses. For developers, the bill is no longer determined by “input length + output length” alone, but by “input length × hit rate × discount.” Understanding this is the prerequisite for all subsequent optimization work.
2. How Prompt Caching Works: What Is Actually Cached
LLM inference has two stages: the prefill stage processes the entire input in parallel and generates the key-value cache required for attention; the decode stage generates output token by token. Prefill compute grows roughly linearly with input length, and both time-to-first-token latency and compute overhead in long-context scenarios originate mainly here.
The core insight of prompt caching is that if the input prefix of two requests is exactly identical, the key-value state of that prefix can be reused without recomputation. In practice, the prefix usually must match token by token, and matching happens at block granularity. As a result, a hit is rarely all-or-nothing; it is typically a ratio derived from the longest common prefix.
This leads to three practical conclusions:
- The more stable the prefix, the higher the hit rate. Placing volatile content such as timestamps, random IDs, or user nicknames at the front prevents everything after it from matching.
- Content order is cost structure. Putting long, unchanged background first and variable parts last is a zero-cost structural optimization.
- Hits are time-sensitive. Cache entries expire or get evicted according to platform policy, so “hit once” does not mean “always hit.”
An illustrative stabilization rewrite:
# Bad example: volatile fields first, so the prefix changes every turnprompt_bad = f"Current time {now()}, user {user_id} asks: {question}\n" + LONG_SYSTEM_DOC# Good example: long, static content first, volatile content lastprompt_good = LONG_SYSTEM_DOC + f"\n[User question] {question}\n[Request ID] {trace_id}"
3. Billing Model: Putting Hit Rate into the Cost Formula
Under pricing where cached input is discounted and everything else stays the same, the input cost of a single request can be abstracted as:
cost_input = tokens_total × [ hit_rate × p_hit + (1 - hit_rate) × p_miss ]where p_hit = 0.2 × p_miss (per this adjustment)
Simplifying gives cost_input = tokens_total × p_miss × (1 - 0.8 × hit_rate). This shows two things: first, every 10 percentage point increase in hit rate reduces input cost by about 8%; second, when the hit rate is very low, the benefit of the price cut is nearly zero. In other words, the benefit of this adjustment is not universal but correlates with engineering capability—without cache-friendly design, the bill barely changes.
Note that the exact billing item names, discount basis, effective regions, and cache lifetime are subject to the official documentation. This article does not assume any undisclosed parameters.
4. Cost Optimization Checklist
- Prefix layering: keep system instructions, domain knowledge, tool descriptions, and a few examples as a stable prefix; place retrieval results, conversation history, and user input at the tail.
- Stabilize retrieval ordering: in retrieval-augmented generation, if the order of returned documents shifts each time, prefix consistency breaks. Sort by a stable key before concatenation.
- Append conversation history rather than rewrite it: in multi-turn conversations, keep history text appended as-is and avoid summarizing or rewriting old content, otherwise the history portion cannot hit.
- Batching and concurrency scheduling: submit batch offline jobs together so requests with the same prefix are close in time, reducing the chance of cache eviction.
- Build observability: bring cached token counts, hit rate, and cache invalidation reasons into logging and alerting, with dashboards by business line, model, and template.
- Quality regression: pair any prompt restructuring with an evaluation set to confirm that lower cost does not come at the expense of quality.
Core metrics for a hit rate dashboard:- Average share of cached tokens- Hit rate distribution by template (to locate the worst template)- P95 time to first token (to verify caching actually reduces latency)- Cost per valid answer = total cost / number of requests passing evaluation
5. Migration and Validation: Region, Canary, and Regression
Price adjustments usually apply to specific regions, which implies two actions. First, cost accounting should be split by region to avoid estimating other regions’ budgets using a low-price region’s unit price. Second, if the business allows, latency-insensitive offline batch traffic can be scheduled to the discounted region while keeping online interactive traffic in the nearest region, balancing cost and experience.
A canary rollout is recommended: start with 5%–10% of traffic to validate hit rate and quality metrics, observe for at least one full business cycle (including month-end and promotional peaks), then ramp up gradually. Keep prompt version management and a rollback switch so you can quickly revert to the old template if something goes wrong.
6. Common Pitfalls
- Assuming “a price cut automatically saves money”: the benefit depends entirely on hit rate, and without monitoring you cannot prove optimization works.
- Sacrificing personalization for hits: forcing user-specific information into the stable prefix both lowers the hit rate and creates data cross-use risk; isolate by session.
- Ignoring output-side cost: output prices were not adjusted here, so long-output scenarios should optimize both output length and structure.
- Treating the cache as persistent storage: caching is a performance and cost optimization mechanism and must not hold business state requiring strong consistency.
7. Conclusion
An adjustment like “cached input drops to 20% of the original price” essentially hands the initiative for cost optimization to the application layer. What truly determines the bill is prompt structure, call scheduling, and observability. Developers are advised to use the billing formula in this article as a baseline, first establish metrics for hit rate and cost per valid answer, then proceed through the four steps of layering, stable ordering, append-only history, and canary migration to turn the price benefit into a sustainable cost advantage.
