Why LLM API Bills Can Differ by Nearly 2x at the Same Unit Price
Comparing only per-token list prices is the most common mistake in LLM API cost evaluation. This article breaks down the billing formula into token mix, cache hit rate, batch discounts, subscription plus overage, and region or model generation, then offers a four-quadrant selection framework, a reusable Python cost estimation script, and a practical optimization checklist to help teams avoid unpredictable month-end bills.
1. The Problem: Same Unit Price, Different Bills
When enterprises evaluate LLM API costs, the most common mistake is comparing unit prices. If the same model has identical list prices across multiple cloud platforms, procurement seems to come down to a single question: who is cheaper? Yet the real bills often tell a different story at month end. With the same call volume and the same business logic, two bills can differ by nearly 2x.
The reason is not mysterious. The pay-as-you-go unit price is only one set of coefficients in the billing formula. Three structural factors determine the final amount:
- Token mix: Input, cache-hit, and output tokens usually have tiered prices, with output the most expensive and cache hits the cheapest.
- Stacked billing rules: Batch (offline asynchronous) discounts, subscription plans with pay-as-you-go overage, and off-peak scheduling apply additional coefficients on top of the list price.
- Region and model generation: Cross-region deployment adds a price premium, and the retirement of older model generations can force architecture migrations.
Once these three factors are separated, “same price, different bill” is an inevitable result rather than a platform difference.
2. Breaking Down the Billing Model
Let in be the input tokens of a request, hit the portion served from cache, in - hit the uncached portion, and out the output tokens. The cost of a single request can be written as:
cost = (in - hit) * P_in + hit * P_cache + out * P_out
P_cache is typically around one tenth of P_in, while P_out can be around five times P_in. This means:
- Workloads with a high output share (long-form generation, code completion, structured extraction) are extremely sensitive to
P_out. - Workloads with a high input share and repeated prefixes (long-document QA, fixed system prompts, batch classification) are extremely sensitive to the cache hit rate.
- Procurement evaluations that compare only
P_inare almost certain to misjudge.
The monthly bill can be further written as a weighted sum by call type:
Month = Σ (N_realtime * cost_realtime) + Σ (N_batch * cost_batch) + N_sub * plan_fee + overage
The split between N_batch and N_realtime, and the ratio between plan_fee and overage, are the real sources of bill divergence.
3. Three Rules That Open Up the Gap
3.1 Batch Discounts: Move Traffic That Can Wait
Major platforms generally offer an asynchronous batch channel: requests enter a queue after submission and usually return results within hours, charged at a percentage of the standard price (commonly around 60%). It suits offline profiling, log labeling, batch translation, and offline evaluation.
Three caveats apply. First, not all models support batch processing; older-generation or lightweight models may not be covered. Second, batch processing has quota and concurrency limits. Third, results must be written to object storage and then retrieved, which makes the pipeline longer.
3.2 Subscription Plans and Overage: Buying “Wholesale” for Stable Loads
The core of a subscription is trading committed usage for a discount: you pay a fixed fee upfront for a token quota pool, and usage beyond it is billed pay-as-you-go. Its economics depend on load stability:
subscription is better ⟺ plan_fee + max(0, Used - Quota) * P_overage < Used * P_payg
When actual usage stays below the quota pool over the long term, the subscription becomes a sunk cost. When usage is steady and close to the quota, the discount yields the most. If the plan also includes off-peak rules (more favorable deductions at night or during low-traffic periods), scheduling deferrable tasks into off-peak windows can amplify the gains further.
3.3 Caching and Region: Two Silent Cost Switches
Caching usually applies automatically to repeated prefixes, with a short default lifetime (on the order of minutes). Some models charge separately for cache writes, and once a hit occurs, only the hit price applies. The engineering implication is clear: prefix stability equals cost control. Putting timestamps or random IDs at the beginning of a prompt permanently defeats the cache.
For regions, cross-border or remote regions often carry a premium of around 5% to 10%, along with higher latency. Connecting to a nearby region saves both money and time.
4. A Four-Quadrant Selection Framework
| Workload Profile | Recommended Strategy | Key Metric |
|---|---|---|
| Offline, deferrable | Batch channel | Discount ratio, queue latency |
| Real-time, high and steady volume | Subscription + overage | Quota pool utilization |
| Real-time, low or volatile volume | Pure pay-as-you-go | Cache hit rate |
| Already on a specific cloud | Connect to the same cloud’s service nearby | Cross-network traffic and regional price gap |
If the business is not tied to a specific model generation, prefer the newer general-purpose model with better cost performance. If you must lock in older-generation capabilities, make “subscription + overage” the default rather than pay-as-you-go.
5. A Reusable Cost Estimation Script
def monthly_cost(records, price, batch_ratio=0.6, plan=None):"""records: [(in_tok, hit_tok, out_tok, is_batch, is_offpeak)]price: (P_in, P_cache, P_out) in currency units per million tokensplan: (fee, quota, overage_price) or None"""p_in, p_cache, p_out = [p / 1e6 for p in price]total = 0.0for in_tok, hit_tok, out_tok, is_batch, is_offpeak in records:c = (in_tok - hit_tok) * p_in + hit_tok * p_cache + out_tok * p_outif is_batch:c *= batch_ratioelif is_offpeak:c *= 0.8 # example coefficient; follow the actual rulestotal += cif plan:fee, quota, over = plantotal = min(total, fee + max(0, total - quota) * over / max(quota, 1))return total
Running the same usage snapshot across all candidate options and producing a comparison table is far more reliable than manual estimation.
6. Optimization Checklist and Common Pitfalls
The suggested optimization priority is:
- Stabilize the prefix: place system prompts, tool definitions, and few-shot examples at the front and keep them fixed to improve cache hits.
- Split real-time and offline pipelines: route the offline portion through batch processing.
- Compress output: use structured format constraints and cap the maximum generation length to cut the most expensive part directly.
- Deploy nearby: avoid cross-region calls.
- Review plans periodically: if quota pool utilization stays low over the long term, revert to pay-as-you-go.
Common pitfalls include writing random content at the start of a prompt and defeating the cache; over-buying subscriptions “just in case”; ignoring the retirement schedule of older model generations, which causes both bills and latency to fluctuate during migration; and drawing procurement conclusions from the input unit price alone.
7. Conclusion
The essence of “same price, different bill” is that the bill is determined jointly by “usage structure × billing rules” rather than by unit price alone. The actionable engineering takeaway is a single sentence: measure the cache hit rate and output share first, then choose batch processing or a subscription, and only compare unit prices last. In practice on platforms such as Baidu AI Cloud, incorporating the cost estimation script into the release process and running a bill regression after every model or prompt change is the most effective way to keep month-end bills from getting out of control.
