Why LLM API Bills Can Differ by 2x at the Same Unit Price
Identical per-token prices across cloud platforms do not guarantee identical monthly bills. This article breaks down LLM API billing into six variables—pay-as-you-go rates, cache pricing, batch discounts, subscription and off-peak rules, free quotas, and regional factors—and shows how to compare platforms using a fixed usage profile. It also provides a decision workflow, a sample cost calculation function, common pitfalls, and engineering recommendations for keeping monthly spending predictable.
1. The Problem: Same Unit Price, a Bill That Doubles
A common source of confusion in model integration projects is this: the same large language model can have exactly the same list price on several cloud platforms, yet the end-of-month bill may differ by nearly 2x. The reason is not the unit price itself, but the billing rules layered on top of it.
A bill can be approximated as follows:
Monthly bill ≈ Σ(input tokens × input price + output tokens × output price)- cache hit discount- batch discount- free quota deduction+ subscription plan with pay-as-you-go overage+ regional factor markup
The unit price is only the coefficient in the first term. What actually drives the gap are the discount terms, the deduction terms, the add-on terms, and the regional factor. Once this is clear, cost optimization shifts from “find the cheapest platform” to “align your traffic profile with the most suitable billing rules.”
2. Six Variables That Make Up the Cost
- Pay-as-you-go rates: three tiers—input, cache hit, and output. Output is usually significantly more expensive than input, so the output share is the first sensitivity factor for the bill.
- Cache billing: repeated prefixes can automatically hit the cache and are then charged at the hit price; however, cache writes (with shorter or longer time-to-live) may be billed separately. A high hit rate yields clear savings, while an unstable prefix can increase cost instead.
- Batch discounts: offline, deferrable workloads typically qualify for a discount off the standard price (commonly 50% to 60% in the industry), at the cost of no guaranteed real-time completion.
- Subscriptions and off-peak rules: a plan includes a certain token quota, with usage above it converted to pay-as-you-go; some platforms offer lower cost during nighttime off-peak hours, which suits batch traffic that can be shifted.
- Free quota: newly launched models often come with a one-time free token quota, suitable for load testing and migration validation.
- Regional factor: the same model in a non-primary region (such as an overseas node) carries a markup of roughly 5% to 10%, possibly accompanied by changes in network latency and compliance costs.
3. Comparing Platforms When the Same Model Has the Same Price
When comparing the same model across multiple cloud platforms neutrally, fix “one usage profile” and change only the billing rules for an apples-to-apples comparison:
| Comparison dimension | Platform A (first-party) | Platform B (cloud vendor) | Platform C (cloud vendor) | Platform D (aggregation platform) |
|---|---|---|---|---|
| Pay-as-you-go rate | Same | Same | Same | Same |
| Batch discount | Yes, 60% of standard price | Not stated on the page | Not stated on the page | Not stated on the page |
| Subscription / off-peak | None | None | None | Yes, includes off-peak rules |
| Free quota | None | None | 1M tokens for new models | None |
| Overseas region | Markup | ~10% markup | ~9% markup | Depends on the upstream provider |
Conclusion: if you do not pin a specific model version and rely mainly on pay-as-you-go, all four platforms are priced the same; for offline workloads, prefer the first-party platform with a batch discount; when you need to pin a specific version and rely mainly on real-time calls, a subscription plus pay-as-yougo overage may be 10% to 20% cheaper than pure pay-as-you-go; if you can shift part of the calls to off-peak hours, savings can approach 50%; and if your workload already runs on a given cloud, connecting nearby costs the same as the first-party platform while avoiding cross-network transfer and operations costs.
4. An Actionable Decision Workflow
1. Measure input/output/cache hit ratio and peak/off-peak distribution over the last 30 days2. Output share > 40% → prioritize compressing output and prompt redundancy3. Deferrable tasks exist → route them through the batch channel for the discount4. Real-time calls are stable and volume is predictable → evaluate subscription + pay-as-you-go overage5. A clear nighttime trough exists → schedule batch traffic into off-peak hours6. The workload already runs on a cloud → connect nearby and avoid the cross-region factor
5. Illustrative Cost Calculation Code
def monthly_cost(in_tok, out_tok, hit_ratio,in_price=20, hit_price=2, out_price=100,batch_ratio=0.0, batch_discount=0.6,free_quota=0, region_factor=1.0):hit = in_tok * hit_ratiomiss = in_tok - hitcost = miss * in_price + hit * hit_price + out_tok * out_pricecost *= (1 - batch_ratio) + batch_ratio * batch_discountcost = max(0, cost - free_quota)return cost * region_factor
Plug the same usage profile into three rule sets—“pure pay-as-you-go,” “with batch,” and “with subscription and off-peak”—to quantify the gap instead of choosing a platform by feel.
6. Common Pitfalls and Engineering Recommendations
- Looking only at unit price: ignoring the output share and cache hit rate distorts the bill.
- Unstable prefix: frequently changing the system prompt causes repeated cache writes, which costs more than it saves.
- Overlooking version retirement: older model versions may stop being available to new users and are scheduled for retirement, so design a switchable abstraction layer in advance.
- Cross-region calls: overseas nodes carry a price markup and higher latency; avoid them unless compliance requires it.
- Lack of observability: connect logging services and monitoring alerts, tag token consumption by business dimension, and build a cost dashboard.
7. Implementation on Baidu AI Cloud
On Baidu AI Cloud, model calls can be consolidated into an access layer, with object storage holding datasets, a message queue for peak shaving, and a container platform running batch workloads, while monitoring alerts provide trend warnings for token consumption and cost. With a unified model abstraction interface, the business side programs only against generic capabilities, so no business code changes are needed when billing rules change—yielding more controllable and lower monthly spending at the same usage level.
