LLM Inference Cost: Benchmarking Real Usage and Building Tiered Model Routing
Choosing a cheaper model per token does not always lower your monthly bill. This article explains why, then shows how to measure actual unit consumption rates by fitting usage logs with least squares, compares four model tiers (flagship reasoning, strong reasoning, general fast, and lite) by cost and usable throughput under a credit quota, and lays out a tiered routing strategy in which expensive models plan and cheap models execute, plus prompt caching and context governance practices to amplify the savings.
1. Why a Low Unit Price Does Not Mean a Low Bill
When building an intelligent coding assistant, a code review pipeline, or a multi-agent system, teams often run into the same puzzle: they picked a model with a lower unit price, yet the end-of-month bill did not drop as expected. There are usually three reasons.
First, billing units are not consistent across services. Providers differ substantially in how they price input, output, and cache hits. Output is typically priced much higher than input, and agent workloads are exactly the output-heavy kind.
Second, the structure of the workload gets ignored. In a real coding task, the input generated by reading code, retrieving context, and assembling prompts is often far larger than the code finally produced. The input-to-output ratio can reach 8:2 or even 9:1.
Third, observability is missing. Most teams track only the total number of calls and never look at the token distribution, so they cannot locate where the money actually goes.
The first step in cost governance, therefore, is not switching models but establishing a measurable metrics system.
2. Method: Deriving Unit Consumption Rates from Real Usage
When public billing details are unavailable, you can take an engineering approach of empirical fitting: fix a task set, record the input tokens, output tokens, and account credit change for each session, then use least squares to fit a unit consumption coefficient for each model tier.
Sample code for data collection and fitting:
# Sample structure: one row per session# in_tokens, out_tokens, cache_hit_tokens, creditssamples = load_usage_log()# Design matrix: input / output / cache hitX = [[s.in_tokens, s.out_tokens, s.cache_hit_tokens] for s in samples]y = [s.credits for s in samples]# Solve for unit consumption rates (pseudocode; any numerical library works)coef = lstsq(X, y) # [k_in, k_out, k_cache]r2 = r_squared(y, predict(X, coef))
When the goodness of fit approaches 1 and the residuals are close to 0, the model is in fact billed linearly, and the coefficients can be used for budget projections. Note that such results come from personal measurement and will change as the rules change, so in engineering practice the coefficients should be configuration items rather than hard-coded values.
3. Benchmark Results: The Cost Gap Between Tiers Is Enormous
Fitting four tiers (flagship reasoning, strong reasoning, general fast, and lite) with the method above yields the following order of magnitude:
- Flagship reasoning: about 80,000 credits per million input tokens, about 400,000 credits per million output tokens;
- Strong reasoning: about 32,000 input, about 112,000 output;
- General fast: about 4,000 input, about 8,000 output;
- Lite: about 2,000 for both input and output.
Two key takeaways are worth remembering:
- The output cost of the flagship tier is roughly 200 times that of the lite tier. The gap between tiers is a matter of orders of magnitude, not percentages.
- On cache hits, the input cost of the general fast tier can drop to about 2% of its normal input unit price. This is the most significant optimization lever for long-context, repeated-call scenarios.
4. Converting a Credit Quota into Usable Capacity
Assume a quota of 60,000 credits per 5 hours and 600,000 credits per week. Estimating with 80% input and 20% output, and ignoring caching for now, the token volume that can be supported is roughly:
| Tier | Approx. tokens processable per 5 hours |
|---|---|
| Flagship reasoning | 417,000 |
| Strong reasoning | 1,250,000 |
| General fast | 12,500,000 |
| Lite | 30,000,000 |
The point of this table is that capacity and tier selection directly determine the throughput ceiling of the system. If all traffic goes to the flagship tier, only about 400,000 tokens of useful work can be completed within the five-hour window, which is practically unusable for a multi-agent system.
5. Tiered Routing: Let Each Model Do What It Is Good At
The conclusion translates into one clear engineering principle: expensive models do the thinking, cheap models do the work.
- Flagship reasoning: task planning, architecture decisions, final solution review;
- Strong reasoning: complex logical reasoning, hard-to-diagnose defect localization;
- General fast: the main workhorse, handling the vast majority of code generation and rewriting;
- Lite: batch simple tasks such as formatting cleanup, comment completion, and log categorization.
A minimal, deployable router:
def route(task):if task.risk == "high" or task.needs_plan:return "flagship" # planning and final reviewif task.complexity >= 3:return "reasoning" # complex reasoningif task.batch and task.simple:return "lite" # batch simple tasksreturn "fast" # main workhorse
Recommended additions: log the tier, token distribution, and credit consumption for every call to build a cost dashboard; set quotas and a manual confirmation step for flagship-tier calls so that the planning phase cannot inflate the bill out of control.
6. Caching and Context Governance
Cache hits can push the cost of repeated input down to almost nothing, but capturing that benefit requires work on the engineering side:
- Keep the prompt prefix stable and move volatile content to the end to improve prefix reuse;
- Manage static context such as long documents and code repository indexes centrally, instead of re-injecting it in every session;
- Deduplicate and trim retrieval results to control useless input;
- Add a cache hit rate metric to the monitoring and alerting system, observed together with cost metrics.
7. Common Pitfalls and a Governance Checklist
- Running the entire workflow on a single flagship model, which is both the most expensive and the lowest-throughput option;
- Looking only at unit price and ignoring the output multiplier, which badly distorts the budget;
- Ignoring the input share and skipping context compression;
- Hard-coding the measured coefficients, which breaks as soon as the rules change;
- Lacking tier-based routing and quotas per task, leaving cost uncontrollable.
In summary, the core of LLM cost governance is not finding “the cheapest model” but building a closed loop of measure, attribute, and schedule: first derive unit consumption rates through empirical fitting, then route by task risk and complexity, and finally use caching and context governance to amplify the gains. If you need managed model services plus logging and monitoring capabilities, you can build this closed loop yourself on top of the relevant general cloud products from Baidu AI Cloud.
