LLM Inference Cost: A Practical Guide to Measuring Token Rates and Tiered Scheduling
This article shows how to measure real LLM inference costs without relying on official price lists. Using usage logs as samples, it applies least-squares regression to estimate per-million-token consumption rates, compares four model tiers that differ by up to two orders of magnitude, converts a fixed credit budget into token capacity, and outlines a tiered scheduling strategy, cache-aware context design, and ongoing cost calibration. The method matters more than the specific numbers.
1. Background: Why Affordability Is Harder Than Quality
Once a large language model is wired into real business workflows, the first obstacle is usually not output quality but the bill. A routine conversational coding, document summarization, or data extraction task may cost almost nothing in a demo environment. In a 24/7 production pipeline, however, cost scales linearly with call volume. It gets worse: most platforms expose only abstract units such as “credits” or “quotas” and never state the conversion to cost per million tokens, so capacity planning becomes guesswork.
The approach here does not depend on any official price list. Instead, it treats real usage records as observation samples, uses least-squares regression to infer the unit consumption rate for each model class, and builds a tiered scheduling strategy on top of that. One caveat up front: this reverse estimation is based on personal measurements, and the rules can change at any time. The method has more long-term value than the specific numbers.
2. Method: Inferring Unit Token Cost with Linear Regression
The core assumption is simple: credits consumed over a period equal a linear combination of input tokens and output tokens, plus a constant term.
import numpy as np# X: [input tokens (millions), output tokens (millions), 1 (intercept)]# y: credits actually deducted for the batchX = np.array([[0.82, 0.18, 1],[0.75, 0.25, 1],[0.88, 0.12, 1],])y = np.array([86000, 121000, 74000])coef, residual, rank, _ = np.linalg.lstsq(X, y, rcond=None)input_rate, output_rate, bias = coefpred = X @ coefr2 = 1 - ((y - pred) ** 2).sum() / ((y - y.mean()) ** 2).sum()print(input_rate, output_rate, bias, r2)
With enough samples and a consistent measurement basis, the goodness of fit approaches 1 and the residuals approach zero. This confirms that billing is indeed linear and that the inferred rates are credible. Three engineering points matter. First, samples must cover different input/output ratios; otherwise the coefficients are not identifiable. Second, dirty data from failed retries and interrupted streams must be removed. Third, cache hits must be modeled separately and never mixed into normal input.
3. Findings: Model Tiers Differ by Two Orders of Magnitude
Expressed as credits per million tokens, the fitted results make the tier gap obvious:
- Flagship reasoning tier: about 80,000 input, 400,000 output;
- Balanced reasoning tier: about 32,000 input, 112,000 output;
- High-speed execution tier: about 4,000 input, 8,000 output, with cache hits as low as 80;
- Lightweight batch tier: 2,000 for both input and output.
Two ratios stand out. The flagship tier’s output rate is roughly 200 times the lightweight tier’s, and the high-speed tier’s input cost drops to just 2% of the normal rate on a cache hit. The first means that having a flagship model write long-form text is the most expensive usage pattern. The second means that for repeated-prefix scenarios, nearly all the optimization headroom lies in caching.
4. Budget Conversion: How Many Tokens a Fixed Credit Allowance Buys
Given an allowance of 60,000 credits per 5 hours and 600,000 credits per week, assuming 80% input, 20% output, and no cache for now, the supported token volume is roughly:
| Tier | Approx. tokens per 5 hours |
|---|---|
| Flagship reasoning tier | 417,000 |
| Balanced reasoning tier | 1,250,000 |
| High-speed execution tier | 12,500,000 |
| Lightweight batch tier | 30,000,000 |
The same budget spans about a 70x difference between tiers. That is the economic driver for tiered scheduling: split tasks by whether they need deep thinking, and route each to the matching tier.
5. Tiered Scheduling: Expensive Models Think, Cheap Models Execute
The recommended division of labor: the flagship tier handles task planning and final review; the balanced tier handles complex reasoning and hard debugging; the high-speed tier carries the bulk of code generation and rewriting; the lightweight tier handles simple tasks such as batch classification, format conversion, and field extraction.
request -> task classifier|- planning/review -> flagship reasoning tier|- complex reasoning -> balanced reasoning tier|- main execution -> high-speed execution tier (cache hit preferred)|- simple batch -> lightweight batch tier
Two implementation points matter. First, the classifier itself must be extremely lightweight, using rules plus a small model, to avoid spending a large amount to save money. Second, the review step should return only the diff fragments rather than the full text, which significantly compresses input volume on the high-priced tier.
6. Caching and Context Governance
Since a cache hit can cut input cost to 2%, how context is organized directly affects the bill. Practical measures include: keeping the system prompt, tool definitions, and reference material fixed at the very front of the request and byte-for-byte stable; placing volatile user input at the end; avoiding anything that breaks the cache, such as timestamps or random IDs inserted mid-conversation; and generating a structured summary of long documents before reuse.
[stable prefix: system prompt + tool schema + reference docs] <- cacheable[semi-stable zone: summaries of multi-turn history] <- partially cached[volatile zone: current user input] <- not cached
7. Observability and Continuous Calibration
Cost governance must be a closed loop: log the tier, input/output tokens, cache hit flag, and credits deducted for every call; aggregate an hourly unit-price dashboard; and set budget alerts and circuit-breaker thresholds. When the actual deduction deviates from the model’s prediction beyond the threshold for a sustained period, resample and refit to update the coefficients. This way, even if billing rules change, the system catches up within one or two cycles instead of discovering the overspend at month end.
