Why LLM API Bills Can Differ by 2x at the Same Token Price
Many teams compare LLM API costs by looking only at the price per million tokens. This article explains why identical per-token pricing can still produce nearly 2x different monthly bills, and breaks the bill down into six calculable variables: input tokens, output tokens, cache-hit tokens, cache-write tokens, batch (offline) token ratio, and subscription quota versus overage. It includes a cost estimation model, a four-quadrant attribution framework, and practical guidance on prefix caching, batch processing, subscription plans, off-peak scheduling, model tiering, regional pricing, and free credits, plus a deployment checklist for building a cost observability system.
1. The Problem: Same Unit Price, Different Bills
When evaluating LLM API costs, most teams start by comparing the price per million tokens. But when several platforms quote exactly the same pay-as-you-go price for the same model, that comparison loses its discriminating power, while actual monthly bills can still differ by nearly 2x. The reason is not mysterious: a bill is not a linear mapping of the unit price, but the product of unit price × billing basis × call structure × billing rules. What really drives the gap is usually a few rules that never appear in the price table.
Attributing bill differences to the unit price is a classic case of metric mismatch. The unit price is a scalar; the bill is an integral. The same scalar can produce completely different results along different integration paths. So the first step in cost governance is to stop looking for “the cheapest provider” and start calculating your own call structure.
2. Cost Model: Breaking the Bill into Computable Terms
A practical estimation model includes at least six variables: input tokens, output tokens, cache-hit tokens, cache-write tokens, batch (offline) token ratio, and subscription quota plus overage. An illustrative implementation:
def estimate(input_tok, output_tok, cache_hit, cache_write,batch_ratio, p_in, p_out, p_hit, p_write,batch_discount=0.6, plan_quota=0, plan_fee=0):# Online portiononline_in = input_tok * (1 - batch_ratio)online_out = output_tok * (1 - batch_ratio)cost_online = (online_in * p_in + online_out * p_out+ cache_hit * p_hit + cache_write * p_write)# Offline batch portion (usually discounted from the standard price)cost_batch = (online_in + online_out) * batch_ratio * batch_discount# Subscription: deduct the quota first, then bill overage at pay-as-you-go ratesraw = cost_online + cost_batchcovered = min(raw, plan_quota)overage = max(raw - plan_quota, 0)return plan_fee + covered + overage
The value of this model is that it turns “it feels more expensive” into “which variable changed.” When a bill doubles, you can almost always trace it to one of three causes: a drop in batch_ratio, cache_hit falling to zero, or the subscription quota being punched through by overage.
3. Four-Quadrant Attribution: Only Two Rules Create the Gap
Dividing the factors by “controllable or not” and “written in the unit price table or not” yields a clear four-quadrant view:
- Unit price: identical across providers, not a source of difference, and “uncontrollable with no discriminating power.”
- Billing basis: cache-hit price, whether cache writes are billed separately, and how long cache entries stay valid. This is “semi-controllable” and determined by how you call the API.
- Batch rules: whether offline jobs get a discount off the standard price, the discount ratio, and whether asynchronous submission is required. This is “controllable and high-leverage.”
- Subscription and off-peak rules: whether a plan covers the model, whether off-peak windows exist, and how overage is billed. Also “controllable and high-leverage.”
The conclusion is straightforward: since the unit-price quadrant produces no difference, all optimization effort should go into the latter two quadrants. This is also why “same usage, different bill” is not a contradiction: the usage is the same, but where it lands is different.
4. Caching: The Most Overlooked Lever
Prefix caching is usually billed like this: a repeated prefix automatically activates the cache, the hit portion is charged at a price significantly lower than the input price, and the miss portion is charged at the standard input price. Cache writes may be billed separately based on validity duration, with longer validity costing more to write. This leads to three practical rules:
- Keep the system prompt, tool definitions, and few-shot examples stable and placed at the front to maximize prefix reuse.
- Put volatile content (timestamps, user IDs, random numbers) at the end so it does not pollute the prefix and invalidate the cache.
- Have batch sessions share the same prefix, and choose a shorter validity duration based on business peaks to reduce wasted writes.
A counterintuitive conclusion: caching does not automatically save money once enabled. If request prefixes are highly fragmented and the reuse interval exceeds the validity duration, write costs will exceed hit savings, and disabling long-validity caching is actually cheaper.
5. Batch Processing and Subscriptions: Two Rules Decide Half the Bill
Batch processing suits tasks that can be delayed and run asynchronously without second-level response requirements, such as log classification, offline labeling, batch summarization, and data cleaning. The cost is that latency shifts from seconds to minutes or hours, so it should only carry “waitable” traffic.
A subscription plan trades prepayment for a discount, and the risk is that overage is still billed pay-as-you-go. The decision rule can be written as:
# If average monthly online cost is close to or slightly below the plan quota, the plan is betterif monthly_online_cost <= plan_quota * 0.9:use_plan = Trueelse:use_plan = False # With too much overage, pay-as-you-go is more controllable
Layer on off-peak scheduling: concentrating deferrable calls into nighttime or low-traffic windows can significantly reduce effective cost. In engineering terms, this only requires a priority queue plus a time-window check:
if task.deferrable and now.hour >= 18:submit(task, tier="offpeak")else:submit(task, tier="realtime")
6. Model Selection: Do Not Lock Into the Flagship
The unit price of a flagship model is often several times that of the next tier down, yet most business tasks (classification, extraction, formatting, short-text rewriting) do not need flagship capability. A reasonable strategy is to build a capability-cost tier: default to the cost-effective model, upgrade to the flagship only for complex reasoning or long-chain tool calls, and use an evaluation set to regression-test whether the downgrade is acceptable. Also watch the retirement timeline for older models and complete migration ahead of time to avoid emergency rework and traffic jitter during the shutdown window.
7. Region and Free Credits: Two Small but Certain Differences
The same model may carry a small price markup in different regions, and cross-border calls add latency and compliance costs. New models often come with a one-time free credit at launch, suitable for load testing and migration validation, but it should not be counted in the long-term budget baseline. These amounts are small, yet they often cause “the numbers don’t reconcile” confusion during monthly reconciliation, so list them separately on the cost dashboard.
8. Deployment Checklist
- Build a daily-granularity cost dashboard with dimensions including model, business line, cache hit rate, and batch ratio.
- Tag each task type as “deferrable/non-deferrable,” and route deferrable traffic to the offline channel by default.
- Refactor prompts with fixed prefixes, monitor hit-rate changes, and set alert thresholds.
- Recalculate the break-even point between subscription and pay-as-you-go every quarter, and adjust the quota dynamically.
- Establish model tiering and a downgrade evaluation set to avoid capability regression.
- During reconciliation, check all three field types: unit price, billing basis, and rules, rather than only the unit price.
9. Conclusion
When unit prices converge, cost competitiveness shifts from procurement negotiation to call architecture. Only by breaking the bill into variables, mapping variables to rules, and applying rules to scheduling and prompt design can the monthly bill’s fluctuation range be truly controlled. If your business already runs on Baidu AI Cloud, you can apply the model and tiering strategy above directly, and build a cost observability system with monitoring, alerting, and logging services for nearby access and unified governance.
