Two LLM providers can quote the same price per million tokens and still hand you monthly bills that differ by half. This article breaks down how LLM API billing is actually assembled — separate unit prices for input, cache hits, and output; prefix caching with its TTL and write costs; batch discounts traded against latency; subscription allowances with on-demand overage; and free credits plus regional price differences. Each rule is turned into a practical checklist item, and a reusable Python script shows how to estimate your monthly spend from a real call profile, so you can see which billing dimension is driving your bill and which workloads are worth moving to cheaper channels.
LLM API Pricing Rules Explained: How to Cut Your Monthly Bill in Half
Why the Same Per-Token Price Can Still Produce Bills That Differ by Half
When teams evaluate LLM API costs, the first step is usually comparing price per million tokens. That check is necessary but nowhere near sufficient. What really determines the end-of-month bill is not just the list price, but the combination of billing rules: how pay-as-you-go usage is calculated, how cache hits are priced, whether offline jobs get a discount, how a monthly plan and on-demand billing switch between each other, and how free credits are applied. When two providers quote exactly the same on-demand rate, the gap almost always hides in the latter rules. Knowing where each rule applies is the real lever for pushing monthly spend down.
How LLM API Billing Is Structured
Billing for LLM APIs revolves around tokens, but a single call is usually split into several separately priced dimensions.
1. Pay-as-you-go: three price tiers for input, cache hits, and output
The mainstream approach splits the tokens of one call into three parts: input (prompt), output (completion), and input tokens served from cache. The unit prices typically follow one pattern — output is the most expensive, input comes next, and cache hits are the cheapest, often around one tenth of the input price. In practice, handling the same 10,000 tokens can cost an order of magnitude more or less depending on whether the cache was hit.
A simplified cost estimate looks like this:
def estimate_cost(input_m, cache_hit_m, output_m,p_in, p_cache, p_out, discount=1.0):"""input_m and friends are in millions of tokens; p_* are unit prices per million tokens"""base = input_m * p_in + cache_hit_m * p_cache + output_m * p_outreturn base * discount
2. Cache billing: automatic reuse of repeated prefixes
When several requests share the same prefix — a fixed system prompt, a long document, a set of few-shot examples — the caching mechanism keeps that prefix around and charges the lower hit price on later calls. Two caveats matter here. First, a cache entry usually has a time-to-live (TTL), such as 5 minutes or 1 hour, after which it has to be written again. Second, writing to the cache may be billed separately. Caching therefore saves money only when the prefix is stable, calls are dense, and the hit rate is high; scattered calls can easily end up costing more because of the write overhead.
3. Batch processing: offline discounts in exchange for latency
For work that does not need an immediate response — bulk translation, offline summarization, log analysis, data labeling — the batch interface settles at a lower price than real-time calls, commonly somewhere between half and sixty percent of the standard rate. The trade-off is queuing: results come back anywhere from a few minutes to a few hours later. The decision rule is simple. Does the user need the result right away? If not, prefer batch.
4. Subscriptions: a fixed allowance plus on-demand overage
A subscription plan usually exchanges a fixed monthly fee for a token allowance. Usage inside the allowance counts as prepaid, and anything beyond it is billed on demand. This suits workloads with predictable volume and clear peaks and troughs: pack most calls into the allowance, pay on demand only for the small overflow, and the total can land below pure pay-as-you-go. Conversely, for very low or highly unstable usage, an allowance that goes unused is simply wasted money.
5. Free credits and regional price differences
Free credits for new users or newly released models, and price markups in certain regions, are variables that are easy to overlook. The same model can cost a few percent more in one region than in another, and overseas regions are often pricier. Free credits are a one-time benefit, but during migration and trial runs they can cut real costs.
A Practical Checklist for Reducing Your Bill
- Pick the right model tier: simple tasks do not need the most expensive flagship model — match tiered models to the scenarios they fit.
- Route offline work through batch: assess every non-real-time path for whether it can be made asynchronous.
- Prioritize caching: consolidate stable prefixes to raise the hit rate, while keeping TTL and write frequency under control.
- Combine subscription with on-demand: predictable high-frequency calls go on a subscription, bursty traffic goes on demand.
- Connect nearby: attach within the cloud environment you already run, to reduce cross-network and cross-region overhead.
- Review periodically: re-run the numbers against real usage to avoid a mismatched plan.
Modeling the Monthly Bill with Real Data
Comparing abstract unit prices is misleading; it is better to feed a real call profile into the formula. The example below gives a rough comparison of the same usage under pay-as-you-go and batch:
# Monthly usage (millions of tokens)in_m, cache_m, out_m = 800, 200, 400# Illustrative pay-as-you-go unit prices per million tokensp_in, p_cache, p_out = 13, 1.3, 68payg = in_m*p_in + cache_m*p_cache + out_m*p_out# The offline portion qualifies for an overall discountbatch = (in_m*p_in + cache_m*p_cache + out_m*p_out) * 0.6print(f"Pay-as-you-go: {payg:.2f}")print(f"Offline batch: {batch:.2f}")
The key finding: when a real-time workload with a high share of fixed cost moves part of its calls to off-peak or batch channels, the bill often drops in steps. That is exactly the source of “same unit price, different bill.”
Summary
The cost of an LLM API is never a single-price question; it is a question of how a set of rules combines. Pay-as-you-go, caching, batch, subscriptions, free credits, and regional differences together determine the final bill. The right approach for developers is to first profile real usage — the real-time versus offline split, prefix stability, peak and trough distribution — then choose a combination of billing models based on that profile, and keep validating it with a reusable estimation script. Do this, and even facing an identical list price, you can hold monthly spend at a clearly better level.
