Real Cost of LLM APIs: Cache Hits, Peak Pricing, and Subscription Economics
List prices for LLM APIs are only one input into actual spend. This article presents a reusable cost model based on three-part token pricing, cache hit rate, input/output mix, time-of-day pricing, and subscription quotas, then shows how to run sensitivity analysis and build a practical vendor-selection workflow.
Real Cost of LLM APIs: From Cache Pricing to Subscription Plans
When teams deploy LLMs, many compare only the vendor’s published list price during selection, then find that the actual bill is far higher than expected. The reason is that real cost is not simply “input price + output price.” It is determined jointly by cache hit rate, input/output ratio, time-of-day pricing, plan quotas, and other variables. This article uses a typical cost comparison exercise to break down a complete method for calculating the real cost of LLM APIs and to provide a reusable calculation framework.
1. Why List Prices Are Not Reliable: Cache Pricing Is a Key Variable
Mainstream LLM APIs commonly use a three-part pricing structure:
- Cached input: the portion that exactly matches the historical context prefix, billed at a very low cache price;
- Normal input: newly added prompts and context, billed at the standard input price;
- Output: model-generated content, usually the highest-priced segment.
The cache price may be one-tenth of the standard input price or even lower. This means that in scenarios with highly repeated context, such as chat, coding assistants, and long-document analysis, the cache hit rate directly determines the magnitude of the final bill. Comparing only the “standard input price per million tokens” during vendor selection often leads to the wrong conclusion.
2. A Real Cost Calculation Model
To calculate real cost, two empirical parameters must first be determined:
- Cache hit rate: the share of tokens in a request that match the cached prefix;
- Input/output ratio: in Agent and coding scenarios, output usually accounts for only a small proportion, because most token consumption comes from reading long context.
Assume a typical call has the following traffic composition: 98% cached hits, 1.5% uncached input, and 0.5% output. This ratio is not exaggerated in high-reuse scenarios. The blended cost per 100 million tokens is:
cost = 0.98 × cache_price + 0.015 × input_price + 0.005 × output_price
After plugging in different vendors’ cache, input, and output prices, the result may completely overturn intuition: Vendor A may have a higher cache price, but because its standard input/output prices are lower, its total cost is better at a high cache hit rate. Once the cache hit rate falls, the weighting shifts toward standard prices, and the price ranking may reverse directly.
Sensitivity analysis example:
| Cache hit rate | Scenario 1 (high cache price / low standard price) | Scenario 2 (low cache price / high standard price) |
|---|---|---|
| 98% | approx. CNY 12.6 per 100M tokens | approx. CNY 9.4 per 100M tokens |
| 95% | approx. CNY 14.9 per 100M tokens | approx. CNY 18.3 per 100M tokens |
A small change, such as a drop in hit rate from 98% to 95%, is enough to reverse the relative advantage of the two options. Therefore, cost calculation must be based on your own actual traffic profile, not on typical values published by vendors.
3. Time-of-Day Pricing: Off-Peak Discounts and Peak Limits
Many vendors have introduced time-based pricing: large discounts during off-peak periods (usually late night to early morning), with normal prices or even surcharges during peak periods. When evaluating such plans, pay attention to two points:
- The applicable discount window. Some vendors have long off-peak windows (for example, more than 12 hours per day), while others have shorter ones. The longer the window, the easier it is for a business to schedule batch tasks into low-price periods, and the greater the actual savings.
- The definition of peak periods. Some plans define peak periods as only a few hours on each workday, with looser quota-based billing at other times. Such designs vary greatly in friendliness to teams whose work is concentrated during the daytime. Evaluation should compare against your own call-time distribution, not just the word “peak.”
In practice, deterministic tasks (batch data processing, offline evaluation, log summarization) can be pushed into off-peak periods through queue scheduling, while interactive requests remain in normal periods. Accounting for the two separately can significantly reduce the blended unit price.
4. Subscription Plans vs. Pay-as-You-Go: How to Convert Real Discounts
In addition to pay-as-you-go APIs, major vendors commonly offer monthly plans for coding assistants, usually in multiple tiers, with each tier specifying a weekly token quota. The standard way to judge whether a plan is cost-effective is:
- Take the plan’s weekly token quota;
- Using your actual cache hit rate, apply the formula in Section 2 to calculate the “list-price cost” of those tokens if they were consumed through the pay-as-you-go API;
- Compare the monthly plan fee with the list-price cost to derive the discount rate.
A typical conclusion is that the unit price of a plan is roughly 50%–70% of the pay-as-you-go API price, but only on the premise that the quota can be fully used. If a team’s usage is only half the quota, the unit-cost advantage of the plan shrinks substantially and may even be less flexible than pay-as-you-go billing.
Also pay attention to:
- Quota reset cycle: whether quotas reset weekly or monthly affects elasticity during usage spikes;
- Whether peak periods are limited: some plans throttle or limit available quota during peak hours, so it is necessary to assess whether this affects the interactive experience;
- Overage strategy: whether exceeding the quota leads to degradation, throttling, or optional pay-as-you-go continuation.
5. A Reusable Selection Decision Process
It is recommended to evaluate costs in the following steps:
- Collect a traffic profile: measure the cache hit rate, input/output token ratio, and call-time distribution over the past one to two weeks;
- Build a calculation script: plug each option’s three-part unit prices into the formula and plot cost curves as the hit rate changes;
- Run sensitivity tests: move the hit rate up and down by 3–5 percentage points and observe whether the ranking of options remains stable; make decisions only within intervals where the ranking is stable;
- Add time-of-day strategy: estimate the share of traffic that can be covered by off-peak scheduling and calculate the blended unit price under time-based pricing;
- Compare subscription plans: convert plan discount rates based on actual usage, and make a comprehensive judgment together with quota, throttling, and reset cycle;
- Monitor continuously after launch: record token consumption by segment at the gateway layer and periodically review whether the calculation assumptions still hold.
6. Summary
The real cost of LLM APIs is a multivariable function, and the list price is only one input. A small fluctuation in cache hit rate can reverse the price ranking of different options; the length of the time-of-day pricing window determines how much of the discount can actually be used; subscription plans usually amount to 50%–70% of pay-as-you-go prices, but only if the quota is fully used. For teams, the most reliable approach is to build a recalculable cost model based on their own traffic profile, run sensitivity analysis before deciding, and continue calibrating after launch. Cost optimization is not a one-time selection action but an engineering practice that requires ongoing operations.
