Why LLM API Bills Can Differ by Nearly 2x on the Same Token Usage
A practical breakdown of how LLM API billing actually works. Identical per-token list prices can still produce very different monthly bills because usage structure, discount channels, caching rules, and call timing all change the final amount. The article walks through a computable cost model, batch processing, subscriptions and token packages, prompt caching, region and model-version effects, a reusable measurement method, and four cost-governance levers.
1. Where the Problem Starts: Same Unit Prices, Different Bills
When teams evaluate LLM API costs, the first instinct is usually to build a unit-price comparison table and check each provider’s per-million-token input price, cache-hit price, and output price line by line. The result is often confusing: list prices across mainstream platforms are highly converged, sometimes identical, yet the real monthly bill can differ by close to 2x.
The reason is not mysterious. Unit price is only a coefficient in the billing formula. What actually determines the amount is three variables: usage structure (the share of each token type), billing rules (whether discount channels exist), and call-time distribution (whether off-peak discounts apply). Once competition flattens the coefficients, differences inevitably reappear at the rules layer and the time layer.
One neutral premise needs to be stated up front: prices across vendors, regions, and model versions can change at any time. This article cites no specific brand and no specific quote; it discusses only the structural patterns of the billing model itself. When you put this into practice, rely on the current pricing page of whichever platform you choose.
2. Turning the Bill into a Computable Model
The cost of any single LLM call can be abstracted as:
cost_per_call = input_tokens × P_in+ cache_hit_tokens × P_cache+ cache_write_tokens × P_write+ output_tokens × P_outmonthly_bill = Σ(cost_per_call) × (1 - discount_rate) × offpeak_factor
Here P_in is the standard input price, P_cache the cache-hit price (usually well below standard input), P_write the cache-write price, and P_out the output price (typically the highest of the four).
This formula explains three common mistakes:
- Choosing a platform on input price alone. Output tokens are not a small share for most workloads, and the weight of the output price is often underestimated.
- Ignoring cache hits. Calls with long system prompts, long documents, or a fixed few-shot prefix can have a repeated prefix that exceeds 70% of total input.
- Ignoring time distribution. If an explicit off-peak discount exists, moving deferrable tasks into the off-peak window is equivalent to discounting that portion of usage.
3. Two Rules That Actually Open Up the Gap
3.1 The Batch Channel: Trading Latency for Price
Batch processing (offline asynchronous inference) is a widely available capability: after a request is submitted, an immediate response is not required, the platform schedules it on spare capacity, and the price is usually charged at a certain percentage of the standard rate. It fits log analysis, content moderation, batch summarization, offline labeling, and data cleaning.
The engineering point is that batch processing is not turning a synchronous call into a loop; it requires supporting changes:
# Pseudocode: batch submission and result retrieval for offline jobsjob = batch_client.submit(model="chat-model",input_file="dataset.jsonl", # one request body per linecompletion_window="24h", # maximum allowed wait window)status = batch_client.wait(job.id, timeout=...)if status.succeeded:for line in batch_client.download_output(job.id):yield json.loads(line) # results align back to the business key by line
Three things must be handled: first, the result file needs idempotent write-back keyed by the business primary key to avoid duplicate consumption; second, retries may occur within the wait window, so job design must be re-entrant; third, batch processing is unsuitable for paths with interactive latency requirements.
3.2 Subscriptions and Token Packages: Trading Commitment for Discounts
Another common rule is the subscription or token package: you buy a token quota for a period in advance at a unit price below on-demand, and once the quota is exhausted, billing switches to on-demand (“overage at on-demand rates”). The key to this rule is not the discount rate but how well the quota matches real usage.
The test is simple: run a percentile analysis on historical usage.
If P95(monthly usage) ≤ package quota, and mean / quota ≥ 0.7 → subscription is cheaperIf usage is volatile and peaks far above the mean → on-demand is saferIf usage stays below 30% of the quota long term → capacity sits idle, equal to a price increase
The hidden cost of subscriptions is loss of elasticity: buy too much quota and it is wasted; buy too little and you pay the overage price to cover it. Subscriptions therefore suit steady, always-on workloads rather than campaign-driven ones with obvious spikes.
4. Caching: The Most Easily Missed Price Tier
Cache billing is almost the second-largest source of bill differences. The general mechanism: repeated prefix content is automatically reused, the hit portion is billed at the hit price, the missed portion at the standard input price; writing to the cache may be billed separately and is subject to a time-to-live (TTL) constraint.
Practical recommendations:
- Put stable prefixes first. Place the system prompt, tool definitions, and fixed knowledge-base passages at the very front of the prompt, and keep them byte-level stable; avoid inserting timestamps or random IDs.
- Control TTL and call cadence. If call intervals are generally longer than the cache lifetime, the cache will almost never hit, and you pay the write cost for nothing.
- Verify with observable metrics. Count hit and missed tokens separately; a sudden drop in hit rate usually means the prefix has been polluted by some dynamic field.
[Stable prefix: system prompt + tool schema + fixed knowledge snippets] ← aim for hits[Semi-stable segment: conversation summary] ← change cautiously[Dynamic segment: current user input, timestamps] ← keep last
5. Region and Version: Two Silent Surcharges
The first is region. The same model may be priced differently across regional nodes; cross-border or remote regions are often more expensive and add network latency and compliance costs. Nearby access is an optimization for both cost and latency.
The second is the model version lifecycle. Older model versions go through a process of “stop opening to new users — restrict new users — planned retirement,” and vendors typically recommend migrating to the new version. If a workload hard-codes the model name in configuration, the retirement window becomes an emergency refactor. Recommended practice:
- Make the model identifier configurable, injected through a config center or environment variables, not hard-coded in business code;
- Maintain a version ledger recording the current version, the replacement version, and the retirement date;
- Abstract a model adapter layer that hides differences in parameters and response structures across versions.
# Example: configurable model and routing settingsmodel:primary: "chat-model-pro"fallback: "chat-model-lite"params:temperature: 0.3max_output_tokens: 1024routing:offline_batch: true # offline jobs go through batchregion: "nearest" # nearby access
6. A Reusable Cost Estimation Method
Do not pick a platform on gut feeling; use data. The steps are fixed:
- Sample. Instrument calls to record input, cache-hit, and output token counts plus timestamps, sampling for a week or more.
- Categorize. Tag by workload type: real-time interactive, near-real-time, offline batch.
- Apply the formula. Using the billing model above, plug in three combinations: “pure on-demand,” “batch + on-demand,” and “subscription + overage on-demand.”
- Run sensitivity analysis. Focus on two variables, output price and cache hit rate; move each up and down by 20% and see whether the conclusion flips.
- Decide and review. After launch, compare predicted values with the actual bill monthly; if the deviation exceeds a threshold, go back to step 1.
An illustrative measurement query:
-- Usage structure breakdown for cost attributionSELECT scene,SUM(input_tokens) AS in_tok,SUM(cache_hit_tokens) AS hit_tok,SUM(output_tokens) AS out_tok,SUM(CASE WHEN ts BETWEEN '18:00' AND '24:00' THEN 1 ELSE 0 END) AS offpeak_callsFROM llm_call_logGROUP BY scene;
7. Four Levers for Cost Governance
- Structure lever: compress input. Deduplicate retrieved snippets, summarize conversation history, trim tool definitions — this directly cuts the highest-weight input item.
- Cache lever: raise the hit rate. Stable prefixes, sensible TTL, no dynamic-field pollution.
- Channel lever: tiered scheduling. Real-time paths go on-demand, deferrable paths go batch, steady always-on load considers a subscription.
- Model lever: tiered selection. Push simple tasks down to lightweight models and reserve high-capability versions for complex tasks, avoiding “everything on the large model.”
In multi-cloud or multi-endpoint environments, “billing semantics” should also be folded into a unified abstraction: normalize everything to tokens as the common unit of measure, hiding differences in metering granularity, cache rules, and discount forms across providers, so that横向 comparison becomes possible. In related practice, Baidu AI Cloud also generally recommends a unified metering and observability system as the foundation of cost governance, rather than relying on a single price table for decisions.
8. Conclusion
Converging unit prices are a sign of a maturing industry, and they also mean the battlefield for cost optimization has moved to the rules layer and the engineering layer. Three things truly determine the bill: whether usage structure is governed, whether the batch and subscription rules are used correctly, and whether call-time distribution aligns with discount windows. Turn these three into a sustainable monthly process and the bill gap under identical usage naturally converges; teams that only watch the price table, on the other hand, will keep paying close to twice as much for the same tokens.
