LLM API Pricing: A Cost Calculation Guide for Limited-Time Discounts and Cache Price Cuts
This guide explains how to calculate LLM API costs when providers introduce limited-time discounts or reduce cache pricing. It breaks a bill into three variable components—cache-hit input, cache-miss input, and output—and shows how output length and cache hit rate often affect total cost more than unit-price discounts. Using a 40-unit budget example, it compares credit-based and metered three-tier pricing, demonstrates how to normalize different billing models, and outlines practical ways to raise cache hit rates. It also covers common credit-plan pitfalls and a decision checklist for evaluating whether a price change is genuinely cheaper.
1. Background: Why a Discount Does Not Always Mean Lower Cost
Price adjustments for large language model (LLM) inference services usually involve two different actions. One is a limited-time discount, which reduces input and output unit prices by a percentage within a specific time window. The other is a structural reduction in cache billing, which pushes the unit price of cache-hit input far below that of cache-miss input and often remains in effect long term. These two actions affect the final bill in completely different ways, and looking at them together can easily lead to the wrong conclusion.
A limited-time discount changes the unit price, while a cache price cut changes the effective unit price. The former reverts when it expires; the latter continues to influence your architecture choices. So when evaluating any price adjustment, the first step is not to calculate the total cost but to break the bill into three variables: cache-hit input, cache-miss input, and output.
Note that this article does not recommend or review any specific vendor’s product. All unit prices are illustrative values used to demonstrate the calculation method. For actual decisions, refer to the official billing page of the service you use.
2. Cost Model: Breaking the Bill into Three Parts
Let the input tokens per request be I, the output tokens be O, and the cache hit rate be h. Let the three unit prices be p_hit, p_miss, and p_out (all in currency units per million tokens). The cost per request is:
cost_once = (I * h) / 1e6 * p_hit+ (I * (1 - h)) / 1e6 * p_miss+ O / 1e6 * p_out
Given a budget B, the number of runs and the total available volume are:
runs = B / cost_oncetokens_total = runs * (I + O)
The key takeaway is that output length and cache hit rate often have a greater impact on total cost than the unit-price discount itself. Take a typical intelligent coding and long-document scenario with a 10:1 input-to-output ratio. The output unit price is usually several times the cache-miss input price, but because the output volume is small, its absolute contribution is still constrained by the ratio. On the input side, once the cache hit rate rises from 50% to 80%, input cost can drop by more than 30%.
3. Worked Example: A Breakdown Under a 40-Unit Budget
Using a consistent set of assumptions: a budget of 40 units, 51,000 input tokens per request, 5,100 output tokens per request, 56,100 tokens per request in total, and a cache hit rate of 56%. This breaks down into 28,560 cache-hit input tokens, 22,440 cache-miss input tokens, and 5,100 output tokens.
For credit-based plans, a unit conversion is needed first. If 40 units correspond to 60 million credits, with 1 token = 1 credit for the small model and 1 token = 2 credits for the large model, then:
- Small model tier: about 0.0374 units per request, roughly 1,070 runs, totaling about 60 million tokens;
- Large model tier: about 0.0748 units per request, roughly 535 runs, totaling about 30 million tokens.
For services with metered three-part billing, the tiers after the discount period and cache price cut can be calculated as:
- Lightweight tier (hit 0.2 / miss 1 / output 2): about 0.0384 units per request, about 1,043 runs, totaling about 58.51 million tokens;
- High-performance tier at the discounted price (hit 0.25 / miss 3 / output 6): about 0.1051 units per request, about 381 runs, totaling about 21.36 million tokens;
- The same high-performance tier at the original price (hit 1 / miss 12 / output 24): the cost per request is about four times the discounted price, and the number of runs the budget allows drops to around 95.
These numbers show two things: the gap created by the discount period is on the order of multiples, while the gap created by the cache price cut is structural, because it lowers the hit unit price at the same time and significantly improves the economics of high-hit-rate scenarios.
4. Cache Hit Rate: The Most Underrated Variable
The hit rate is not a constant but an engineering metric determined by how requests are constructed. Actionable ways to improve it include:
- Stable prefix: Put the system prompt, tool descriptions, and long-term unchanged project context at the front, and avoid changing them on every request, which would invalidate the prefix;
- Reduce timestamps and random values: Move dynamic content to the back to avoid polluting the reusable prefix;
- Control context trimming strategy: Keep the rolling window and summarization strategy fixed to avoid the prefix changing repeatedly within the same session;
- Batch and concurrency orchestration: Merge small requests to reduce repeated billing of duplicate prefixes;
- Observability: Use logging services and monitoring alerts to track the hit rate and average input and output lengths, and treat the hit rate as a first-class metric.
When the hit rate rises from 56% to 80%, the effective input unit price of the high-performance tier drops noticeably and can usually come close to the lightweight tier in cost. This is also why a permanent cache price cut is more worth factoring into long-term architecture considerations than a limited-time discount.
5. Converting and Avoiding Pitfalls with Credit-Based and Metered Plans
Credit-based plan quotes may look straightforward, but they must be converted to a common basis before comparison:
credit_per_token(model) = conversion factor for the modeleffective_price = plan_price / (total_credits / conversion_factor) * 1e6 # currency units per million tokens
There are four common pitfalls. First, different models have different conversion factors, so directly comparing “total credits” overestimates the capability of large models. Second, credit expiration and monthly reset rules can distort the nominal unit price. Third, although the context length is long, whether it is billed in segments determines the actual cost in long-document scenarios. Fourth, rate limits and concurrency caps can replace price as the main bottleneck under heavy usage.
6. Decision Checklist: What to Do During the Discount Period
- Replay historical real traffic to measure the input and output distribution and hit rate, rather than estimating with ideal values;
- Calculate the “cost during the discount period” and the “cost after the discount ends” separately, and only commit to an architecture when the long-term cost is acceptable;
- Move volatile content to the back and fix the stable prefix, raising the hit rate first before discussing model selection;
- Build a budget back-calculation: given a budget and a target call volume, solve for the affordable cost per request, then match a tier;
- Keep a replaceable abstraction layer to avoid being locked into a single billing basis;
- If you use general cloud capabilities (such as object storage for long context, message queues for request peak shaving, container platforms for self-hosted inference, and logging and monitoring systems for cost attribution), attribute costs to business tags for easier ongoing optimization.
7. Conclusion
Limited-time discounts determine the short-term bill, while the cache billing structure determines long-term economics. The right approach is to break cost into three parts—cache-hit input, cache-miss input, and output—convert different billing models to a common basis, and then validate hit-rate assumptions with real traffic replay. Only by treating the hit rate as an optimizable engineering metric and evaluating the cost after the discount expires at the same time can you judge whether a price adjustment is truly cheaper or just looks cheaper.
