LLM API Cost Calculation: Do Limited-Time Discounts and Cache Price Cuts Actually Save You Money?
A practical framework for estimating real LLM API costs when a provider runs a limited-time discount on a flagship model and sharply cuts the input price for cache hits. This article shows how request structure, cache hit rate, and billing model (pay-as-you-go with tiered caching vs. a token plan) determine whether a price cut actually lowers your bill, and lists engineering practices for raising cache hit rates. The goal is to replace intuition with a reusable formula: budget, per-call token split, cost per call, and number of runs.
LLM API Cost Calculation: How to Evaluate Limited-Time Discounts and Cache Price Cuts
1. Background: Does a Price Cut Solve “Too Expensive” or “Worth It”?
A model provider recently introduced a limited-time discount on the API price of its flagship model and made a steep cut to the input price for cache hits. Adjustments like this usually target the pain point of a flagship model’s “high unit price,” but the question users actually care about hasn’t changed: under my real usage pattern, will the price cut actually save me money?
This can’t be answered by intuition. Two providers that both offer “a large and a small model, million-token context, no tiered pricing” may differ noticeably on nominal unit price, yet once you introduce cache hit rate as a variable, the result can flip. So this article abstracts one concrete price comparison into a general cost-estimation framework that any developer can apply.
2. Three Variables to Fix Before You Calculate
Before comparing billing schemes, you must pin down the scenario, or the estimate is meaningless:
- Budget ceiling: fixed at 40 (in your billing currency) for this example, so “how many runs it supports” becomes an intuitive, comparable metric.
- Request structure: 51,000 input tokens and 5,100 output tokens per call, 56,100 tokens total. This input-to-output ratio of roughly 10:1 is a typical long-context Q&A/analysis scenario, and the one where cache benefits show up most clearly.
- Cache hit rate: the most sensitive parameter in the whole model. This example assumes 56%, meaning about 28,560 tokens hit the cache and 22,440 tokens miss.
Note that providers may define “cache hit” and account for it differently. Before calculating, check the official documentation carefully for the minimum cacheable length, cache lifetime, and whether the input unit price differs between hits and misses.
3. Cost Model: A Formula You Can Reuse
Under pay-as-you-go billing, the cost of a single call can be written as:
cost per call = input tokens × miss rate × miss price+ input tokens × hit rate × hit price+ output tokens × output price
For this example’s input/output structure, every 10-percentage-point increase in cache hit rate saves:
51,000 × 10% × (miss price - hit price)
The larger the gap between miss and hit unit prices (for example, a miss price of 3 per million tokens and a hit price of 0.25 per million tokens), the more significantly hit rate affects total cost. This also explains why a “steep cache price cut” can matter far more to heavy long-context users than a nominal input/output price cut.
4. Comparison Logic for the Two Billing Models
1. Pay-as-you-go (with tiered caching)
Suitable for scenarios with volatile request volume and high context repetition. Its advantage is elasticity: no requests means no cost, and the higher the cache hit rate, the lower the unit cost. Its risk: when the hit rate is low (for example, an unstable system prompt or a frequently changing prefix), the miss price becomes the bulk of the cost.
2. Token plans (credit-based packages)
You buy a batch of credits at a fixed price, usually with different conversion ratios for large and small models (for example, 1 token = 1 credit for the base model, 1 token = 2 credits for the flagship model). The advantage is a locked-in unit price and a controllable budget; the downside is that unused credits are sunk cost, and the conversion ratio inflates the effective unit price of the flagship model.
The core method for deciding which is more cost-effective: calculate the number of effective requests you can complete within budget, rather than only looking at the nominal token unit price.
5. Example Results and Key Takeaways
Based on the assumptions above (budget of 40, 56,100 tokens per call, 56% hit rate), pay-as-you-go and plan-based billing can be normalized to the same basis. The example results show a few patterns:
- A cache hit rate of around 80% is the break-even point between the two schemes (under this example’s price structure). Above that threshold, the pay-as-you-go cache discount starts to overtake the plan; below it, the plan’s average-price advantage is more stable.
- For heavy usage with a hard requirement for the flagship model, a large credit package is often cheaper, because the plan’s marginal unit price falls as credits increase and it isn’t affected by hit-rate fluctuations.
- For light or spiky usage, pay-as-you-go is safer, avoiding prepaid credits that expire or sit idle.
- For the base model, cost is significantly lower than the flagship model under either scheme; a budget of 40 supports roughly 2–3 times as many requests as the flagship model. So in engineering terms, prioritize “tiered model routing”: send simple tasks to the small model and escalate to the flagship model only for complex reasoning.
6. Engineering Practices to Raise the Cache Hit Rate
Since hit rate is so critical, it’s worth investing engineering effort to raise it systematically:
- Keep the system prompt prefix stable: put system instructions, tool definitions, and few-shot examples at the very front of the request and keep them byte-for-byte identical, so a tiny prefix difference doesn’t invalidate the cache.
- Reuse the history prefix across turns: append messages in chronological order instead of rewriting history, keeping the prefix hash stable.
- Fix the order of tool-call output: if the context includes retrieval results or tool returns, keep the concatenation order fixed to reduce unnecessary perturbations.
- Templatize batch tasks: have the same class of document-processing tasks share one prefix template and only swap the variable tail.
- Monitor hit-rate metrics: log hit/miss token counts per batch on the calling side and build a hit-rate dashboard as a core cost-optimization metric.
- Evaluate cache lifetime: if the cache lifetime is short, the benefit of repeatedly accessing the same long context decays, so weigh it against request intervals.
7. Recommendations for Decision-Makers
- Test before you choose: run 100–500 calls with your own real request samples, measure the actual hit rate and output-length distribution, then apply the formula above.
- Don’t get held hostage by a “limited-time discount”: the discount price only affects marginal cost; if your volume can’t support it, prepaying or stockpiling credits is just waste. Conversely, if you can keep the hit rate stable above 70%, a pay-as-you-go + cache combination may be better long-term.
- Build a cost regression test: bring cost per call into CI monitoring and alert promptly when price or hit rate shifts.
- Tier your models: write cost sensitivity into your routing policy—“if a small model can do it, never escalate.”
8. Summary
A price announcement is only the starting point. Real cost is determined together by request structure × cache hit rate × billing model. A fixed estimation framework—budget, per-call token split, cost per call, number of runs—lets you quantify any “price cut.” Rather than arguing over which nominal unit price is lower, first raise your own cache hit rate: it’s often the only cost lever entirely under your control.
