Why LLM API Bills Vary So Much at the Same Unit Price
The same model can carry identical per-token pricing across different services, yet produce very different monthly bills. This article explains why sticker price is only one input to the final cost, breaks down how LLM API billing actually works—covering token usage categories, cache pricing, batch versus real-time calls, subscription plans, and overage fees—and provides a reusable method for estimating your true monthly spend.
1. Same Unit Price, Different Bills
A model may be listed at exactly the same price across different services, yet the end-of-month bills often differ noticeably. The reason is that the sticker price is only one input into the bill. The actual cost is determined by three factors: usage structure, billing rules, and how the API is called. Ignore any one of them, and your estimate will drift from real spending.
This article does not compare specific vendors. It focuses on billing rules common to LLM APIs in general and provides a reusable cost estimation method.
2. Break Usage Down into Billable Units
LLM APIs typically bill by token, distinguishing between input, output, and cache-related usage. Before calculating costs, split your call logs into the following categories:
- Regular input tokens: prompt content that did not hit the cache.
- Cache-hit tokens: content that reused a previously computed prefix, usually priced lower than regular input.
- Cache-write tokens: usage generated when content is first written to the cache; some pricing plans charge for this separately.
- Output tokens: content generated by the model, typically the most expensive category.
The basic cost formula is:
Monthly cost = Σ (token usage of each category ÷ 1,000,000 × corresponding unit price)
Here is a hypothetical example (the numbers are illustrative, not real quotes from any platform). Suppose a month has 6 million regular input tokens, 4 million cache-hit tokens, and 2 million output tokens, priced at 10, 1, and 40 units per million tokens respectively. The cost is 6×10 + 4×1 + 2×40 = 144. If the cache hit rate rises from 40% to 70%—7 million hit tokens and 3 million regular input tokens—the cost becomes 3×10 + 7×1 + 2×40 = 117, a drop of roughly 20%. Estimates must use the real hit rate; you cannot assume all input is regular input.
3. Cache Billing: Hidden Costs and Structural Design
Caching works like this: when a request’s prefix matches a recent request, the server can reuse previously computed intermediate results, reducing input costs and shortening time to first token. When reviewing cache billing rules, pay attention to:
- Activation conditions: the prefix must match character for character—even a single different space can cause a miss.
- Time to live (TTL): the cache expires after a period without access. If your request interval exceeds the TTL, the hit rate will be close to zero.
- Price gap between writes and hits: some plans price writes separately, and longer retention may mean a higher write price. Short-window, high-frequency workloads and long-cycle, low-frequency workloads call for different strategies.
A common engineering practice is to place stable content (system instructions, knowledge base fragments, examples) at the front of the prompt, and variable content (user questions, timestamps, request IDs) at the end. The pseudocode below estimates the hit rate to help you decide whether such a refactor is worth the effort:
def estimate_hit_rate(requests, ttl_seconds):last_seen = {} # prefix -> most recent seen timehit_tokens = 0total_tokens = 0for req in requests: # iterate in chronological orderprefix = req.static_prefixn = count_tokens(prefix)total_tokens += nt = last_seen.get(prefix)if t is not None and req.time - t <= ttl_seconds:hit_tokens += nlast_seen[prefix] = req.timereturn hit_tokens / total_tokens if total_tokens else 0.0
4. Price Offline Jobs Separately from Real-Time Calls
Real-time calls require low latency because a user is usually waiting for the result. Offline jobs—such as batch summarization, data cleaning, or evaluation set generation—are not sensitive to completion time. Many services offer discounts for offline batch submissions, in exchange for results being returned within an agreed time window.
In practice, split your traffic by latency requirements:
- User-facing interactive requests go through the real-time channel.
- Report generation, index building, and training data processing go through the batch channel.
- For anything in between, first define the acceptable latency ceiling, then decide where it belongs.
After splitting, track the cost of each traffic class separately. Otherwise you cannot tell whether the discount is actually taking effect, or spot jobs that should run in batch but are still consuming real-time quota.
5. Subscriptions, Plans, and Overage Billing
Fixed plans look simple, but you need to compute the break-even point. Let the monthly plan fee be F, the included quota Q (in millions of tokens), the overage price p, and the pay-as-you-go price u. If monthly usage is V (in millions of tokens), then:
- Pay-as-you-go cost = V × u
- Plan cost = F + max(0, V − Q) × p
Setting the two equal gives the break-even usage: F + (V − Q)p = Vu. Above that usage level, the plan is cheaper; below it, pay-as-you-go wins.
Example: a plan costs 100 per month, includes 5 million tokens, and charges 12 per million tokens for overage, while pay-as-you-go is 15 per million tokens. Solving the equation gives a break-even point of V = 40 ÷ 3 ≈ 13.3 million tokens. At 8 million tokens per month, pay-as-you-go costs 120 versus 136 for the plan, so pay-as-you-go is cheaper. At 20 million tokens, pay-as-you-go costs 300 versus 280 for the plan, so the plan is cheaper.
Overage pricing may also vary by time of day. If your traffic peaks in specific windows, model the usage in those windows separately rather than estimating from an all-day average.
6. Free Tiers and Trial Policies
New models or new users typically receive some amount of free quota. When evaluating
