Token Cost Accounting: Cache Hits and Subscription Break-Even Analysis
This article explains how to calculate the real cost of large language model usage. It covers why list prices alone can mislead, how cache hits, output tokens, and time-of-day pricing change the total bill, and how to find the break-even point between a subscription plan and pay-as-you-go billing.
1. Why List Prices Alone Are Not Enough for Model Selection
Model pricing is usually quoted as a price per million tokens. However, the real cost of the same workload can differ by several times depending on how the model is used. Three factors cause this gap. First, input and output tokens have different prices. Second, some input tokens may hit the cache and cost less. Third, some platforms apply different prices at different times of day. Subscription quotas also depend on the actual usage pattern once they are converted to pay-as-you-go prices. Looking at a single unit price often leads to the wrong conclusion.
The goal of cost accounting is to find the actual cost per unit of business activity, such as per conversation, per task, or per 100 million tokens. Only after the figures use the same unit can different options be compared meaningfully.
2. Breaking Down Billable Units
A single model call usually produces three types of billable tokens:
- Uncached input tokens: These must be fully computed. They are usually the most expensive part of the input.
- Cached input tokens: The request prefix matches earlier requests, so the server has already stored the corresponding intermediate computation results. The price is therefore clearly lower than for uncached input.
- Output tokens: The model generates content one token at a time, so computation is expensive. Output is usually priced higher than input.
Cache hits matter most for multi-turn conversations and long prompts. System prompts, tool definitions, and fixed documents repeat in every request. If they appear at the start of the request and remain byte-for-byte identical, they can keep hitting the cache. Conversely, inserting timestamps or random IDs into the prefix can significantly reduce the hit rate.
3. Unit Cost Model
Assume that usage over a period can be summarized into three totals: H, the number of cached input tokens; M, the number of uncached input tokens; and O, the number of output tokens. The unit prices are p_hit, p_in, and p_out, all in CNY per million tokens. The total cost is:
Total cost = H × p_hit + M × p_in + O × p_out
The same formula in pseudocode:
function token_cost(hit_m, miss_m, out_m, p_hit, p_in, p_out):# Token counts are in millions. Unit prices are in CNY per million tokens. Returns the cost in CNY.return hit_m * p_hit + miss_m * p_in + out_m * p_out
The following example uses illustrative parameters only. They explain the method and do not reflect any platform’s actual pricing. Assume uncached input costs 1.0 CNY per million tokens, cache hits cost 0.1 CNY per million tokens, and output costs 4.0 CNY per million tokens. Over a period, input totals 100 million tokens and output totals 2 million tokens, with a 98% cache hit rate:
- Input cost: 100 × (0.98 × 0.1 + 0.02 × 1.0) = 11.8 CNY
- Output cost: 2 × 4.0 = 8.0 CNY
- Total: 19.8 CNY
The result shows that even when the cache price is one tenth of the uncached price, uncached tokens still make up a considerable share of input cost. Cost accounting must therefore separate these two token types. Looking at total input volume alone is not enough.
4. Sensitivity Analysis of Cache Hit Rate
Cache hit rate is one of the most sensitive variables in cost. Using the same parameters and changing only the hit rate gives the following results (in CNY):
| Cache Hit Rate | Input Cost | Output Cost | Total |
|---|---|---|---|
| 98% | 11.8 | 8.0 | 19.8 |
| 95% | 14.5 | 8.0 | 22.5 |
| 90% | 19.0 | 8.0 | 27.0 |
| 50% | 55.0 | 8.0 | 63.0 |
With these parameters, each one-percentage-point drop in cache hit rate increases the total cost by 0.9 CNY. This sensitivity depends on the total input volume and on the price gap between cache hits and uncached input. If the workload is mainly output, the hit rate has a smaller effect on total cost. In contrast, for long-context, low-output analysis tasks, the hit rate almost determines the cost level.
A simple loop can scan sensitivity and reveal cost inflection points:
for each h in [0.5, 0.6, ..., 1.0]:cost = token_cost(I * h, I * (1 - h), O, p_hit, p_in, p_out)output h and cost
Before going live, estimate the actual cache hit rate from historical logs instead of assuming an ideal value.
5. The Effect of Time-of-Day Pricing
Some platforms apply different prices or quota rules to peak and off-peak hours. Include this time factor in a weighted average. Assume 60% of requests fall in peak hours at 1.0 CNY per million tokens, and 40% fall in off-peak hours at 0.5 CNY per million tokens. The weighted average price is:
0.6 × 1.0 + 0.4 × 0.5 = 0.8 CNY per million tokens
Two points need attention. First, the definition of peak hours varies by platform, including start and end times, the days covered, and whether weekdays are treated differently. Always follow the official rules. Second, the length of the peak window determines how much load you can shift. If the peak window is short, scheduling offline batch processing, data cleaning, and evaluation tasks during off-peak hours can directly reduce the bill.
6. Break-Even Point for Subscription Plans Versus Pay-as-You-Go Billing
A subscription plan usually charges a fixed monthly fee and includes a quota. To judge whether it is worth it, compare two things: the plan fee, and the value of the same usage at pay-as-you-go prices.
Define the following variables:
- F: the monthly plan fee, in CNY
- V: the value of the plan quota at pay-as-you-go prices, in CNY
- u: the utilization rate, meaning the share of the plan quota actually used
The effective cost ratio is:
Effective cost ratio = F / (V × u)
When the ratio is below 1, the plan costs less than pay-as-you-go billing. The break-even utilization rate is:
Break-even utilization = F / V
Example: The monthly fee is 100 CNY, and the quota is worth 160 CNY at pay-as-you-go prices. The break-even utilization is 100 / 160 = 62.5%. At 80% utilization, the used value is 128 CNY, and the effective cost ratio is 100 / 128 ≈ 0.78. You pay about 78% of the pay-as-you-go price. At 50% utilization, the ratio is about 1.25, so pay-as-you-go billing is cheaper.
function breakeven(fee, quota_value, utilization):used_value = quota_value * utilizationreturn fee / used_value
Three points matter when evaluating a subscription. First, quotas may be calculated separately for each time period, so the effective quota during peak hours should be converted on its own. Second, quotas have periodic limits, and unused amounts usually do not carry over, so utilization should be measured for each billing period.
