LLM Output Prices Jumped 5x: A Practical Guide to Token Billing and Cost Reduction
When a new generation of large language models raises prices, the output price can reach five times the input price, and many teams immediately assume they can no longer afford it. The real question is whether your bill actually goes up fivefold. Because the cost of a single call is determined jointly by three token tiers—input, cache hits, and output—judging by the output price alone leads to misjudgment. Written without tying to any specific vendor, this guide starts from the general billing mechanism, builds a blended-price model, and then walks through practical techniques for caching, context, routing, observability, and model selection so you can keep costs under control. By the end, you will know how to calculate your true per-request cost, decide between subscriptions and pay-as-you-go, and respond to vendor price changes without sacrificing quality.
1. A 5x price hike — what is actually rising
Mainstream LLM APIs are usually billed per token. One token corresponds to roughly 0.5–1.5 Chinese characters or about 0.75 of an English word, depending on the tokenizer. Billing is typically split into three tiers:
- Input (uncached) price: the prompt that must be fully computed in this request;
- Cache-hit price: the portion that hits an already-cached prefix, usually only a fraction to one-tenth of the input price;
- Output price: the tokens generated by the model, including any inference content that is billed or displayed.
Using hypothetical prices as an example: input 20, output 100, cache hit 1 (per million tokens). Here the input-to-output ratio is 1:5.
That 5x gap is not just a commercial decision—it results from the nature of inference computation. Transformer inference typically has two phases:
- Prefill: the model processes all input tokens in parallel and computes the KV cache in one pass. This is large-scale matrix computation and is compute-intensive.
- Decode: the model generates only one new token per step, then appends it back to the input to continue. Each step must read the historical KV cache, so the bottleneck is often memory bandwidth.
Therefore, with the same GPU resources, the number of input tokens processed per unit time is usually greater than the number of output tokens generated. The higher output price reflects the difference in computational structure and throughput.
Of course, the bill is also affected by subscription fees, cache-hit discounts, batch discounts, and the rules for billing failed retries. To judge how cost changes, you cannot look at a single unit price alone—you need to look at the total cost of ownership.
2. Do the math: the blended price is the real cost
The cost of a single request can be expressed as:
C = (N_in − N_hit) × P_in + N_hit × P_cache + N_out × P_out
where:
- N_in: total input tokens;
- N_hit: tokens that hit the cache;
- N_out: output tokens;
- P_in, P_cache, P_out: prices for input, cache hit, and output (per million tokens).
If we define the cache hit ratio r = N_hit / N_in, the effective input price is:
P_input_eff = r × P_cache + (1 − r) × P_in
If some services also charge separately for cache writes, you need to add the cache-write cost to the uncached portion. The following examples all use hypothetical per-million-token prices; refer to the vendor’s billing documentation for actual values.
1. Long-context understanding task
Suppose a call has about 20,000 input tokens (system instructions, retrieved repository snippets, and file contents) and 800 output tokens.
When the cache hit ratio r = 0:
C = (20000 × 20 + 800 × 100) / 1,000,000 = 0.48 per call
On a per-million-token basis, the output cost is 80,000, accounting for 16.7% of the total 480,000.
If the system instructions and retrieved snippets stay stable and are reused, raising the cache hit ratio to 95%:
P_input_eff = 0.95 × 1 + 0.05 × 20 = 1.95 per million tokensC = (1000 × 20 + 19000 × 1 + 800 × 100) / 1,000,000 = 0.119 per call
Here the per-call cost drops to about one quarter of the original. Note that this reduction comes from cache reuse, not from a lower unit price.
2. High-output code generation task
Suppose input is 6,000 tokens, of which 5,000 hit the cache, and output is 3,000 tokens:
C = (1000 × 20 + 5000 × 1 + 3000 × 100) / 1,000,000 = 0.325 per call
On a per-million-token basis, the output cost is 300,000, accounting for 92.3% of the total 325,000.
If the cache hit ratio drops from 95% to 0, the per-call cost rises from 0.325 to 0.42, an increase of about 29.2%. Compared with the long-context understanding task, this type of task is less sensitive to the cache hit ratio, because output dominates the cost.
The conclusion is clear: the task type determines the cost structure.
- Long-context understanding, repository Q&A, and review/analysis tasks are input-dominated, so caching is the first lever;
- Code generation, refactoring, and rewriting tasks are output-dominated, so cost reduction should focus on cutting unnecessary output and controlling inference overhead.
The two types of tasks should be accounted for separately; you cannot measure them with a single “average price per million tokens.”
3. Cache hit ratio sensitivity
Suppose input is 30,300 tokens and output is 800 tokens, with 50 calls per workday and 22 workdays per month. The cost under different cache hit ratios is:
| Cache hit ratio | Cost per call | Monthly cost |
|---|---|---|
| 0% | 0.6860 | 754.6 |
| 50% | 0.3982 | 438.0 |
| 90% | 0.1679 | 184.7 |
| 95% | 0.1391 | 153.0 |
Corresponding common scenarios:
- Whole-repository scans, batch test generation: close to 0%, the highest cost;
- Ordinary IDE completion and rewriting: about 30%, roughly 0.5133 per call, monthly cost about 564.6;
- Single-person everyday Q&A: about 90%, monthly cost about 184.7;
- Continuous-session coding assistants: about 95%, monthly cost about 153.0.
A reusable estimation function:
# Price unit: currency units per million tokens; usage in tokens# The example prices are for demonstration only; refer to the pricing rules of your chosen servicePRICE = {"input": 20.0,"cache_hit": 1.0,"output": 100.0,"cache_write": 20.0, # Some services charge separately for cache writes; here we demo it at the input price}def estimate_cost(n_in, n_out, cache_hit_ratio=0.0, price=PRICE):"""Estimate the cost of a single call."""n_hit = round(n_in * min(max(cache_hit_ratio, 0.0), 1.0))n_fresh = n_in - n_hitcost = (n_fresh * price["cache_write"]+ n_hit * price["cache_hit"]+ n_out * price["output"]) / 1_000_000return round(cost, 6)# 20 file snippets, each about 1500 tokens, plus a 300-token questionn_in = 1500 * 20 + 300n_out = 800cached = estimate_cost(n_in, n_out, cache_hit_ratio=0.95)uncached = estimate_cost(n_in, n_out, cache_hit_ratio=0.0)print(f"Cached: {cached:.4f} per call; uncached: {uncached:.4f} per call")
Under these assumptions, with n_in=30300 and n_out=800, the cached cost is about 0.1391 per call and the uncached cost about 0.6860 per call.
If the business layer adds subscription quotas, tool-call fees, or fast-request fees, you need to combine the model layer with the application layer. Looking only at the model-layer token price easily leads to misjudging the final bill.
3. Caching: the most effective lever, and the most easily wasted
Whether caching saves money depends on the hit ratio. Some mainstream services offer automatic prefix caching; the hit conditions, TTL, and billing method should follow the vendor documentation.
Automatic prefix caching usually has several strict conditions:
- The prefix must match exactly: it typically requires token-level matching, so changing a space or reordering fields can invalidate the whole cached segment;
- The reused content must sit at the front of the prompt: system instructions, tool definitions, and project conventions should go at the beginning;
- It must be within the validity period: caches usually have a lifetime and may be cleared after a long idle period;
- Requests must be routed centrally: some services schedule requests with the same prefix to the same instance to improve the hit ratio.
Three engineering practices:
- Stabilize the prefix: put system instructions, tool definitions, and project coding conventions at the very front and keep them as unchanged as possible;
- Put variables last: file names, user questions, timestamps, and request IDs should go at the end;
- Batch and consolidate: organize batch offline tasks into consecutive requests with the same prefix instead of triggering them sporadically.
Three common mistakes:
- Assuming the cache can recognize semantically similar content, when in fact it usually only recognizes prefixes;
- Putting timestamps or random IDs into the system prompt, which invalidates the cache every round;
- Ignoring cache-write fees or quota rules, which leads to budget misjudgment.
4. Subscription plans vs pay-as-you-go APIs: how to choose
A subscription is a fixed monthly fee in exchange for a quota. It suits individuals or small teams with stable, continuous usage. The advantages are a predictable budget and easy reimbursement, and the effective unit price is sometimes lower than pay-as-you-go. The drawback is that the quota may reset each month, so insufficient utilization becomes waste.
Pay-as-you-go charges by actual usage. It suits scenarios with large usage fluctuations, shared across multiple projects, or requiring programmatic integration. The advantages are no idle cost and the ability to allocate keys and quotas per project, environment, or member. The drawback is that cost grows linearly with usage, so you need budget alerts as a safeguard.
When choosing, calculate the break-even point:
Monthly usage to break even = subscription monthly fee ÷ effective pay-as-you-go unit price
The effective unit price should be weighted by the actual input, output, and cache structure of your tasks, not taken directly from the list price.
Example: a five-person R&D team plans to use a smart coding tool. Assume a subscription costs 199 per person per month, the quota resets monthly, and failures and retries count against the quota; per-person usage is 50 calls a day, with 30,000 input tokens and 800 output tokens per call.
If they call the API directly with a 95% cache hit ratio, the per-person monthly cost is about 152, and about 762 for five people—lower than the total subscription price of 995. But if caching is unstable, say the hit ratio drops to 90%, the per-person monthly cost is about 184; if it drops to 0%, about 748 per person.
If a self-built agent adds extra system prompts, status checks, retries, and other overhead, estimated at about 1.5x the input/output, the per-person monthly cost is about 229 with a 95% hit ratio. In that case a subscription may be more hassle-free, but the premise is still that the quota is sufficient and the rules are clear.
| Dimension | Subscription plan | Pay-as-you-go API |
|---|---|---|
| Cost predictability | High, fixed monthly fee | Low, grows with usage |
| Idle waste | Yes, quota may reset | None |
| Use case | High-frequency, continuous, stable single-person usage | Volatile, batch, multi-project integration |
| Cache discount | Depends on plan rules | Usually reflected directly |
| Extra capabilities | Mostly in-product experience | Key quotas, fine-grained monitoring, programmatic integration |
Before signing, also verify: whether the quota resets across months, whether failures and retries count against the quota, whether general chat benefits and coding benefits are separate, whether Pro/Max tiers affect the number of parallel tasks, and the context length and peak-hour priority.
5. Beyond caching: more systematic cost reduction
1. Context engineering: feed only what is necessary
- Use keyword retrieval or a code graph to recall relevant files, instead of injecting the whole repository;
- Do rolling summarization of long conversation history, keeping only conclusions and key decisions;
- Truncate or structure tool outputs before they enter the context;
- Reuse existing results when retrying the same question, to avoid repeated consumption.
2. Task tiering and model routing
Send simple tasks to a small model or low-cost tier and complex tasks to a flagship model; this can clearly reduce cost:
def route(task):"""Select a model tier based on task characteristics."""# Tasks that are high-risk or verified as requiring the flagship modelif task.requires_flagship:return "flagship"# Completion tasks: short context, short output, use a low-latency small modelif task.kind == "completion" and task.context_tokens < 4000:return "small"# Simple rewrites of a single file with no cross-file dependenciesif task.files <= 1 and not task.cross_file_refs:return "small"# Cross-file refactoring, long-context analysis, complex reasoningreturn "flagship"
Routing needs safeguards against downgrade misjudgment. You can validate output with structured constraints such as a JSON Schema and automatically escalate to the flagship model for a retry when the format or quality falls short. Routing rules should be based on an offline evaluation set, not on gut feeling.
3. Output control
Stating explicitly in the instruction “output only the modified code, without extra explanation” or “return according to the specified schema” can reduce unnecessary output. Generating very long content in a single pass easily overflows the context or gets truncated, so splitting tasks by function or file is safer.
4. Request governance
- Set a token budget per task; terminate or downgrade when it is exceeded;
- Set timeouts and retry limits to avoid repeatedly billing failed tasks;
- Cache results for identical inputs and return them directly on a hit;
- Set concurrency limits and priorities for batch tasks to avoid crowding out peak-hour resources.
5. Observability: treat tokens as a resource to monitor
log_type=llm_callmodel_id=flagshipproject_id=payment-svcenv=prodcache_hit_ratio=0.93tokens_in=31250tokens_cached=29000tokens_out=742cost_amount=0.0123latency_ms=4200status=okprompt_sha256=9f2c...
Logs should not record sensitive information such as source code, keys, or user privacy. It is recommended to log only the prompt hash, length, error code, and a redacted summary, rather than plaintext content.
Aggregated by project, environment, and model, this can answer three questions: where the money goes, who is wasting it, and whether caching is working. Also set budget alerts: notify the owner when the daily cost reaches 80% of the threshold, and automatically switch to a downgrade model or throttle when it reaches 100%.
6. How enterprises should respond to vendor price changes
- Build a unit business-cost metric: don’t look at the token unit price, look at the cost per completed task and per active user;
- Set alerts and budget caps: allocate quotas by project, environment, and member to avoid a single point running out of control;
- Keep an abstraction layer and replaceability: wrap model calls in a unified gateway and keep the room to switch, reducing dependence on a single vendor;
- Do an impact assessment before a price change: use the real usage structure of the past 30 days to estimate cost changes under the new prices;
- Guard quality with an evaluation set: before every model or tier change, run a regression on an evaluation set that covers real tasks, to prevent quality regressions caused by cost reduction.
7. Conclusion
“Output at 100, input at 20, cache hit at 1”—the real information is in the ratio among the three, and in whether the cache mechanism exists. At the same prices, raising the cache hit ratio from 0 to 95% can cut the cost of a long-context task to a quarter of the original, while generation tasks where output accounts for over 90% are hard to benefit equally from caching alone.
Model price changes remind us that tokens are a new resource that needs to be measured and governed. First work out the blended price by task type, then optimize layer by layer with caching, context engineering, and model routing, and finally use an observability system to bake cost constraints into the workflow—only then can you strike a balance between capability improvement and cost control.
