Understanding LLM API Input Cache Hit Billing
This article breaks down how input cache hit billing works for large language model APIs, covering prefix caching mechanics, the factors that affect hit rates, peak and off-peak tiered pricing, and the risks of promotional versus permanent price changes. It also offers practical engineering guidance for keeping inference costs predictable.
1. Why Input Cache Hits Have Become a Core Billing Dimension
In large language model inference services, cost has long been dominated by two parts: the processing overhead on the input side and the decoding overhead on the output side. As application patterns shift from single-turn question answering toward long-document analysis, multi-turn agents, and repository-level code understanding, the context length carried by a single request has grown rapidly, and the input side now accounts for a larger share of the total bill. A series of API pricing and billing rule adjustments made by a cloud provider between late April and August 2026 centers on exactly this dimension: first, input cache hit prices were reduced across the entire API lineup; then the promotional period for a flagship model was extended; after the promotion ended, the model’s discounted price was made permanent, dropping to roughly one quarter of the original launch price. After that, peak and off-peak tiered pricing was introduced, and in the second half of the year the billing rules were adjusted so that all day on Saturdays and Sundays is settled at off-peak rates.
For developers, the direction of these changes is clear: input-side billing is no longer a simple model of “one unit price multiplied by token count.” Instead, it is a three-dimensional structure determined jointly by cache hit status, time-of-day tier, and model tier. Understanding this structure is a prerequisite for making the right architectural choices and cost budgets.
2. How Input Cache Hits Work Technically
2.1 The Basic Mechanism of Prefix Caching
Mainstream inference services commonly use a prefix caching mechanism: when multiple requests share exactly the same context prefix, the server can reuse the already computed intermediate state and avoid recomputing that portion. The cached portion is billed at a price significantly lower than the regular input price, while the uncached portion is billed at the regular input price.
It is worth emphasizing that hit detection usually requires the prefix to match byte for byte. This means a single extra space in the system prompt, the insertion point of a timestamp, or a change in the order of examples can all invalidate the cache.
2.2 Three Factors That Affect Hit Rate
- Prefix stability: context placed earlier is more likely to be reused, so stable content should go first.
- Request arrival interval: cache entries typically have an expiration time, and long gaps without similar requests will lower the hit rate.
- Concurrency and routing: in multi-instance deployments, a request routed to an instance that does not hold the cache will appear as a miss.
2.3 An Example of the Billing Calculation
The following pseudocode shows a typical billing split logic. It is only meant to illustrate the calculation and does not represent the interface of any specific platform:
def estimate_cost(tokens_in, tokens_out, cached_ratio,input_price, cache_hit_price, output_price,is_peak=True, peak_factor=1.0):cached = int(tokens_in * cached_ratio)uncached = tokens_in - cachedinput_cost = (cached * cache_hit_price +uncached * input_price) * (peak_factor if is_peak else 1.0)return input_cost + tokens_out * output_price
3. Peak and Off-Peak Tiered Pricing and Weekend Off-Peak Billing
The essence of peak and off-peak pricing is mapping the server’s compute supply curve onto a price curve: supply is tight during business peak hours, so prices rise; resources sit idle during off-peak hours, so prices fall. Tiered pricing goes further by introducing usage brackets, where higher usage unlocks a better unit price tier. Settling all day on weekends at off-peak prices is an adaptation to the real load distribution of concentrated weekday office work and lower weekend load.
There are two practical implications. First, deferrable batch jobs should be scheduled for off-peak hours and weekends wherever possible. Second, the cost model must include a time dimension; a static unit-price estimate will deviate significantly from the real bill.
4. The Difference and Risk Between Promotional and Permanent Prices
Promotional prices and permanent prices are fundamentally different in a budget model. A promotional price has a clear end date, and if it does not convert to a permanent price once it expires, costs rise in a step change. In the timeline from the original text, a model’s discount period was first pushed to the end of May, then converted to a permanent adjustment at the end of May, with the final price at about one quarter of the initial price. This “extend first, then make permanent” path is not uncommon in the industry.
Therefore, architecture reviews should set up “price expiration reminders” and keep two sets of estimates in capacity planning, one for the promotional price and one for the regular price, to avoid a distorted budget.
5. Engineering Practice Recommendations
- Layer the context: place system instructions, domain knowledge, and tool definitions at the very front and keep them stable, and put user input and dynamic data at the end.
- Put dynamic content last: do not concatenate timestamps, random IDs, or session numbers into the prefix.
- Make hits observable: record the input tokens, cache-hit tokens, and cost for each request on the application side to form a verifiable billing breakdown.
- Shift tasks off-peak: schedule offline evaluation, batch summarization, and log analysis jobs to off-peak hours and weekends.
- Use cache-friendly batching: group requests that share the same prefix and submit them together to increase the reuse probability.
- Set alerts and budgets: set threshold alerts for both daily cost and cache hit rate; a sudden drop in hit rate often means the prefix was changed unexpectedly.
6. Common Misconceptions
- Assuming that “a cache hit is always cheaper” while ignoring the regular pricing of the uncached portion, which leads to a biased total estimate.
- Continuously rewriting the history summary in multi-turn conversations, causing the prefix to change repeatedly and the hit rate to stay near zero over time.
- Optimizing only the unit price without optimizing the total token volume, overlooking the larger gains from context trimming.
- Writing a promotional price into a long-term contract or financial model without a plan for switching when it expires.
7. Conclusion
Input cache hit billing, peak and off-peak tiered pricing, and weekend off-peak rules together form the basic framework for LLM API cost governance today. As long as developers hold on to four main threads, stable prefixes, off-peak scheduling, observable hits, and a price contingency plan, they can keep inference costs within a predictable range while maintaining quality.
