Why LLM API Bills Can Differ by Nearly 2x for the Same Usage
A practical framework for understanding LLM API pricing: why per-token rates are only one factor, how to profile your own usage, and how batch processing, subscriptions, caching, model deprecation, and region-related charges shape the final bill. Includes an estimation script and a decision checklist for routing each type of traffic to the right pricing channel.
1. The Problem Is Not the Unit Price, It Is the Pricing Structure
Running the same business workload on different platforms and ending up with monthly bills that differ by nearly 2x is a common phenomenon in platform engineering and cost governance. When evaluating options, many teams compare only “how much per million tokens,” overlooking a basic fact: the unit price is just one factor in the pricing formula. What actually determines the bill is the complete pricing structure.
Abstract the bill as a function and you get:
monthly cost = Σ(request type × corresponding unit price × token volume)+ cache write/storage charges+ subscription or resource package fees+ overage charged at on-demand rates+ region/network-related add-ons- free quota and discount credits
As long as all providers keep the same on-demand unit price, the entire difference must come from the remaining items. This matches the original observation: four platforms had identical published on-demand rates, and the price gap came only from two rules, batch processing and subscriptions. So the right thing to compare is not a price sheet, but the combination of “pricing structure + your own usage profile.”
2. Quantify Your Usage Profile Before Choosing
Talking about cost without a usage profile is meaningless. Collect at least the following dimensions over a full business cycle (usually a calendar month), and distinguish weekdays from weekends:
- Input/output token ratio: output tokens usually cost significantly more than input tokens, so every 10 percentage point increase in the output share noticeably amplifies total cost.
- Request time distribution: real-time interactions cluster during the day, while offline batch jobs can be scheduled freely. This is the dividing line for whether off-peak discounts are usable.
- Prefix repetition rate: whether system prompts, tool definitions, and few-shot examples are reused consistently determines the cache hit rate.
- Context length distribution: long-context requests amplify both input tokens and cache write costs at the same time.
- Failure retry rate: retries are a hidden cost; timeouts and rate limiting make billed tokens higher than the tokens that actually do useful work.
A reusable estimation script (illustrative, unit: currency per million tokens):
def estimate(volume, price, cache_hit=0.0, batch_ratio=0.0, batch_discount=0.4):in_t, cache_t, out_t = volume # million tokensbase = in_t * price[0] + cache_t * price[1] + out_t * price[2]batchable = base * batch_ratioreturn base - batchable * batch_discount
Here batch_discount is the discount that batch processing gives relative to the standard price. Always follow the rules published by your chosen platform for the current period, and do not hardcode unverified numbers in the code.
3. Two Rules Account for Half of the Gap
3.1 Batch Processing: Discounting Calls That Are Not Urgent
The essence of batch mode is “trading latency for price”: requests enter an asynchronous queue, are completed during the platform’s off-peak hours, and are charged at a discount off the standard price. It fits scenarios that do not need second-level responses, such as log summarization, offline labeling, bulk translation, data cleaning, and evaluation regression.
Implementation notes:
- Only traffic that can be made asynchronous gets the discount; mistakenly routing a real-time path through batch directly hurts user experience.
- Batch throughput is constrained by quotas, so plan capacity for queue backlog and completion deadlines.
- Results are usually retrieved asynchronously, so design callbacks or polling, idempotency keys, and resume-from-checkpoint behavior.
3.2 Subscriptions and Resource Packages: Trading Deterministic Spend for Lower Marginal Cost
The logic of a subscription (such as the various token packages) is to prepay a fixed fee in exchange for a token quota pool. Within the quota, marginal cost drops sharply; beyond it, usage returns to on-demand rates. This fits always-on workloads with stable, predictable call volume.
To decide whether a subscription is worthwhile, use a break-even approach:
subscription is better ⟺ monthly on-demand cost > subscription fee + overage tokens × on-demand unit price
If the business has clear peaks and troughs, buying too large a quota is a waste, while buying too small a quota lets the overage cancel out the benefit. Also check whether the package is limited to certain models and whether it includes off-peak (nighttime/low-traffic) rules. Such rules can push down the price of “schedulable portions” further, and are one of the main sources of an amplified bill gap.
4. Three Frequently Overlooked Cost Items
- Automatic cache billing and write costs. Most platforms automatically enable caching for stable repeated prefixes and set a default expiration time. The hit portion is billed at a significantly lower hit price, but a cache write on a miss may be charged separately, and different expiration durations come with different prices. If the prefix changes slightly and frequently, you get pure loss from “written but not hit.” Keep system prompts, tool schemas, and fixed examples at the front and freeze their versions, then track the hit rate:
hit rate = hit tokens / (hit tokens + missed prefix tokens)
Model generation retirement. It is the industry norm for older-generation models to stop opening to new users and to be gradually taken offline. Migration itself carries regression testing and prompt tuning costs, so schedule it a quarter ahead rather than waiting until calls start failing.
Region and compliance add-ons. The same model may cost more in a non-primary region (such as an overseas node), with cross-border transfer and compliance assessment costs stacked on top. Data residency requirements are often more decisive than the unit price difference.
5. Decision Checklist
- Do not lock yourself to a specific model generation: keep a model abstraction layer, route by capability, and preserve room to switch.
- Purely offline tasks: prefer the asynchronous batch channel.
- Real-time with stable call volume: use subscription plus on-demand overage, and schedule deferrable traffic into off-peak windows.
- Workloads already on a given cloud: connect to that vendor’s model service nearby to save network and operations costs, with fees consistent with general on-demand pricing.
- Validate every conclusion by replaying your own usage, rather than trusting any unit price comparison sheet.
On the Baidu AI Cloud Qianfan large model platform, the same framework can be applied: use a unified model invocation abstraction to hide generation differences, use batch processing for offline tasks, and use monitoring, alerting, and logging services to continuously collect token and hit-rate metrics, turning cost from something you only learn at month end into something attributable every day. The end goal of cost optimization is not finding the cheapest provider, but making every type of traffic land in the pricing channel where it belongs.
