How Prompt Caching Cuts MaaS Input Costs, and How to Raise Cache Hit Rates
A cloud vendor cut the price of cache-hit input tokens on a mainstream large language model to 20% of the previous rate while leaving other prices unchanged. This article explains LLM token billing, why KV-cache reuse makes that discount possible, and practical ways to structure prompts, multi-turn history, cache lifetime, and observability so applications hit the cache more often.
A cloud vendor recently adjusted pricing for a mainstream large language model deployed in specific regions on its model-as-a-service (MaaS) platform: the price of cache-hit input tokens was reduced to 20% of the previous rate, while other prices stayed the same. What looks like a routine commercial discount also reflects how inference optimization for large language models has matured and spread. For developers and enterprises, understanding the technical logic behind this pricing—and adjusting application architecture accordingly—is now central to controlling LLM costs. This article examines billing principles, prompt caching, and enterprise cost-optimization practice.
1. Inference cost bottlenecks and how MaaS billing has evolved
Compute cost remains a core constraint as generative AI applications move into production. MaaS platforms typically bill by token count, split into input tokens and output tokens. Because large language models generate output autoregressively, token by token, output is more compute-intensive and is usually priced higher than input.
As use cases grow more complex, input-token consumption rises sharply. In retrieval-augmented generation (RAG), retrieved long documents are concatenated into the prompt. In multi-turn chat, the system keeps carrying conversation history. Those long inputs are reprocessed on every request, consuming substantial compute and pushing application cost up.
To break that bottleneck, the industry has introduced optimizations based on reusing the KV cache and has begun to reflect them in MaaS pricing. Cutting the price of cache-hit input to 20% of the original rate is a typical commercial expression of that trend, and it gives developers substantial room to optimize on the input side.
2. How prompt caching works
Understanding why a cache hit can justify such a large discount starts with the two stages of LLM inference:
- Prefill. The model receives the prompt, computes the key and value matrices for each token, and builds the KV cache. This stage involves heavy matrix multiplication. It is compute-bound, and both latency and compute cost are significant.
- Decode. Using the KV cache already produced, the model predicts the next token one at a time. Each step processes a single token and is memory-bandwidth bound.
In a traditional inference path, even when two requests share an identical prompt prefix, the model recomputes the KV cache for that prefix on every request. That wastes a large amount of compute.
The core of prompt caching is this: if the prefix of a request—or the entire prompt—matches a previous request, the system can load the corresponding KV cache from cache, skip the expensive prefill for that portion, and either enter decode or continue prefill from a specific position. Reusing the KV cache sharply reduces GPU compute, so a MaaS platform can offer that portion of input tokens at a much lower price, such as 20% of the original rate.
3. Application architecture: how to maximize cache hit rate
Because cache hits produce such a clear cost advantage, raising the cache hit rate should be a core design concern when building LLM applications. Several practices matter.
3.1 Put static content first and structure the prompt
A cache hit requires an identical prefix. Fixed text should sit at the front of the prompt: the system prompt, role instructions, and few-shot examples. Dynamic content—the user’s live question, documents retrieved for RAG—should come at the end.
An optimized request looks like this:
{"model": "large-language-model-v1","messages": [{"role": "system","content": "You are a professional data analysis assistant. Answer strictly from the provided context. If the context does not contain the answer, reply 'unknown'.\n\n[Context knowledge-base rules]\n1. Rule A...\n2. Rule B...\n\n[Examples]\nQ: Example question 1\nA: Example answer 1"},{"role": "user","content": "Answer from the latest retrieved content: [dynamic retrieved content]... My question is: [user's dynamic question]"}],"stream": true}
In this structure, the system content is highly stable and is easy to cache. The user message contains dynamic text, but because the prefix is fixed, the system can still reuse the KV cache for the leading portion.
3.2 Manage multi-turn history so the prefix stays stable
In multi-turn chat, history accumulates as turns increase. Appending each new turn at the end keeps the prefix consistent, so the cache can hit. If application logic dynamically trims history—deleting a middle turn, or inserting a summary at the beginning—it breaks prefix identity and the cache misses.
A practical approach is a sliding window that keeps the most recent N turns of raw dialogue, and an independent summary of history outside that window, stored in a fixed template after the system prompt. Dynamic truncation then does not destroy the cacheable front of the prompt.
3.3 Watch cache lifetime and warm the cache
KV cache usually lives in GPU memory or high-speed memory, both scarce resources. MaaS platforms typically set a time to live (TTL), ranging from minutes to hours. If no request hits that cache within the TTL, the resource is released.
For high-frequency applications, a scheduled job can send a lightweight probe near the TTL boundary, or the cache can be warmed before a user session starts, so it stays alive. At the architecture level, requests that share the same prefix should be routed to the same inference node when possible. That scheduling is usually done inside the MaaS platform, but developers can cooperate by controlling request frequency in a sensible way.
4. Cost visibility and optimization with cloud-native capabilities
Optimizing prompts in code is not enough. Enterprises also need a full system for observing and controlling cost. LLM applications should not sit in isolation; they should be tied into general cloud-native services.
- Logging and alerting. Log token usage on every model call, and separate total input tokens from cache-hit input tokens. Set thresholds so that an abnormal drop in cache hit rate, or a sudden rise in cost per request, triggers an alert. That helps developers see whether a code change broke the prompt structure.
- Traffic control and container platforms. Use a container platform for elastic scaling at the application layer. At peak, control concurrency against the MaaS platform so rate limits do not cause costly retries. Off peak, run batch jobs to raise overall resource utilization.
5. Conclusion
A large cut in the price of cache-hit input on a MaaS platform is not only a commercial concession. It is also a sign that LLM inference infrastructure is maturing. For developers and enterprises, the change is more than a smaller bill. It implies a different way to design systems. By understanding how the KV cache works, building prompts in a consistent structure, and combining that with cloud-native observability, organizations can keep control of cost as AI applications scale, and move generative AI toward a sustainable commercial loop.
