Token Cost Modeling and Tiered Scheduling for Large Language Model Workloads
Large language model token costs are often compared as a single price per million tokens, but real inference economics depend on input/output pricing asymmetry, cache-hit discounts, model tiers, and quota time windows. This article presents a practical framework for modeling token cost as a vector, inferring unit consumption rates from historical usage, comparing model tiers with relative cost multipliers, estimating quota-constrained throughput, and applying tiered routing, caching, and batch processing to improve cost efficiency.
1. The Core Problem: Token Cost Is a Vector, Not a Single Price
Many teams evaluate large language model costs by comparing only “price per million tokens.” That is an oversimplification. Real inference cost is determined by at least four dimensions:
- Asymmetric input and output pricing: The output stage requires autoregressive generation token by token, which is far more compute-intensive than parallel prefill of the input. As a result, output unit prices are often several times—or even dozens of times—higher than input prices.
- Cache-hit discounts: When request prefixes such as system prompts, long documents, or code context are reused, the cached input portion is often billed at a very low ratio.
- Model tier differences: On the same platform, models at different capability tiers may differ in unit price by one to two orders of magnitude.
- Quota time granularity: Hourly, weekly, and monthly quotas directly affect the effective work that can be completed per unit time, not just the total cost.
The right approach is therefore to express cost as a vector rather than a scalar:
CostVector = (P_in, P_out, P_cache, Q_window)
Here, P_in / P_out / P_cache are the unit prices for input, output, and cache hits, and Q_window is the quota cap within the time window. Cost comparisons are meaningful only when all four quantities are defined.
2. Inferring Unit Costs from Real Usage Records
Most platforms expose only “credits/quota consumed” rather than direct unit prices. In this case, you can use linear regression to infer rates. Let the input token count of session i be x_i, the output token count be y_i, and the consumed quota be c_i. The model is:
c_i = a · x_i + b · y_i + ε_i
Use least squares to solve for coefficients a and b, which represent the unit consumption rates for input and output. A schematic implementation:
import numpy as npdef infer_rates(X_in, Y_out, credits):A = np.column_stack([X_in, Y_out])(a, b), residuals, rank, _ = np.linalg.lstsq(A, credits, rcond=None)pred = A @ np.array([a, b])ss_res = float(((credits - pred) ** 2).sum())ss_tot = float(((credits - credits.mean()) ** 2).sum())r2 = 1 - ss_res / ss_tot if ss_tot else 1.0return {"input_rate": a, "output_rate": b, "r2": r2,"max_abs_residual": float(np.abs(credits - pred).max())}
Fit quality criteria: An R² close to 1 and a maximum absolute residual close to 0 indicate that the billing model is indeed linear and that the samples cover a sufficient range of input/output ratios. If residuals are significant, it usually means a cache term was omitted or that there is a minimum billing unit. In that case, add cache-hit volume as a third independent variable in the regression.
Note that fit results are valid only for your own account, time window, and call structure. They are engineering measurements, not any official price list. Rules may change at any time, so periodic re-measurement is required.
3. Relative Cost Multipliers: More Useful Than Absolute Prices
Absolute unit prices change with commercial strategy, but relative multipliers are relatively stable over a period and are better suited for architecture decisions. Taking the unit output cost of a lightweight-tier model as the baseline of 1, a typical capability gradient looks roughly like this (the values are hypothetical and only demonstrate the calculation method):
| Model tier | Input multiplier | Output multiplier | Cache-hit multiplier |
|---|---|---|---|
| Flagship reasoning tier | ~40 | ~200 | ~4 |
| Mid-tier reasoning tier | ~16 | ~56 | ~1.6 |
| General execution tier | ~2 | ~4 | ~0.2 |
| Lightweight batch tier | 1 | 1 | ~0.1 |
Two key conclusions follow: output costs can differ by about two orders of magnitude between flagship and lightweight tiers; and after a cache hit, cost can drop to a few percent of the normal input unit price. This means context reuse rate often has a larger impact on the total bill than switching models.
4. Estimating Effective Throughput Under Quota Constraints
Let the time-window quota be Q, the input share be α, and the output share be β (α+β=1, ignoring cache for now). The total number of tokens that can be processed is:
Tokens_total = Q / (α · P_in + β · P_out)
Using α=0.8, β=0.2 and the multipliers from the table above (with the baseline unit price normalized to 1), the token volume per unit quota is:
- Flagship reasoning tier: ~417K
- Mid-tier reasoning tier: ~1.25M
- General execution tier: ~12.5M
- Lightweight batch tier: ~30M
With the same quota, tier selection creates a throughput difference of about 70x. This is the entire economic motivation for tiered scheduling.
5. Tiered Scheduling: High-Cost Models “Think,” Low-Cost Models “Execute”
Splitting tasks by reasoning-depth requirements is the highest-return strategy:
- Flagship tier: task decomposition, solution design, final review, and high-risk change review. Target share: <5% of tokens.
- Mid tier: complex logical reasoning, difficult defect localization, and cross-module refactoring analysis.
- General execution tier: primary coding, routine rewriting, test generation, and log analysis.
- Lightweight tier: batch classification, format conversion, comment completion, and large-scale summarization.
Routing decisions should be based on observable features rather than manual assignment:
def route(task):if task.risk == "high" or task.requires_global_reasoning:return "flagship"if task.estimated_output_tokens > 4000 or task.complexity >= 3:return "mid"if task.batch_size > 50 or task.deterministic:return "lite"return "general"
Three supporting engineering constraints:
- Mandatory high-end review loop: All final merged results must be reviewed by the flagship tier to avoid low-cost models self-certifying correctness.
- Context trimming before routing: Perform retrieval and trimming before routing, and reduce the input sent to the flagship tier to the minimum necessary set.
- Escalate only after repeated failures: Low-cost tier failures should first be retried and decomposed. Only consecutive failures should trigger a tier upgrade, preventing runaway cost.
6. Make Caching and Batch Processing Infrastructure
- Prefix stabilization: Place system prompts, tool definitions, and long documents at the very beginning of the request and keep them byte-stable. Avoid dynamic timestamps that break the cache.
- Include cache hit rate in monitoring: Hit rate is the most sensitive leading cost indicator. Sample it hourly and set threshold alerts.
- Batch asynchronously: Route latency-insensitive batch tasks through asynchronous queues, and use elastic scaling on the container platform to consume them during idle quota windows.
- Data retention and auditing: Store request metadata (excluding sensitive body content) in object storage for offline fitting and cost attribution; send metrics into the logging service and monitoring/alerting system.
7. Common Pitfalls
- Budgeting only with average unit prices and ignoring several-fold deviations caused by changes in input/output ratios.
- Ignoring caching, causing the budget to be overestimated or underestimated by an order of magnitude.
- Fitting once and never re-measuring, so the model becomes invalid after rule changes.
- Letting low-cost models make final decisions, where rework costs far exceed the saved API fees.
- Treating demonstration multipliers as real quotes in external commitments.
8. Summary
The core of cost governance is not price cutting, but a measurable cost model + an executable scheduling strategy + a verifiable feedback loop: use regression to infer unit consumption rates from historical records, use relative multipliers rather than absolute prices for architecture choices, use tiered routing to concentrate expensive reasoning on a small number of key decisions, use caching and batch processing to amplify quota value, and use R², residuals, and hit rate to continuously validate whether the model still holds. All numerical values above are hypothetical and only demonstrate the calculation method; use measured data from your own account for actual decisions.
