How to Calculate the True Cost of LLM Cache Billing and Subscription Plans
When evaluating Large Language Model (LLM) service pricing, the most common pitfall is comparing only the "cache input unit price." This article breaks down a unified cost model that factors in cache hit rates, standard input tokens, and output tokens. It explores how varying cache hit rates and peak hour policies can shift cost rankings, examines why actual cache hit rates often fall short of expectations, and provides practical engineering strategies and modeling scenarios—conservative, baseline, and optimistic—to help developers accurately assess and reduce API and subscription costs.
When evaluating Large Language Model (LLM) service pricing, the most common pitfall is comparing only the “cache input unit price.” For example, one service might charge 0.115 per million tokens for cached input, while another offers a promotional rate as low as 0.05 per million tokens. Based on these numbers alone, the former appears more than twice as expensive. However, the actual cost of an API call is not determined solely by the cached input price; it also depends on the cache hit rate, the proportion of standard input, the proportion of output tokens, and whether a subscription plan is used.
A more rational approach is to break down a complete API call into three components: cached input tokens (cache hits), standard input tokens (cache misses), and generated output tokens. Only by converting all three into the same token scale can you derive a meaningful actual cost.
1. Build a Unified Cost Model
Assume the total token volume per call is N, the cache hit rate is r, the standard input proportion is a, and the output proportion is b. The breakdown is as follows:
- Cached input tokens: N × r;
- Standard input tokens: N × a;
- Output tokens: N × b;
- These proportions must satisfy: r + a + b = 100%.
If the cached input price is Pc, the standard input price is Pi, and the output price is Po (all priced per million tokens), the total cost can be expressed as:
Cost = N ÷ 1,000,000 × (r × Pc + a × Pi + b × Po)
The key here is not the formula itself, but understanding that different prices correspond to different token types. Many developers multiply the cache price by the total token volume, ignoring cache misses and output tokens, ultimately underestimating their actual expenditure.
For easier comparison, calculations are typically done per 100 million tokens. Since 100 million tokens equals 100 “million tokens,” the formula becomes:
Cost per 100 million tokens = 100 × (Cache ratio × Cache price + Standard input ratio × Standard input price + Output ratio × Output price)
This method applies to various scenarios, including code completion, intelligent Q&A, agentic programming, document summarization, and batch content processing.
2. At High Cache Hit Rates, Lower Cache Prices Win
Assume two services have cache prices of 0.115 and 0.05 per million tokens, respectively. To illustrate the point, consider an ideal call structure:
- Cache hit tokens: 98%;
- Standard input tokens: 1.5%;
- Output tokens: 0.5%.
In this scenario, the vast majority of tokens come from cached input, making the cache price the decisive factor. After applying the respective standard input and output prices, the estimated cost per 100 million tokens is:
- Service A: ~12.57;
- Service B: ~9.40.
The result shows that Service B is about 3.17 cheaper, representing a 25% reduction. This demonstrates that at very high cache hit rates, the difference in cache prices is amplified. This is especially true for development tools involving repeated context, project file indexing, system prompts, and conversation history—stably reusing these will make cached tokens dominate the call volume.
However, note that this conclusion relies on a 98% hit rate. It is more applicable to stable workloads with high context repetition and may not hold true for all applications.
3. As Cache Rates Drop, Cost Rankings Can Reverse
Now consider a scenario closer to standard business operations. Suppose the cache hit rate drops to 95%, with standard input and output increasing accordingly:
- Cache hit tokens: 95%;
- Standard input tokens: 3.5%;
- Output tokens: 1.5%.
Under the same billing metrics, the estimated cost per 100 million tokens might change to:
- Service A: ~14.92;
- Service B: ~18.25.
At this point, the service with the higher cache price actually becomes cheaper. The reason is that the cost structure is no longer driven by cache price alone. As the cache rate drops, the proportion of standard input and output increases, and the price differences for these two token types can be much larger than the cache price difference.
This is one of the most important conclusions in cost evaluation: you cannot compare single-item prices in isolation from the complete token structure.
A lower cache price does not guarantee a lower total cost; similarly, a higher cache price does not necessarily mean the overall calls will be expensive. The final result depends on the combined effects of:
- Cache hit rate stability;
- Missed input (standard input) pricing;
- Output token pricing;
- Output length per request;
- Context change frequency;
- The presence of peak hours, promotional periods, or call limits.
4. Why Actual Cache Hit Rates Are Often Lower Than Expected
Theoretical cache rates tend to be optimistic, but actual operations are affected by multiple factors.
1. Prefix Content Changes
Many caching mechanisms rely on input prefix consistency. If system prompts, tool definitions, project directories, user IDs, or timestamps are placed at the beginning and change frequently, subsequent content cannot be reused. In engineering implementations, stable content should be placed at the front, and dynamic parameters at the back. For example, fixed role settings, rule descriptions, and tool definitions should remain unchanged, while user questions, current time, and temporary states should be placed later in the prompt.
2. Growing Context Windows
Long conversations do not mean all historical content will consistently hit the cache. As messages are appended, the prefix structure may change. If the application frequently compresses, rearranges, or truncates history messages, caching effectiveness will also decline.
3. Multi-User Request Diversity
Continuous conversations from a single user usually have good prefix repetition. However, when many users access the service simultaneously, their contexts differ significantly, meaning the overall cache rate may be noticeably lower than single-user test results.
4. Dynamic Content from Tool Calls
Agentic tasks frequently incorporate search results, file contents, execution logs, and intermediate reasoning states. These contents change rapidly and are often lengthy, typically representing low-reuse tokens. Even if the system prompt has a high cache rate, the overall hit rate can be dragged down by dynamic content.
5. Subscription Plans Are Not Just Fixed Token Discounts
In addition to pay-as-you-go billing, some intelligent coding services offer monthly subscription plans. Suppose there are three tiers:
- Basic: 118/month;
- Pro: 538/month;
- Advanced: 1078/month.
Assuming off-peak hours and a 98% cache hit rate, the weekly token allowance for the three tiers might be approximately:
- Basic: 317 million tokens;
- Pro: 1.9 billion tokens;
- Advanced: 4.43 billion tokens.
If converted at standard API prices, the corresponding monthly value would be approximately:
- Basic: 160;
- Pro: 955;
- Advanced: 2229.
Nominally, the plan fees represent about 50% to 70% of the corresponding API value. This means that for users with stable call volumes and high usage frequencies, subscription plans may offer significant advantages.
However, plan value cannot be judged solely by the “theoretical token quota.” You must also examine usage limits:
- Are quotas reduced or concurrent connections limited during peak hours?
- Is the quota shared across different models?
- Are there weekly, daily, or per-request limits?
- Can you continue pay-as-you-go calls after exceeding the quota?
- Does the quota roll over across billing cycles?
- Is the quota calculated by input, output, or combined tokens?
If a user only utilizes a small number of tokens per week, even if the plan’s converted unit price is very low, it may not be cost-effective due to wasted quota.
6. Peak Hours Significantly Impact Actual Value
Different services define peak hours differently. Some might designate weekdays from 14:00 to 18:00 as peak hours (about 20 hours per week), while others might cover longer periods.
This is particularly important for developers. Individual users often use tools at night or on weekends; if their primary usage falls outside peak hours, the actual availability of the plan’s quota might be high. Conversely, enterprise teams typically concentrate usage during weekday daytime. Even if the monthly quota is large, it may be constrained by peak hour throttling.
Therefore, before choosing a plan, you should audit your usage patterns. Track your data for one to two weeks, capturing at least the following metrics:
- Requests per hour;
- Input tokens per hour;
- Output tokens per hour;
- Cache hit rate;
- Request failures or queue times;
- The ratio of peak to off-peak hours.
Only by combining billing costs with time availability can you determine whether a plan is truly cost-effective.
7. Use Three Scenarios for Cost Accounting
To reduce miscalculations, you can establish three separate models.
Conservative Model
Calculate the cache rate at 90% to 95% and appropriately increase the output proportion to evaluate costs in worst-case scenarios. This is suitable for enterprise budgeting and long-term project planning.
Baseline Model
Use real statistical data from the past one to two weeks, such as a 96% cache rate, 2.5% standard input, and 1.5% output. This model is best suited for daily procurement and plan selection.
Optimistic Model
Calculate the cache rate at 98% or higher, applicable to code completion or templated tasks with highly fixed contexts. However, it should not be used directly as a basis for annual budgets.
Using these three models, you can derive a cost range rather than a single number. For example, a solution might cost 12 per 100 million tokens in the optimistic model, but rise to 18 or more in the conservative model. For teams with monthly call volumes reaching billions of tokens, this difference scales up to hundreds or thousands in additional costs.
8. Engineering Strategies to Reduce Real Costs
Reducing costs shouldn’t rely solely on switching services; it can also start with request design.
First, reduce invalid context. Do not include complete project files, entire chat histories, and repetitive instructions in every request. Use summaries, indexing, and on-demand loading to control input size.
Second, fix the prompt structure. Place stable content at the front and minimize frequent changes to system prompts and tool definitions to help increase the cache hit rate.
Third, control output length. For tasks like code modifications, classifications, and structured extraction, set reasonable output constraints to prevent the model from generating large amounts of irrelevant explanations.
Fourth, differentiate task levels. Use lower-cost solutions for simple completions, format conversions, and summaries; reserve higher-capability models for complex reasoning, architecture design, and large-scale code refactoring.
Fifth, establish real monitoring. At a minimum, log request tokens, cache tokens, output tokens, response times, and error rates. Price comparisons without data support remain purely theoretical.
Conclusion
The core of LLM cost comparison is not finding the absolute lowest single-item price, but understanding the complete token composition and actual usage scenarios.
When the cache hit rate approaches 98%, solutions with lower cache prices usually hold the advantage. When the cache rate drops and the proportion of standard input and output increases, the overall cost ranking may reverse. Monthly subscription plans are suitable for users with stable call volumes, frequent usage, and schedules that primarily align with available (off-peak) hours, but you must pay attention to peak hour rules, quota limits, and actual consumption.
The most reliable evaluation method is: first, collect real call data; second, build conservative, baseline, and optimistic models; finally, integrate API pay-as-you-go fees, subscription fees, available time windows, and call limits into the comparison. Only then will the calculated result reflect a total cost close to your actual business, rather than a simple comparison of price tables.
