LLM Inference Cost Evaluation: Why a Higher Unit Price Doesn't Always Mean Higher Cost
This article explains why comparing LLM API list prices directly can be misleading, and how to evaluate inference cost using throughput, latency, and cost per task. It breaks down three cost layers (nominal price, effective cost, and cost per task), shows why output token speed often matters more than unit price, separates time-to-first-token from token generation rate, and offers a formula plus scenario-based guidance for converting unit price into cost per completed task. It also lists system-level cost reduction practices such as context governance, tiered routing, structured output, batching, and observability. Readers will learn how to base model selection decisions on load test data rather than price sheets.
LLM Inference Cost Evaluation: Why a Higher Unit Price Doesn’t Always Mean Higher Cost
1. Why Direct Unit Price Comparison Is Misleading
When a new generation of large models launches at a public unit price several times higher than the previous flagship, the most common community reaction is to divide one price sheet by another and declare the new model “expensive.” That approach does not hold up in engineering practice. Inference billing usually separates input and output, and real workloads vary widely in the ratio between the two. More importantly, unit price only describes how much each unit of billable usage costs; it says nothing about how many useful results can be produced per unit of time.
The genuinely useful insight in the original discussion is this: if you put a mid-tier specification of the new generation in the same chart as the high-throughput tier of the previous flagship, the conclusion may reverse entirely. This tells us that cost evaluation must return to two engineering metrics: throughput and latency.
2. Three Layers of Cost
1. Nominal Price
The per-thousand-token price on the price sheet, usually quoted separately for input and output. It is convenient for quick estimates but says nothing about queuing, retries, or concurrency capacity.
2. Effective Cost
Actual spending after accounting for failed retries, repeated context transmission, and system prompt overhead. In production this figure is often tens of percent higher than the nominal price.
3. Cost per Task
The final measure: how much it costs to complete one user-visible task. It equals effective cost divided by the task success rate and the first-pass rate, and it is the only metric suitable for technical selection decisions.
3. Why Throughput Matters More Than Unit Price
The generation rate of autoregressive decoding determines the usable capacity per unit of time. If two model tiers differ by several times in unit price but by an order of magnitude in output rate, then under fixed concurrency and a fixed budget, the latter may actually complete more tasks.
Throughput differences usually come from three places: the parallel strategy used during decoding, batch scheduling efficiency, and reduced computation in attention and vocabulary projection for mid-tier specifications. In engineering you do not need to know the specific implementation; you only need load tests to quantify the difference:
# Illustrative: compare effective capacity of two service tiers under a fixed workloaddef bench(client, prompt, concurrency=32, rounds=50):lat, ok = [], 0for _ in range(rounds):t0 = time.time()r = client.chat(prompt, max_tokens=512)if r.status == 200:ok += 1lat.append(time.time() - t0)lat.sort()return {"p50": lat[len(lat)//2],"p95": lat[int(len(lat)*0.95)],"success": ok / rounds,"tokens_per_sec": 512 * concurrency / sum(lat),}
4. Latency Structure: Separate Time-to-First-Token from Token Rate
The streaming experience is determined by two independent metrics: time-to-first-token (queuing plus prefill) and token generation rate (decoding). The advantage of mid-tier specifications usually concentrates in token generation rate, which benefits long-output scenarios such as code completion and conversational interaction the most. For classification tasks with short input and short output, the bottleneck is time-to-first-token, and the marginal advantage of a high-priced flagship is diluted.
Selection guidance by scenario:
| Scenario | Primary Bottleneck | Cost Sensitivity |
|---|---|---|
| Intelligent code completion | Token rate | Output billing volume |
| Long-document summarization | Time-to-first-token | Input billing volume |
| Batch extraction and classification | Total throughput | Cost per task |
| Hard reasoning | First-pass rate | Number of retries |
5. Converting Unit Price into Cost per Task
Cost per task = (input tokens × input price + output tokens × output price)× (1 + retry rate) / first-pass rate
Example: if one tier generates output faster and uses context more efficiently, then even at twice the unit price, cost per task may still drop as long as the retry rate is lower and each output is shorter. Conversely, if the workload requires repeated re-feeding of long multi-turn context, input billing volume will dominate the bill, and the disadvantage of the higher unit price will be amplified.
6. System-Level Cost Reduction Practices
- Context governance: trim history, compress system prompts, and cache and reuse repeated fragments to directly cut input billing volume.
- Tiered routing: use small specifications for high-frequency simple requests and escalate only difficult requests to larger specifications; this is the most reliably beneficial move.
- Structured constrained output: use schema constraints to reduce invalid generation and parsing failures, lowering the retry rate.
- Batching and asynchrony: send offline tasks through batch channels and reserve the interactive path for low-latency tiers.
- Observability: use logging services and monitoring alerts to build per-tier dashboards for latency, success rate, and cost, so cost decisions are backed by data.
7. Conclusion
A rising unit price is not by itself evidence that something is “expensive.” The right criteria are whether cost per business task decreases under the target latency constraint and whether the first-pass rate improves. Moving the evaluation basis from the price sheet to load test data is the only rigorous way to answer this kind of question. If an organization wants to run the load testing and governance capabilities described above in its own environment, it can build on general product categories such as the container platform, logging service, and monitoring alerts offered by Baidu AI Cloud.
