LLM Billing: Why Monthly Bills Can Differ by Up to 50% at the Same Unit Price
This article explains why LLM monthly bills can diverge even when pay-as-you-go unit prices match. It breaks token usage into input, cache-hit, cache-write, and output costs; compares batch offline discounts, subscription plus overage, cache billing, and time-of-day rules; provides a break-even formula and a sample Python cost model; and outlines practical steps for task tiering, cache-prefix design, and migration planning.
1. Same Unit Price, Different Bills
The pay-as-you-go unit price for the same model is often identical across cloud platforms. Model providers usually publish a uniform list price, and platforms settle bills against the same price list. If you compare only unit prices, choosing one platform or another may look roughly equivalent.
The real cost gap comes from billing rules that platforms design outside the list price, mainly:
- Batch offline discounts: Trading latency for a lower price, suitable for tasks that do not need immediate results.
- Subscription plans: Trading committed usage for a fixed fee or extra discounts, with overage billed pay-as-you-go.
- Free allowances: New models or new users may receive a certain volume free, affecting early-stage costs.
- Cache billing: Repeated input prefixes that are reused are settled at a lower unit price.
- Time-of-day rules: Some platforms apply different prices to idle or low-peak periods.
Therefore, the first step in cost optimization is not to compare price tables, but to break down billing rules one by one and then plug in your real usage.
2. Break the Bill into Calculable Dimensions
LLM inference is generally billed by tokens, usually per million tokens. The cost of a single call can be broken into the following parts:
- Input tokens: System instructions, conversation history, retrieved documents, and user questions.
- Cache-hit tokens: The portion of an input prefix that matches a previous request and is reused by the server, usually at a noticeably lower unit price than ordinary input.
- Cache writes: The first time a prefix is written to cache, it may be billed separately, and the write price may be higher than ordinary input.
- Output tokens: Content generated by the model, usually at the highest unit price.
The following demo numbers illustrate the calculation. Assume a model’s pay-as-you-go prices are: input 10 CNY, cache hit 1 CNY, and output 50 CNY, all per million tokens. These numbers are for demonstration only; actual prices should be taken from each platform’s pricing page.
A business has monthly usage of: 20 million non-cached input tokens, 80 million cache-hit tokens, and 5 million output tokens. The pay-as-you-go cost is:
- Input: 20M × 10 CNY/M = 200 CNY
- Cache hit: 80M × 1 CNY/M = 80 CNY
- Output: 5M × 50 CNY/M = 250 CNY
- Total: 530 CNY
Output tokens are the smallest share by token count, yet they account for nearly half the cost. This shows that optimizing output length and output structure is often more effective than reducing input.
3. Batch Offline Billing: Trade Latency for Unit Price
Batch billing works by accepting longer response times in exchange for a lower unit price. It fits scenarios such as:
- Batch classification, tagging, and summarization of historical data.
- Nightly report generation and non-real-time parts of content moderation.
- Offline preprocessing before vectorizing a knowledge base.
To decide whether a task can use batch billing, ask three questions: Must results return within seconds? Can the task be submitted in batches? Can failures be retried as a whole batch? If all three answers are no, the task is usually suitable for batch processing.
Using the example above, if all usage can be submitted in batch and the batch discount is 50%, the cost becomes:
530 CNY × (1 - 1.0 × 0.5) = 265 CNY
If only 40% of usage can be batched, the cost is:
530 CNY × (1 - 0.4 × 0.5) = 424 CNY
Batch processing also requires attention to task splitting and result collection. Before submission, design for idempotency so that resubmitting the same batch does not create duplicate data.
4. Subscription Plus Overage: Commit Usage for a Discount
A typical subscription structure is: pay a fixed monthly fee for a certain quota, and pay for usage above the quota on a pay-as-you-go basis. Its cost function can be written as:
- Subscription total cost = fixed fee + max(0, actual usage − plan quota) × overage unit price
To judge whether a subscription is worthwhile, find the break-even point. Let the pay-as-you-go unit price be p, the overage unit price be q, the fixed fee be F, the plan quota be Q, and actual usage be T (all in million tokens). When p > q and T exceeds Q, the break-even point satisfies:
T* = (F − Q × q) / (p − q)
If expected usage is below the break-even point, pay-as-you-go is cheaper. If usage is consistently above the break-even point, the subscription is cheaper. The following script can help teams compare options during modeling:
# Unit: CNY per million tokens; numbers are for demonstration onlyPAYG = {"input": 10.0, "cache_hit": 1.0, "output": 50.0}def payg_cost(usage: dict, price: dict = PAYG) -> float:"""Pay-as-you-go: multiply usage in each dimension by its unit price and sum."""return sum(usage[k] * price[k] for k in price)def batch_cost(usage: dict, batch_ratio: float,batch_discount: float = 0.5) -> float:"""Batch billing: batch_ratio is the share of usage that can be batched."""base = payg_cost(usage)return base * (1 - batch_ratio * batch_discount)def subscription_cost(total_m: float, fee: float,quota_m: float, overage_price: float) -> float:"""Subscription plus overage: total_m is total usage in million tokens."""overage = max(0.0, total_m - quota_m)return fee + overage * overage_priceif __name__ == "__main__":usage = {"input": 20, "cache_hit": 80, "output": 5}total = sum(usage.values())print("Pay-as-you-go:", payg_cost(usage))print("Batch (all):", batch_cost(usage, batch_ratio=1.0))print("Subscription (demo parameters):", subscription_cost(total, fee=300,quota_m=60, overage_price=8))
The most common problem with subscriptions is unused quota. If plan quota sits idle for a long time, actual spending may exceed pay-as-you-go. Before signing, simulate with at least the past three months of usage data and account for business growth trends.
5. Cache Billing: The Hidden Cost of Repeated Prefixes
Cache billing depends on one prerequisite: the beginning of multiple requests must be exactly the same. When the server identifies an identical prefix, it can reuse the previous computation and settle the request at the cache-hit price.
In practice, three points are key to improving cache hit rates:
- Put fixed content first: Place system instructions, role settings, and fixed examples at the beginning of the request, and put dynamic content such as user questions at the end.
- Avoid meaningless variation: For example, inserting a timestamp or random ID into system instructions makes the prefix different every time, so the cache cannot hit.
- Use consistent request templates: Keep the request structure for the same business consistent to make cache reuse easier.
Cache also has a time-to-live (TTL) issue. A longer TTL keeps the cache alive longer, but the write cost may be higher. A shorter TTL reduces write cost, but the cache expires once the request interval exceeds the TTL. Use the following judgment:
- If requests are dense and the interval is much shorter than the TTL, a short TTL is usually sufficient.
- If request intervals are longer but the same prefix is reused repeatedly, the write premium of a long TTL may need to be amortized by multiple later hits.
It is better to use logs to count reuse counts and request intervals for each prefix, then decide which TTL to use, rather than applying one global setting.
6. Time-of-Day Rules and Task Tiering
Some platforms apply different prices to calls at different times, or provide more resources during low-peak periods. The value of such rules depends on whether the business can shift load away from peak times.
Task tiering is the foundation for implementation. Business requests can be divided into three categories:
- Real-time tasks: Users wait for results in the interface, such as chat and instant search. These must use real-time calls and are usually not suitable for peak shifting.
- Near-real-time tasks: Minute-level latency is acceptable, such as email classification and ticket archiving. These can be queued and processed during low-peak periods.
- Offline tasks: Such as data cleaning and historical data backfilling. These are suitable for batch billing and idle-time windows.
After tiering, each tier can choose the most appropriate billing method. This is more cost-effective than adopting one model uniformly, and it is easier to monitor.
Time-of-day rules need to work with queues and scheduling systems. Teams should record task priority, deadlines, and retry counts in the queue, and let the scheduler decide when to submit requests according to time-of-day rules.
7. Cost Risks from Model Iteration and Retirement
Model versions change quickly. Old versions may stop being available to new users and may be retired at a later point. If a business depends heavily on an old version, migration costs may be underestimated.
Migration planning should focus on three considerations.
