Same Token Price, Half the Bill: How LLM API Call Paths Drive Monthly Costs
Two LLM API setups with identical per-token prices can produce very different monthly bills. This article explains how context construction, caching, batch processing, subscriptions, retries, and output length affect real costs. It also provides a cost model you can reconcile against invoices and metrics for comparing options.
1. Unit Price Is Only the Starting Point, the Full Call Path Determines the Bill
When evaluating LLM API costs, the most common approach is to compare the price per million input tokens with the price per million output tokens. This works for an initial shortlist, but it is not enough to predict monthly spending in production.
Even two services with exactly the same base prices can produce different bills. A business does not buy abstract tokens. It buys a processing pipeline that includes context construction, model inference, output validation, failed-request retries, and logging.
Consider the same document analysis task. One implementation sends the full document every time, while another sends only the necessary paragraphs. One resubmits a fixed prefix, while another uses caching effectively. One must return results immediately, while another accepts delayed delivery. These differences do not appear in the most visible input and output prices, but they change the billed quantities and the rates that apply.
Comparing costs therefore requires answering at least three questions:
- Is the billed object consistent? Does the input include chat history, tool descriptions, and retrieved content? Does the output carry any other separately metered items?
- Are the discount conditions actually met? Did the cache hit? Does the batch job meet the requirements? Does the subscription cover the target calls?
- Are the business results equivalent? Does a lower bill come at the cost of lower quality, longer waits, or a higher failure rate?
A bill comparison is only meaningful when task quality and service requirements are broadly the same.
2. Build a Cost Model You Can Reconcile
The cost for a billing period can be summarized as:
Total cost = model call cost + cache surcharges + supporting resource costs + fixed subscription fees − applicable deductions.
Model call costs should be further split by call mode, region, model version, and similar dimensions. For requests under one consistent billing scheme, use:
Call cost = cache-miss input × miss input price + cache-hit input × hit input price + output × output price.
Two assumptions matter here.
First, token counts must match the unit of the price. If prices are quoted per million tokens, convert call volumes to millions of tokens first to avoid order-of-magnitude errors.
Second, billing items must either be mutually exclusive or stack according to explicit rules. For example, cache writes may be billed separately, or they may have a defined relationship with input fees. Do not add every line item together mechanically without verifying the rules.
Maintain a cost ledger like the one below:
| Cost category | What to record | Common pitfall |
|---|---|---|
| Input cost | Total input volume, cache-miss volume, cache-hit volume | Pricing all input at the low rate |
| Output cost | Actual generated volume, generated volume of discarded results | Counting only the content shown to users |
| Cache cost | Write volume, validity period, retention or storage fees | Seeing the hit discount but ignoring maintenance costs |
| Batch cost | Eligible task volume, applicable rate, completion deadline | Assuming every call qualifies for the discount |
| Subscription cost | Fixed fee, quota, overage rules | Treating unused quota as savings already realized |
| Supporting resources | Storage, network, logs, compute | Looking only at the model API invoice |
| Deductions | Validity period, scope, deduction order | Projecting long-term costs from short-term promotions |
This ledger turns advertised prices into a calculation you can check against the invoice.
3. Whether Caching Saves Money Depends on Whether Repeated Content Can Be Reused
1. Repeated Input Does Not Guarantee a Hit
Fixed prompts, rule descriptions, long documents, and tool definitions often repeat in LLM workloads. This content may be worth caching.
Caching mechanisms differ, however. Some match repeated prefixes, some require explicitly managed cache objects, and some impose minimum lengths, expiration times, or other limits. It is wrong to assume that text seen once will be cheaper the next time.
When engineering for caching, check:
- whether reusable content stays stable;
- whether dynamic fields such as timestamps and random IDs are placed after the fixed content;
- whether repeat requests fall within the validity period;
- whether requests use the same model, version, and cache scope;
- whether the metering data actually shows cache-hit tokens.
For prefix-matching mechanisms, placing stable content first and dynamic content last usually improves reuse. This is a structural optimization, not a guarantee that any service will behave the same way.
2. Calculate the Hit Rate by Token Volume
Let the regular input price be (P_u), the cache-hit price be (P_h), and the hit rate by input tokens be (h). Ignoring write and retention fees, the average input price is:
Average input price = (1 − h) × P_u + h × P_h.
Suppose the hit price is one tenth of the regular input price and the hit rate reaches 80%. The average input cost is then 28% of the all-miss cost, so the input portion falls by 72%.
That does not mean the total bill falls by 72%. If input fees made up only 30% of total cost, the theoretical reduction in total cost would be 21.6%, before cache surcharges.
3. Set Retention Periods Based on Reuse Intervals
A longer cache lifetime may create more hit opportunities, but it may also add maintenance costs. Content reused frequently in short bursts is a good candidate for caching. Content used once a day may not justify long retention.
The test is:
Is the input saving from caching greater than the cost of writes, retention, and management?
Answer this with real traffic distribution, not by comparing hit prices alone.
4. How a Halved Bill Happens: A Reproducible Hypothetical
The following figures only illustrate cost mechanics. They do not correspond to any actual product price or service commitment.
Assume monthly usage of:
- total input: 100 million tokens;
- total output: 10 million tokens;
- regular input price: 20 yuan per million tokens;
- cache-hit input price: 2 yuan per million tokens;
- output price: 100 yuan per million tokens.
Scenario 1: All real-time calls, no caching
Input cost: 100 × 20 = 2,000 yuan.
Output cost: 10 × 100 = 1,000 yuan.
Total model call cost: 3,000 yuan.
Scenario 2: 60% of input hits the cache
Cache
