Why LLM API Monthly Bills Differ by Half Even at the Same Unit Price

    Even when two LLM APIs charge the same per-token price, monthly bills can diverge by more than half. This article explains why. It breaks cost down into four token types—regular input, cache hits, cache writes, and output—and the billing modifiers that shape the final invoice: batch discounts, model-tier routing, cache TTL, retries, regions, and taxes. It works through four scenarios in which the bill falls from 90,000 to 26,300, quantifies five commonly underestimated cost amplifiers, and provides Python patterns for cost accounting, request structuring, and scheduling guards. It then reframes vendor selection around billing-rule fit rather than headline unit price, and closes with a four-step attribution method and observability practices. All prices are illustrative.

    Same Call Volume, Wildly Different Bills: Why?

    When choosing an LLM API, many teams assume: “Unit prices are close enough, so it doesn’t matter who we pick.” But once the month-end bill arrives, the same business scale and the same call volume can produce bills that differ by more than half. The cause is usually not the per-call price. It is the combined effect of cache hit rate, batch discounts, model routing, output-token share, cache writes, retry amplification, region, and taxes.

    In one line: bill = usage structure × unit price × billing-rule factors. Unit price only sets the price list; billing rules and usage structure determine the final amount. All prices in this article are illustrative, used to explain the calculation logic. Always rely on the latest official documentation of the platform you choose.

    The Bill Formula: Four Token Types and Billing Modifiers

    Four token types shape the cost structure

    A single LLM call is typically split into four token categories:

    • Regular input tokens: prompt content that does not hit the cache—for example, user messages and freshly retrieved documents.
    • Cache-hit tokens: the portion that matches a prefix already cached on the server, usually billed at a rate well below regular input.
    • Cache-write tokens: the portion written to the cache for the first time, or rebuilt after the cache expires. Some platforms tier this pricing by cache TTL.
    • Output tokens: model-generated content, usually the most expensive tier.

    So what drives the bill is not simply “how long the input is,” but “how many tokens land in the expensive tiers.”

    The cost of a single request can be written as:

    1. C = (N_in - N_cache - N_write) × P_in / 1,000,000
    2. + N_cache × P_cache / 1,000,000
    3. + N_write × P_write / 1,000,000
    4. + N_out × P_out / 1,000,000

    where:

    • N_in: total input under the platform’s billing convention;
    • N_cache: number of cache-hit tokens;
    • N_write: number of cache-write tokens;
    • N_out: number of output tokens;
    • P_in: regular input unit price;
    • P_cache: cache-hit unit price;
    • P_write: cache-write unit price;
    • P_out: output unit price.

    The monthly bill can then be written as:

    1. monthly bill = Σ per-request cost × batch discount factor × region/tax factor − free-quota deduction

    Model tiers: routing often matters more than the provider

    A single platform usually offers several model tiers: flagship, balanced, lightweight, or code-oriented. The price gap between tiers is often larger than the price gap for the same model across different platforms.

    Model tier (illustrative) Input price Cache-hit price Output price
    Flagship 20 2 100
    Lightweight / code 6.5 1.3 27

    Unit: yuan per million tokens. With these illustrative values, the flagship tier’s output cost is about 3.7× that of the lightweight tier, and its input cost about 3.1×. If every request hits the flagship tier, while another system routes simple tasks to the lightweight tier, the bills can easily differ by half.

    Billing modifiers: different factors at the same unit price

    Modifier Description Impact on the bill
    Batch / async discount A discount for calls the platform can complete asynchronously Applies only to requests that meet batch conditions
    Off-peak discount Lower prices for certain plans or models during low-traffic hours Depends on whether your workload can shift off-peak
    Committed usage / resource packs Tiered discounts in exchange for prepayment or committed usage Overspend risk; pair with forecast usage
    Cache TTL Some platforms bill writes separately by TTL May not pay off for short sessions
    Regional differences Unit prices may vary by region Adds cross-border network and compliance costs
    Currency and tax Foreign-currency settlement is affected by exchange rates; tax-inclusive vs. tax-exclusive bases differ Affects the actual settled amount
    Free quota New-user credits, limited-time grants, trial quotas The bill may jump once they are used up
    Legacy version retirement Old-model shutdown or migration changes price and quality Costs must be re-evaluated during migration
    Output length caps Some platforms tier pricing by maximum output length Long-output tasks cost more per unit

    Four Scenarios: Same Unit Price, Bill Falls from 90,000 to 26,300

    First, fix the workload parameters:

    • Monthly call volume: 1,000,000 calls;
    • Average input per call: 2,000 tokens, including a cacheable portion;
    • Average output per call: 500 tokens;
    • Illustrative flagship and lightweight unit prices from above.

    One important note: the cache savings in scenarios B and D below do not yet account for cache-write costs; if the platform charges for writes, add N_write × P_write / 1,000,000 per the formula.

    Scenario Key practice Cost per request (yuan) Monthly bill (10k yuan) Savings vs. baseline
    A baseline All flagship, synchronous online calls, no cache 0.090 9.00 —
    B prefix caching System prompt is half of input and stably reused; 50% cache hit rate 0.072 7.20 20.0%
    C batch jobs 70% of requests are async and get a batch discount of 60% of standard price 0.0648 6.48 28.0%
    D tiered routing + cache + batch 70% of simple requests go to lightweight, 30% to flagship; 50% cache hit rate; 70% of requests async 0.02629 2.63 70.8%

    The key calculations are as follows.

    A baseline:

    1. 2000 × 20 + 500 × 100 = 90000
    2. 90000 / 1,000,000 = 0.090 yuan

    Monthly bill:

    1. 0.090 × 1,000,000 = 90000 yuan = 9.00 (in 10k yuan)

    B prefix caching: 1,000 cache-hit tokens and 1,000 uncached tokens:

    1. 1000 × 20 + 1000 × 2 + 500 × 100 = 72000
    2. 72000 / 1,000,000 = 0.072 yuan

    Monthly bill is 7.20 (in 10k yuan), a 20% saving vs. baseline.

    C batch jobs: 70% of requests get 60% of standard price, the other 30% pay standard:

    1. 70% × 0.090 × 0.6 + 30% × 0.090
    2. = 0.0378 + 0.0270
    3. = 0.0648 yuan

    Monthly bill is 6.48 (in 10k yuan), a 28% saving vs. baseline.

    D tiered routing + cache + batch:

    Lightweight cost per request:

    1. 1000 × 6.5 + 1000 × 1.3 + 500 × 27
    2. = 6500 + 1300 + 13500
    3. = 21300
    4. 21300 / 1,000,000 = 0.0213 yuan

    Flagship cost per request:

    1. 1000 × 20 + 1000 × 2 + 500 × 100
    2. = 72000
    3. 72000 / 1,000,000 = 0.0720 yuan

    Average cost per request after routing:

    1. 70% × 0.0213 + 30% × 0.0720
    2. = 0.03651 yuan

    If 70% of requests are async and get 60% of standard price, the combined batch discount factor is:

    1. 1 - 70% × (1 - 60%) = 0.72

    Final cost per request:

    1. 0.03651 × 0.72 ≈ 0.02629 yuan

    The monthly bill is about 2.63 (in 10k yuan), a 70.8% saving vs. baseline.

    This shows that at an unchanged unit price, simply changing the usage structure and how billing rules apply can make the monthly bill differ by more than half.

    Five Easily Underestimated Cost Amplifiers

    Output cost: one output token is expensive

    Using the illustrative prices: output 100, regular input 20, cache hit 2.

    Therefore:

    • output price / regular input price = 100 / 20 = 5;
    • output price / cache-hit price = 100 / 2 = 50.

    So cutting one output token saves as much as skipping 5 uncached input tokens, or 50 cache-hit tokens.

    Tasks such as long-document summarization, code generation, and report writing deserve special attention to output length. If you ask the model to “expand on every section in detail,” the output may be as long as the input, or longer, and the bulk of the cost lands in the most expensive output tier.

    Controllable measures include:

    • Set a separate output-length cap for each task type;
    • Ask the model to give the conclusion first, then the key points, reducing preamble;
    • Use a layered “segment-and-summarize, then aggregate” strategy for long text;
    • Define explicit stop conditions to avoid unbounded expansion;
    • Avoid over-truncation, which can trigger retries and rework that waste even more.

    Cache hit rate: the gap between 60% and 10%

    With the illustrative prices, the blended input cost can be written as:

    1. blended input cost = hit rate × cache-hit price + (1 - hit rate) × regular input price

    Plugging in the illustrative values:

    1. blended cost = hit rate × 2 + (1 - hit rate) × 20

    Note: this expression only compares cache hits against regular input and does not include cache-write costs; if the platform charges for cache writes, add the write cost separately.

    Metric No cache 10% cache hit rate 60% cache hit rate
    Blended cost per 1M input tokens (yuan) 20.0 18.2 9.2
    Reduction vs. no cache — 9% 54%

    In other words, even a 10% hit rate yields close to a 10% saving; at a 60% hit rate, input-side cost can drop by 54%.

    But caching is not set-and-forget once enabled. Common reasons it fails include:

    • The prefix contains volatile content such as timestamps, random numbers, session IDs, or user IDs;
    • The order of tools or function lists is not fixed;
    • Historical messages are rewritten or truncated rather than stably appended;
    • Real-time retrieval results, user profiles, or personalized content are mixed into the prefix;
    • Request intervals frequently exceed the cache TTL.

    Are cache-write tokens worth it? It depends on session reuse

    Some platforms bill writes separately by cache TTL. A short-TTL tier writes more cheaply but may expire sooner; a long-TTL tier writes more expensively but suits longer sessions.

    Tested with illustrative parameters:

    • Regular input price: 20 yuan per million tokens;
    • Cache-hit price: 2 yuan per million tokens;
    • Short-TTL write: 20 yuan per million tokens;
    • Long-TTL write: 40 yuan per million tokens;
    • System prompt: 100,000 tokens;
    • Written on the first call of each session, hits afterward.
    Requests per session Short-TTL cost (yuan) Long-TTL cost (yuan) No-cache cost (yuan) Observation
    2 2.2 4.2 4.0 Short tier beats no cache; long tier is actually more expensive
    10 3.8 5.8 20.0 Both tiers beat no cache, but short tier is still better

    Short-TTL tier cost:

    1. write once: 100000 × 20 / 1,000,000 = 2.0 yuan
    2. subsequent hits: (N - 1) × 100000 × 2 / 1,000,000 = (N - 1) × 0.2 yuan

    When N = 2:

    1. 2.0 + 1 × 0.2 = 2.2 yuan

    When N = 10:

    1. 2.0 + 9 × 0.2 = 3.8 yuan

    Long-TTL tier cost:

    1. write once: 100000 × 40 / 1,000,000 = 4.0 yuan
    2. subsequent hits: (N - 1) × 0.2 yuan

    When N = 2:

    1. 4.0 + 0.2 = 4.2 yuan

    When N = 10:

    1. 4.0 + 1.8 = 5.8 yuan

    No cache:

    1. N × 100000 × 20 / 1,000,000 = N × 2.0 yuan

    When N = 2:

    1. 2 × 2.0 = 4.0 yuan

    When N = 10:

    1. 10 × 2.0 = 20.0 yuan

    The conclusions should be read in layers:

    • In sparse sessions of 2 requests, the short tier beats no cache, but the long tier is not necessarily worthwhile.
    • In dense sessions of 10 requests, both tiers beat no cache, but the short tier is still better.
    • When comparing the long tier against no cache, a quick estimate threshold is: the savings from subsequent hits must cover the write cost. Ignoring the first request’s regular-input offset, a conservative threshold is:
    1. m > W_long / (P_in - P_cache)

    Plugging in the illustrative values:

    1. m > 40 / (20 - 2) ≈ 2.22

    That is, subsequent hits must reach at least about 3 before the long tier has a clear chance to beat no cache. Accounting precisely for the first request’s regular-input cost lowers the threshold slightly, but in engineering practice you should leave a safety margin.

    • When comparing the long tier against the short tier, hit count alone is not enough. If the short tier does not expire during the whole session and the hit count is the same, the long tier is usually more expensive. Only when the short tier expires by TTL and forces extra rebuilds may its total write cost rise. At that point, the long tier is cheaper when:
    1. W_long < W_short × (1 + k)

    where k is the number of extra writes the short tier incurs from expiry. If k = 0, the long tier is not cheaper.

    Free quota and model retirement: the bill over time

    Free quota creates clear discontinuities in the bill. For example, a new-user quota of 1,000,000 tokens per model can make a month’s bill look very low; in the next billing cycle after the quota is exhausted, the bill may jump sharply.

    Version lifecycle is also easy to overlook. When a vendor announces that an old model will stop accepting registrations or be retired, and recommends migrating to a new version, both price and output quality may change. If the application layer has no model abstraction, migration becomes a chain of work: editing code, running regression tests, and re-evaluating cost.

    Region, currency, and tax: structural costs

    A price page often shows numbers for only one region and one currency. Actual settlement must also account for:

    • Regional premiums: unit prices may differ by region; overseas regions sometimes carry a markup;
    • Currency and exchange rates: foreign-currency pricing fluctuates with exchange rates, so the bill can rise even when usage does not change;
    • Tax basis: quotes may be tax-inclusive or tax-exclusive, and input-tax credits affect real cost;
    • Cross-border compliance and network costs: if data leaves the country, you must also evaluate compliance, latency, and link costs.

    Engineering It: Control at the Accounting, Request, and Scheduling Layers

    Accounting layer: make every call’s cost computable

    The first step is to extract billing rules from code into a version-controlled configuration. The following is a simplified cost-estimation example that illustrates the idea:

    1. from dataclasses import dataclass
    2. @dataclass(frozen=True)
    3. class Pricing:
    4. """All unit prices are expressed in yuan per million tokens."""
    5. input_per_mtok: float
    6. cache_hit_per_mtok: float
    7. output_per_mtok: float
    8. cache_write_per_mtok: dict[str, float]
    9. @dataclass(frozen=True)
    10. class Usage:
    11. """
    12. Billing convention:
    13. input_tokens is the total input under the platform's billing rules, and it
    14. includes cached_tokens and cache_written_tokens. If a platform's
    15. input_tokens does not include cache_written_tokens, the adapter layer must
    16. merge them first to avoid double-deduction or under-counting later.
    17. """
    18. input_tokens: int
    19. cached_tokens: int
    20. output_tokens: int
    21. cache_written_tokens: int = 0
    22. cache_ttl: str = "5m"
    23. batch: bool = False
    24. region: str = "cn"
    25. def estimate_cost(
    26. usage: Usage,
    27. price: Pricing,
    28. batch_discount: float = 1.0,
    29. region_factor: float = 1.0,
    30. ) -> float:
    31. # usage.input_tokens includes cached_tokens and cache_written_tokens
    32. new_input = max(
    33. usage.input_tokens - usage.cached_tokens - usage.cache_written_tokens,
    34. 0,
    35. )
    36. cache_write_price = price.cache_write_per_mtok.get(
    37. usage.cache_ttl,
    38. price.input_per_mtok,
    39. )
    40. total = (
    41. new_input * price.input_per_mtok
    42. + usage.cached_tokens * price.cache_hit_per_mtok
    43. + usage.cache_written_tokens * cache_write_price
    44. + usage.output_tokens * price.output_per_mtok
    45. ) / 1_000_000
    46. factor = batch_discount if usage.batch else 1.0
    47. return total * factor * region_factor

    The key here is normalizing “usage.” Different platforms may name cache tokens, write tokens, and output tokens differently, so it is best to convert them to a single convention in the adapter layer.

    Request layer: stable prefixes + tiered routing

    The prefix-cache hit rate depends on whether the prefix bytes stay stable. Organize request content from most to least stable:

    1. [stable] system role setup, tool definitions, safety policies
    2. [fairly stable] domain knowledge in fixed order, few-shot examples
    3. [semi-dynamic] reference material retrieved this turn
    4. [volatile] the user's current input, timestamps, session metadata

    Tiered routing can be implemented with a rule engine or a lightweight classifier. Send simple tasks to the lightweight tier and complex tasks to the flagship tier, and roll out via configuration with a gradual release:

    1. import os
    2. CHEAP_MODEL = os.environ.get("LIGHT_MODEL", "light")
    3. DEFAULT_MODEL = os.environ.get("DEFAULT_MODEL", "flagship")
    4. def route_model(request: dict, lightweight_classifier) -> str:
    5. if request.get("need_reasoning") or request.get("input_tokens", 0) > 16000:
    6. return DEFAULT_MODEL
    7. score = lightweight_classifier(request["messages"])
    8. return CHEAP_MODEL if score >= 0.8 else DEFAULT_MODEL

    Scheduling layer: batching, output budgets, and per-request guards

    Route async-capable tasks into a batch queue; set an output cap for each task type; add a per-call cost cap, a retry cap, and an overall deadline.

    Retries especially need restraint. A timeout retry re-transmits long context. If a single call costs 0.09 yuan and at most 3 calls are allowed, the retry cost ceiling should account for at least:

    1. 0.09 × 3 = 0.27 yuan

    The cost_guard example below completes the batch-discount check and factors the overall deadline and the billing of failed calls into account. If the platform charges for failed calls and the exception carries usage and price, the failed cost is also accumulated; if failed calls are not charged, only successful calls are counted.

    1. import time
    2. from functools import wraps
    3. def batch_discount_of(usage):
    4. """Return the batch discount factor only when the request meets the platform's batch conditions."""
    5. return 0.6 if usage.batch else 1.0
    6. def cost_guard(max_cost: float, max_retries: int = 2, deadline: float = 30.0):
    7. """
    8. Request-level cost guard: use an overall deadline to bound total retry time.
    9. Notes:
    10. - If the platform also charges for failed calls and the exception carries
    11. usage / price, the failed cost is added.
    12. - If failed calls are not charged, or the exception carries no usage info,
    13. only successful calls are counted.
    14. """
    15. def decorator(fn):
    16. @wraps(fn)
    17. def wrapper(*args, **kwargs):
    18. spent = 0.0
    19. started_at = time.monotonic()
    20. for attempt in range(max_retries + 1):
    21. try:
    22. result, usage, price = fn(*args, **kwargs)
    23. except Exception as exc:
    24. failed_usage = getattr(exc, "usage", None)
    25. failed_price = getattr(exc, "price", None)
    26. # If the platform also charges for failed calls, add the failed cost to spent here
    27. if failed_usage is not None and failed_price is not None:
    28. spent += estimate_cost(
    29. failed_usage,
    30. failed_price,
    31. batch_discount=batch_discount_of(failed_usage),
    32. )
    33. if spent > max_cost:
    34. raise RuntimeError(
    35. f"cost guard triggered by failed call: "
    36. f"{spent:.4f} > {max_cost}"
    37. ) from exc
    38. if attempt == max_retries or time.monotonic() - started_at > deadline:
    39. raise
    40. time.sleep(2 ** attempt)
    41. continue
    42. spent += estimate_cost(
    43. usage,
    44. price,
    45. batch_discount=batch_discount_of(usage),
    46. )
    47. if spent > max_cost:
    48. raise RuntimeError(
    49. f"cost guard triggered: {spent:.4f} > {max_cost}"
    50. )
    51. return result
    52. raise RuntimeError("deadline exceeded")
    53. return wrapper
    54. return decorator

    From Price Comparison to a Selection Methodology

    Once the cost structure is clear, the selection question is no longer “whose unit price is lower,” but “whose billing rules better fit my workload.”

    Check item Key question
    Billing convention How are cache hits billed? Are cache writes billed separately? Are there output-length tiers?
    Cache-write and TTL strategy What are the write prices for long vs. short sessions? Is the short-tier expiry-rewrite risk manageable?
    Model matrix Is there a full range from lightweight to flagship, making tiered routing easy?
    Batch capability Are there batch discounts? What are the latency constraints? Which models are covered?
    Plans and discounts What are the eligibility conditions and settlement cycles for off-peak discounts, committed usage, and resource packs?
    Quota and lifecycle What is the scope and validity of the free quota, and when do legacy versions retire?
    Region and settlement How are regional price differences, currency, tax, and cross-border compliance calculated?
    Stability and observability What are the rate-limit thresholds, the SLA, and the ability to query usage and bills?

    Common mistakes

    Common mistake Likely consequence Correct approach
    Comparing output tokens as if they were regular input Underestimates true cost, since output is more expensive Track output share and output unit price separately
    Putting a timestamp or session ID in the prefix Lower cache hit rate, higher input cost Move volatile content after the prefix
    Looking only at standard price, ignoring retry cost Retries amplify the bill; failed calls may be billed repeatedly Fold retry counts and failed-call costs into the budget guard
    Ignoring cache writes and TTL Caching can cost more in short-session scenarios Use session reuse count to decide whether to enable caching
    Overlooking free-quota discontinuities Next month’s bill jumps unexpectedly Forecast the free quota as a separate deduction

    A practical rule of thumb: at the same unit price, a platform with a richer model matrix and more transparent billing rules usually leaves more room for cost optimization. During selection, weigh workload fit, billing-rule transparency, and usage observability together.

    A Four-Step Attribution Method and Observability

    When a bill looks anomalous, attribute it in four steps.

    Step 1: Normalize the billing convention

    Confirm whether fields such as input, cache hits, cache writes, output, batch, region, and tax are unified. Different platforms name fields differently, so you must normalize first; otherwise you cannot compare directly.

    Step 2: Break down usage

    Split the monthly total into:

    • regular input tokens;
    • cache-hit tokens;
    • cache-write tokens;
    • output tokens;
    • batch call volume;
    • retry call volume;
    • failed call volume, if the platform bills for failed calls.

    Comparing only “total call count” leads to easy misjudgment.

    Step 3: Verify the factors

    Check whether batch discounts, off-peak discounts, regional factors, tax factors, and free-quota deductions are computed per the platform’s actual rules. In particular, batch discounts apply only to batch-eligible requests.

    Step 4: Locate anomalous requests

    Drill down by tenant, feature module, model, region, and endpoint to locate anomalous calls. For example, a certain type of long-text summarization request has runaway output length, or a certain prefix contains a timestamp that lowers the cache hit rate.

    Recommended metrics to monitor closely:

    • cache hit rate;
    • cache-write token share;
    • output token share;
    • average output length;
    • share of batch-eligible requests;
    • retry count and retry cost;
    • failed-call cost;
    • remaining free quota;
    • daily/monthly cost per tenant, per feature, and per model.

    Cost optimization is sustainable only when it is measurable. Recommended practices:

    • Per-call attribution: log the model, region, batch flag, each token count, estimated cost, and a business identifier; the business identifier can be recorded after desensitization or hashing.
    • Budget guards: set daily/monthly budgets and alert thresholds by tenant, feature, and environment; on trigger, automatically downgrade to the lightweight tier or apply rate limiting.
    • Periodic review: model prices, discount rules, and legacy-version retirement plans all change, so put “billing configuration + routing strategy” under version control.

    FAQ

    How do I explain an LLM API monthly bill that differs by half?

    First look at the share of the four token types, then at batch discounts, cache hits, cache writes, model routing, retries, and tax. If unit prices are identical, the bill difference usually comes from billing rules and usage structure, not the unit price itself.

    How does cache hit rate affect the bill?

    Cache-hit tokens are usually far cheaper than regular input tokens. With this article’s illustrative prices, raising the cache hit rate from 10% to 60% drops the blended cost per million input tokens from 18.2 to 9.2 yuan, a reduction of about 54%. This comparison does not include cache-write costs; if the platform bills for writes, they must be accounted for separately.

    Are cache-write tokens always worth it?

    Not necessarily. It depends on session reuse count and the write unit price. If a session has few requests, write costs may cancel out the hit savings; if a session is dense with a stable prefix, caching usually pays off. The long-TTL tier suits long sessions, while the short-TTL tier suits short sessions or high-frequency stable prefixes.

    Conclusion

    An identical unit price but a bill that differs by half is fundamentally because the bill depends on “billing rules × usage structure,” not a single number on the price list. Output tokens are the most expensive tier; prefix caching determines input-side cost; cache writes and TTL decide whether caching actually saves money; batch discounts and model routing set the overall magnitude; and retries, region, free quota, and legacy-version lifecycle amplify or offset the differences in the details.

    Treat cost as an engineering metric that is measurable, attributable, and actionable. By landing improvements layer by layer—from billing configuration and request structure to scheduling strategy and monitoring—you stay in control when selecting models: you are no longer comparing price tables, but the cost curve of your own business.