LLM Inference Cost Evaluation: Why a Higher Token Price Does Not Always Mean Higher Cost
This article explains how to evaluate large language model inference costs beyond the published per-token price. It separates unit price from unit task cost, then walks through four evaluation dimensions: output throughput and latency percentiles, concurrency and stability, first-pass task completion rate, and total cost of ownership. It includes benchmarking and cost-calculation code samples, plus practical recommendations such as building a small regression set, optimizing prompts and structured output, tiered routing, caching and batching, and observability. The conclusion is that a price increase only translates into a larger bill when throughput, stability, and first-pass accuracy fail to improve.
1. The Core Issue: Unit Price Is Not Cost
When a new-generation LLM service is priced at several times the flagship rate of the previous generation, debating whether it is “expensive” easily turns into an emotional argument. A sound technical judgment needs to separate two concepts: unit price (the listed price per million input/output tokens) and unit task cost (the actual spend required to complete one business task).
A higher price per call does not mean the total cost of completing the same business rises. If the new model compresses output length, reduces retries, and shortens end-to-end latency on the same task, the unit task cost may actually drop. Conversely, if you simply port the same prompts over unchanged, cost scales up strictly in proportion.
The evaluation process should therefore be: first define what “done” means for the business task, then measure the resource consumption of each candidate service against that standard, and finally convert it into a monthly bill.
2. Four Evaluation Dimensions
2.1 Output Throughput and Latency Distribution
The time cost of generative tasks is driven mainly by the number of output tokens. The output phase is typically bound by token-by-token decoding, so throughput directly determines how long users wait. Do not look only at averages; collect P50/P95/P99 percentiles:
# Sample: collect latency percentiles and output throughputimport time, statisticsdef bench(client, prompt, n=50):lat, out_tokens = [], []for _ in range(n):t0 = time.perf_counter()resp = client.chat(prompt) # unified wrapper for the service calllat.append(time.perf_counter() - t0)out_tokens.append(resp.usage.output_tokens)lat.sort()p = lambda q: lat[int(len(lat) * q)]return {"p50": round(p(0.5), 2),"p95": round(p(0.95), 2),"output_tps": round(sum(out_tokens) / sum(lat), 1),}
If the new-generation service delivers significantly higher output throughput, interactive scenarios (code completion, customer support replies) can often relax timeout thresholds and reduce waiting on streaming chunks, which is equivalent to serving more sessions on the same budget.
2.2 Concurrency and Stability
If a high-priced model shows a lower error rate and less throttling at the same concurrency level, its effective cost drops further. It is worth running a fixed concurrency gradient (for example 5/20/50) to observe the distribution of error codes and queueing time, and counting “failed retries” into the total cost:
effective cost = (calls + failed retries) x per-call price + business loss from queueing
2.3 Task Completion Rate (First-Pass Rate)
This is the most easily overlooked variable and the one with the largest impact. Raising the first-pass rate from 70% to 90% nearly halves the work of human review and regeneration. To measure it, compute the share of “accepted without modification” over a labeled set, and record the average output length at the same time: a more concise but equally correct answer directly reduces billed output tokens.
2.4 Total Cost of Ownership
Feed the metrics above into a unified model:
def monthly_cost(price_in, price_out, calls, in_tok, out_tok, retry_rate=0.0):total = calls * (1 + retry_rate)return total * (in_tok * price_in + out_tok * price_out) / 1_000_000
Plug the same workload into both generations of service: if the new generation produces fewer output tokens and a lower retry rate, the total price gap will be far smaller than the unit price gap.
3. Practical Recommendations
- Build a small regression set: 100-300 real business samples covering long text, structured output, and code generation, used as a cross-version baseline.
- Optimize prompts and structured output: explicit output format constraints, length limits, and splitting complex tasks can significantly compress output tokens.
- Tiered routing: send simple requests to a lightweight tier and complex requests to a higher-capability tier, splitting traffic with rules or a lightweight classifier; this is the most effective cost control lever.
- Caching and batching: cache repeated prefixes, and run offline tasks as asynchronous batches, using object storage and message queues to decouple and smooth peaks.
- Observability: track token consumption, latency percentiles, and failure rates continuously through logging services and monitoring alerts, so cost optimization has data to stand on.
4. Conclusion
A 2.5x increase in unit price is not in itself a verdict of “expensive.” The increase only translates proportionally into bill pressure when output throughput, stability, and first-pass rate fail to improve alongside it. Run a two-week canary comparison per business task and produce conclusions with a unified cost model; if you need elastic compute plus supporting data and monitoring capabilities for load testing and canary releases, general cloud product categories from Baidu AI Cloud can be used to set up the environment and collect metrics, so the selection decision rests on reproducible data.
