Same Price, Different Bills: Five Hidden Costs When Choosing an LLM API
Choosing an LLM API based only on listed token prices can lead to a 20% or larger gap in actual monthly spending. This article breaks down the five hidden cost factors—cache billing, batch interfaces, subscription plans, off-peak discounts, free quotas, and regional pricing—and provides a generic calculation method, including a reusable Python script, to estimate real monthly costs from your own usage logs.
One: Why Identical Unit Prices Produce Different Bills
When comparing LLM APIs, most teams start by checking input and output prices per million tokens. If the pay-as-you-go prices are similar, they assume the choice doesn’t matter. Then the month-end bill arrives: with the same workload, spending across different platforms can differ by more than 20%.
The gap comes from billing rules beyond the listed price. Cache hits, batch endpoints, subscription packages, off-peak discounts, free quotas, and regional pricing all affect the final total. This article does not cite any specific vendor’s rates. Instead, it offers a methodology that works for any platform: first understand how each rule charges, then substitute your own usage logs into the formulas to calculate the real monthly bill.
Two: Cache Billing — Hit Rate and Write Price Determine Whether It Pays Off
Context caching is best suited for repeated prefixes such as long system prompts, tool definitions, few-shot examples, and fixed documents. Platforms typically break tokens into three billing categories:
- Standard input: input tokens that miss the cache, charged at the standard input price.
- Cache writes: tokens used to write a prefix into the cache for the first time. Some platforms charge this separately, and the write price may be higher than the standard input price.
- Cache hits: tokens reused from a cached prefix in subsequent requests, charged at a significantly lower rate.
Three rule details matter. First, is caching enabled automatically or does it require an explicit parameter? Second, is cache writing charged separately, and does a longer TTL (time-to-live) mean a higher write price? Third, cache hits depend on byte-for-byte prefix matching, so fixed content should be placed at the beginning of the prompt and variable content at the end.
Whether caching is worthwhile depends on how often the same prefix is used within the TTL. Let the standard input price be P, the hit price h, and the write price w. Let k be the number of times a prefix is used within one TTL, including the first write. Without caching, the cost is k × P. With caching, it is w + (k − 1) × h. Equating the two gives the break-even number of uses:
k\ = (w − h) / (P − h)*
This assumes all reuse happens within the TTL.
Example. Assume P = 2 and h = 0.2 (the hit price is 10% of the input price). If the write price equals the standard input price (w = 2), then k* = 1, and caching pays off as soon as the prefix is reused once. If the write price is 1.25× the input price (w = 2.5), then k* ≈ 1.28, meaning the prefix must be used at least twice for caching to save money.
The longer the prefix, the more each hit saves. When prefixes are short or reuse is infrequent, write costs can outweigh savings — in those cases, disabling caching or shortening the TTL is more cost-effective.
Three: Batch Endpoints — Deferrable Calls Cut Costs Directly
Most platforms offer batch endpoints. They do not guarantee real-time responses; results are delivered within a defined time window at a lower price than real-time pay-as-you-go. Suitable workloads include data cleaning, offline annotation, content classification, and overnight evaluation.
The criterion is straightforward: does a user need the result within seconds or a minute? If not, the request can go into the batch queue.
The effect of batch pricing depends on two numbers: the fraction of requests that can be migrated (r) and the batch price as a coefficient of the real-time price (d). The total cost after migration is roughly (1 − r) + r × d times the original. With r = 50% and a batch price half of real-time (d = 0.5), the total cost drops to 75%, a 25% reduction. With r = 20%, the same discount yields only a 10% reduction. The key is not how large the discount looks, but how much traffic can actually be migrated.
Check the specific batch discount on each platform’s pricing page, and verify whether batch calls can be combined with caching rules.
Four: Subscriptions and Off-Peak Pricing — Calculate the Break-Even Line First
Some platforms offer subscription plans: a monthly fee for a quota of tokens, usually restricted to specific models. Others discount off-peak calls or let off-peak usage consume subscription quota first.
The monthly cost with a subscription is:
Monthly subscription cost = fee F + max(0, U − Q) × p
where U is the actual monthly usage, Q is the included quota, and p is the overage pay-as-you-go price. Compared to pure pay-as-you-go cost of U × p, a subscription is worthwhile only when:
F < min(U, Q) × p
In other words, a subscription pays off only when actual usage fills the quota, and the quota’s value at the pay-as-you-go rate exceeds the fee. Expired quotas, overage pricing, and model restrictions all reduce the real benefit.
The overall effect of off-peak pricing can be approximated as: fraction of calls shifted to off-peak × off-peak discount percentage. For example, if 40% of calls can move to off-peak hours and off-peak rates are 20% lower than daytime, the total reduction is roughly 8%. This is an estimate — plug in your own call-time distribution for accuracy.
Schedulable workloads like content generation, scheduled reports, and batch summarization are best suited for off-peak scheduling. Interactive requests usually have no such flexibility.
Five: Free Quotas and Regional Price Differences
When a new model launches, some platforms offer a limited amount of free tokens. These are useful for testing, stress testing, and small-scale trials. Before moving a project to production, verify the following:
- The regions and model versions to which the quota applies.
- The quota’s validity period and whether it automatically switches to pay-as-you-go after expiry.
- Whether the production rates match the rates during the trial period.
- Whether auto-renewal or prepaid settings are enabled.
Regional price differences also warrant a separate check. The same model can have different listed prices in different regions. When choosing a region, in addition to price, consider latency, compliance requirements, and data residency rules. For workloads involving personal or regulated data, confirm whether data can leave a designated region before comparing prices. Domestic businesses without overseas requirements should generally prefer a domestic region.
Six: A General Monthly Cost Estimation Method
Break tokens down by usage type, then price each separately.
Monthly cost = real-time call cost + batch call cost + subscription fee − free quota deduction
Real-time call cost = (standard input tokens × input price + cache hit tokens × hit price + cache write tokens × write price + output tokens × output price) / 10⁶
Batch call cost = (migrated input tokens × input price + migrated output tokens × output price) × batch factor / 10⁶
When using a subscription, subtract the quota Q from usage first, charge the remainder at the pay-as-you-go rate, and add the monthly fee.
The Python script below implements these formulas. All unit prices are placeholder examples and do not represent any platform’s actual rates; replace them with the numbers from your target platform’s pricing page.
def monthly_cost(daily_requests, # daily request countin_tok_per_req, # average input tokens per request (including cached portion)out_tok_per_req, # average output tokens per requesthit_ratio=0.5, # share of input tokens that hit the cachewrite_ratio=0.0, # share of input tokens written to cachebatch_ratio=0.5, # share of requests that can migrate to batchprice_in=2.0, # standard input price, CNY per million tokens (example)price_hit=0.2, # cache hit price, CNY per million tokens (example)price_write=2.5, # cache write price, CNY per million tokens (example)price_out=8.0, # output price, CNY per million tokens (example)batch_factor=0.5, # batch price as a factor of real-time pricedays=30,):M = 1e6total_in = daily_requests * in_tok_per_req * daystotal_out = daily_requests * out_tok_per_req * daysdef realtime_cost(tok_in, tok_out):hit = tok_in * hit_ratiowrite = tok_in * write_rationormal = tok_in - hit - writereturn (normal * price_in + hit * price_hit+ write * price_write + tok_out * price_out) / M# Real-time portion: priced with caching rulesrt_cost = realtime_cost(total_in * (1 - batch_ratio),total_out * (1 - batch_ratio))# Batch portion: priced with batch factor, assuming no cache discount stackingbatch_cost = (total_in * batch_ratio * price_in+ total_out * batch_ratio * price_out) / M * batch_factorreturn rt_cost + batch_cost# Example: 50k requests/day, 1000 input tokens and 400 output tokens per request# That is 50M input and 20M output tokens per dayprint(monthly_cost(daily_requests=50000, in_tok_per_req=1000, out_tok_per_req=400))# Output: 5175.0 (monthly cost in CNY at example prices)
The baseline — all pay-as-you-go, no caching, no batch — is 7,800 CNY per month for the example. Enabling caching and batch brings it down to about 5,175 CNY, a ~33% reduction. This reduction applies only to the example’s usage profile; recalculate with your own data.
Seven: Selection Checklist
Use the table below to record each platform’s rules before comparison.
| Dimension | Questions to Verify | Notes |
|---|---|---|
| Pay-as-you-go pricing | Input, output, and cache hit prices; date of the pricing page update | |
| Cache rules | Auto-enabled or not; whether writes are charged separately; TTL length | |
| Batch endpoint | Discount factor; delivery window; whether it stacks with caching | |
| Subscription plan | Monthly fee; included quota; covered models; validity period; overage price | |
| Off-peak rules | Time window; discount method; whether subscription quota is consumed first | |
| Free quota | Applicable regions and model versions; validity; billing after expiry | |
| Regional pricing | Listed price per region; latency; compliance and data residency requirements | |
| Model lifecycle | When the current model stops accepting new users; what the successor model is |
Then follow these steps:
- Using the last one to two months of call logs, calculate total input and output tokens, prefix reuse patterns, the share of deferrable calls, and the off-peak share.
- Use the formula or script in Section Six to compute the monthly cost for each candidate platform.
- Evaluate subscriptions and free quotas separately to confirm they actually apply to your usage.
- Among platforms that meet latency and compliance requirements, choose the lowest-cost option. Also plan a migration path, since older model versions may be phased out for new users. New projects can be built directly against the successor model, with the model name kept as a configurable item.
Eight: Conclusion
Optimizing LLM API costs comes down to reading the billing rules carefully. The listed price is only the starting point. Caching, batch, subscriptions, off-peak pricing, free quotas, and regional choices determine what the same workload ultimately costs. Before integrating, spend half a day running the calculation with real logs — it saves more money than after-the-fact adjustments.
Risk note: pricing pages change, and contract discounts may differ from published rates. Verify the pricing page’s update date and contract terms before calculating.
