Why LLM API Bills Can Differ by 2x at the Same Unit Price
This article explains why two teams running similar workloads on the same model at the same unit price can end up with bills that differ by nearly double. It breaks down the four components of LLM API billing, examines unit pricing, prompt caching, batch processing, subscriptions, and off-peak scheduling, and presents a reusable cost decision workflow with a sample cost model. Readers will learn how to profile usage, compare strategies against the same workload, and continuously monitor cache hit rates, batch completion times, and plan utilization to keep API spending under control.
1. Same Unit Price, Different Bills
A recurring pattern shows up when enterprises deploy large language model applications: technical selection is finished, load testing has passed, but when the monthly bill arrives, two teams with comparable workloads find that their spending differs by nearly 2x. After investigation, it usually turns out that both teams call the same model specification at the same unit price. The gap does not come from “which provider is cheaper,” but from billing rules and how the API is called.
To understand this, start by breaking the bill apart. The cost of a single call typically consists of four parts:
Total cost = input tokens × input unit price+ output tokens × output unit price- cache-hit tokens × (input unit price - cache-hit unit price)+ cache-write tokens × write unit price± subscription credit and overage settlement
The first two terms are the “list prices” everyone looks at. The last three are where the real differences come from. Once pay-as-you-go unit prices across major platforms converge, the battleground for cost optimization shifts from price comparison to billing models and scheduling strategy.
2. What the Four Billing Factors Mean Technically
2.1 Unit Price: The Fastest Layer to Commoditize
Three-tier pricing for input, cache hits, and output has become an industry standard. The same model specification often carries the same price across different cloud platforms, which means comparing unit prices alone yields almost nothing. In engineering terms, treat unit price as a constant and leave the variables to call patterns.
2.2 Cache Billing: The Undervalued Cost Lever
Mainstream implementations automatically enable caching on the server side for repeated prefixes, with a default time-to-live (commonly on the order of minutes). The billing logic is: the hit portion is charged at a price significantly lower than the input price, the miss portion is billed normally, and the tokens written to the cache may be charged separately.
For workloads with highly repetitive prefixes—multi-turn conversations, long system prompts, fixed few-shot examples, and batch document summarization—the cache hit rate can determine more than half of the cost. Three practical points:
- Put stable content first and volatile content last.
- Control the context length per request so the prefix is not evicted frequently.
- Measure the write cost empirically rather than assuming “caching is always cheaper.”
# Prefix stability optimization examplemessages = [{"role": "system", "content": STABLE_PROMPT}, # Long and fixed, favorable for cache hits{"role": "system", "content": STABLE_FEW_SHOT}, # Fixed examples placed first{"role": "user", "content": request_text}, # Volatile content placed last]
2.3 Batch Channel: A Cost Low Point for Offline Tasks
Most platforms offer an asynchronous batch API that runs in a “submit job—poll or callback—fetch results” pattern. The cost is latency from minutes to hours; the reward is a unit price close to half. It fits workloads that do not require immediate responses, such as log classification, content moderation, offline labeling, batch translation, and rebuilding knowledge base indexes. On the engineering side, you need a job table, idempotency keys, failure retries, and object storage for results to manage throughput and cost together.
2.4 Subscriptions and Off-Peak Scheduling: Moving the Peak Away
Subscriptions (resource packages/token plans) are essentially trading committed usage for a discount, with usage beyond the commitment returning to pay-as-you-go settlement. Whether this pays off depends on how stable the usage is: stable workloads reap high discount benefits, while spiky workloads easily end up “the monthly plan is not enough, and pay-as-you-go is too expensive.” Paired with this is off-peak discounting, which offers lower prices during business troughs so that deferrable batch jobs can be scheduled to run overnight.
3. A Reusable Cost Decision Workflow
Step 1: Build a usage profile. Count requests per day, average input and output length, prefix repetition rate, and peak-to-trough ratio, then produce a list of the “share of deferrable tasks.”
Step 2: Build a cost model and plug different strategies into the same usage data for comparison:
def monthly_cost(reqs, price, batch_ratio=0.0, batch_discount=0.5,cache_hit_ratio=0.0, cache_price_ratio=0.1,plan_tokens=0, plan_price=0):billable = 0.0for r in reqs:inb, outb = r.input_tokens, r.output_tokenshit = inb * cache_hit_ratioinb -= hitunit_in, unit_out = price.inp, price.outif r.deferrable:unit_in *= (1 - batch_ratio * (1 - batch_discount))unit_out *= (1 - batch_ratio * (1 - batch_discount))billable += inb * unit_in + hit * unit_in * cache_price_ratio + outb * unit_outreturn max(0.0, billable - plan_tokens) * 1.0 + plan_price
Step 3: Choose a combination based on the “deferrable ratio” and “peak concentration.” If there are many deferrable tasks, use batch processing. If the load is steady and predictable, add a subscription. If both apply, use the subscription to cover the baseline, batch processing to absorb the remainder, and off-peak windows to shave the peaks.
Step 4: Verify continuously. Cache hit rate, batch completion time, and subscription quota utilization should all feed into monitoring, alerting, and logging services, with a weekly review, because usage structure drifts as the business changes.
4. Three Easily Overlooked Rules
First, caching is not zero cost. The write side may be billed separately, and the time-to-live is limited, so load testing is needed to confirm the net benefit.
Second, consider the retirement schedule for older model specifications. There is usually a two-stage arrangement of “stop new onboarding—complete shutdown.” Start migration assessment a quarter ahead, and abstract model identifiers at the gateway layer to avoid scattered hardcoding in business code.
Third, account for regional differences. Cross-region deployment usually raises both price and network latency at the same time, so connecting to the nearest region saves both money and latency.
5. Implementation Notes on Baidu AI Cloud
The methods above also apply on the Qianfan large model platform from Baidu AI Cloud: use a unified gateway to hide model identifier differences, fix stable prefixes as system prompts, route offline tasks to the batch channel, put predictable baseline usage into resource packages, and then use monitoring, alerting, and logging services to close the loop on cache hit rate, quota utilization, and peak-to-trough distribution. Note that specific discount ratios, free quotas, and regional prices should be based on real-time information on the official pricing page. Keeping the architecture replaceable is what prevents you from being locked in by a single billing rule.
