LLM Inference Cost Estimation and Plan Selection: A Practical Guide
Comparing per-million-token prices is a common but unreliable way to evaluate LLM inference services, because the final bill depends on cache hit rate, input/output mix, and peak versus off-peak pricing. This article shows how to build a parameterized cost model, factor in time-of-day scheduling, and convert subscription plan quotas into equivalent pay-as-you-go costs so you can choose between usage-based billing and a subscription plan based on total monthly spend.
1. Why Comparing Unit Prices Often Gives the Wrong Answer
When evaluating LLM inference services, the most common approach is to put the per-million-token price of two options side by side. This is not rigorous from an engineering standpoint, because the real bill is determined by several variables together, and unit price is only one of them.
At least three categories of variables can significantly change the final spend:
- Cache hit rate: Tokens served from cache are usually billed at a price far below the standard input rate. Moving the hit rate from 95% to 98% can change the cost structure qualitatively.
- Input-to-output ratio: Output tokens often cost several times more than input tokens. If the output share rises from 0.5% to 5%, total cost can multiply several times over.
- Time-of-day and quota constraints: Some services charge higher prices or enforce tighter quotas during business peak hours, and offer more relaxed conditions off-peak.
The right approach is therefore to build a parameterized cost model that makes these variables explicit, then plug in the real distribution of your own workload.
2. Building a Parameterized Cost Model
Let p_cache be the unit price of cache-hit tokens, p_in the standard input price, p_out the output price, h the hit rate, i the input share, and o the output share. The cost per 100 million tokens can be written as:
Cost = 1e8 * ( h * p_cache + (1 - h) * i * p_in + o * p_out )
The key point here is that the hit rate and the input share are multiplicative: only the input portion that misses the cache is billed at the standard input rate. Many estimation errors come from conflating “uncached input” with “all input.”
High Hit Rate Scenario
When caching works well and system prompts and long contexts are reused repeatedly, the hit rate can reach around 98%, with an input share of about 1.5% and an output share of about 0.5%. In this case, the uncached standard input accounts for only 0.03% of the total, and the bill is dominated almost entirely by the cache price. The gap between two services with different pricing strategies narrows in this scenario, and can even reverse.
Medium Hit Rate Scenario
When the hit rate falls back to around 95%, the uncached input share rises to about 0.075%, and the option with a higher standard input price quickly pulls ahead in cost. This shows that a low cache price does not necessarily mean a low total cost; it has to be read together with the hit rate.
Low Hit Rate Scenario
If the workload consists of many one-off long documents, concatenated retrieval snippets, and requests whose context almost never repeats, the hit rate may drop below 80%. Cache discounts then become nearly useless, the bill reverts to the traditional “input-dominated” structure, and the selection logic has to be rewritten entirely.
3. Factoring Time of Day into the Model
Beyond unit price, time-of-day strategy also affects cost. A common industry practice is to split the day into peak and off-peak periods: prices rise or quotas tighten during peak hours, while off-peak hours come with discounts and larger quotas. Services differ widely in how they define “peak”; some concentrate it in a four-hour window on weekday afternoons, while others cover the entire weekday daytime.
The engineering response is to separate deferrable tasks from real-time tasks:
Real-time path (online chat, interactive completion) → time-insensitive, prioritize latencyOffline path (batch summarization, code base indexing, regression evaluation) → schedule into off-peak windows
Moving offline load into lower-cost windows through a task queue often yields a meaningful discount without changing business logic.
4. Converting Subscription Plans to Usage-Based Costs
Subscription plans (such as coding plan subscriptions for AI coding tools) are typically priced as a fixed monthly fee plus a weekly token quota, and they also distinguish peak from off-peak. To judge whether a plan is worthwhile, you need to convert the quota into an equivalent usage-based cost:
Equivalent list price = weekly quota × 4.33 × blended unit price for the relevant periodPlan discount rate = plan monthly fee / equivalent list price
With common parameters, the plan price lands roughly in the 50%–70% range of the equivalent list price, i.e., a 30% to 50% discount. But the discount rate is not a constant; it varies with the hit rate, the output share, and the proportion of peak-hour tasks:
- The higher the output share, the better the plan looks, because plans usually do not differentiate input and output prices internally.
- The more peak-hour tasks, the better the plan looks, because usage-based billing is more expensive at peak.
- The more volatile the usage, the worse the plan looks, because unused quota is a sunk cost.
5. Selection Checklist
- First, use one week of real call logs to measure the three parameters
h,i, ando; do not pick values by feel. - Use the formulas above to compute the monthly cost of the usage-based option and the plan option separately; what you compare is the total, not the unit price.
- Assess the stability of team usage: stable, predictable load suits a plan, while sparse or project-based load suits usage-based billing.
- Schedule offline tasks into low-cost windows, then recalculate the plan discount rate.
- Review once per quarter, because unit prices, quotas, and time-of-day policies all get adjusted.
6. Common Pitfalls
- Looking only at the cache price: ignoring the hit rate can lead to the exact opposite conclusion.
- Ignoring output cost: the output price is usually several times the input price, and a small rise in output share can dominate the bill.
- Treating quota as cost: the unused portion of a plan is real spending and should be amortized against actual consumption.
- Overlooking differences in peak definitions: the same “peak” can cover a range that differs by several times.
Overall, cost optimization for LLM inference is not about finding the “cheapest unit price,” but about putting the hit rate, input/output structure, time-of-day scheduling, and billing model into the same model and optimizing them jointly. Once you have this estimation method in hand, you can produce a cost conclusion that is reviewable and recomputable as the business changes, whether you choose usage-based billing or a subscription plan.
