Token Cost Modeling for Tiered Multi-Model Routing
Learn how to model token costs across model tiers using request-level usage data, cache behavior, and credit consumption. This article covers cost fitting, task-based routing, budget estimation, and operational controls for balancing cost, quality, and latency.
1. Why Multi-Model Costs Become a Black Box
When an application moves from a single model to multiple models working together, cost is no longer a simple comparison of unit prices. It becomes a system-level problem shaped by input tokens, output tokens, cache hits, task success rates, retries, and routing policies.
This is especially apparent with credit-based token plans. Users often see a credit pool and usage records rather than directly comparable prices per million tokens. Developers need to answer more practical questions: How many tasks can a fixed budget complete? Which tasks justify a more expensive model? Which should run in bulk on a lower-cost model?
Without cost modeling, three problems commonly emerge:
- Expensive models handle large volumes of simple tasks, quickly exhausting the budget.
- Low-cost models take on critical planning tasks, causing rework and retries that increase total cost.
- Uncontrolled caching behavior, context reuse, and output length cause actual consumption to diverge from estimates.
Model selection therefore needs to move beyond intuition and become a measurable, observable engineering policy with fallback options.
2. Estimating Unit Costs from Anonymized Usage Data
An anonymized usage analysis can break each request into four billing fields: input tokens, output tokens, cache-hit tokens, and credits consumed. Assuming an approximately linear relationship, consumption can be modeled as:
# S = r_in * (T_in - T_hit) + r_out * T_out + r_cache * T_hit + epsilon# r_in: Credit cost per uncached input token# r_out: Credit cost per output token# r_cache: Credit cost per cached input token# epsilon: Residual error
Least-squares fitting across a large set of request records can estimate the unit consumption rates for each model tier. In the analyzed sample, the linear fit was very strong, with residuals close to zero. Within the observed range, credit consumption was largely explained by input, output, and cached input tokens.
These estimates were reverse-engineered from personal usage records, not taken from an official price list. Billing rules may change, so the results should not be treated as a long-term pricing commitment.
The anonymized results showed clear order-of-magnitude differences:
- The highest-cost model’s output token rate was approximately 200 times that of the lowest-cost model.
- Mid-tier models fell between those extremes.
- For one low-cost model, cached input cost approximately 2% of the normal input rate.
Cost differences therefore depend not only on model size, but also on the input-output mix, caching strategy, and task allocation.
Consider an illustrative allowance of 60,000 credits per five hours and 600,000 credits per week. With an 80% input and 20% output token mix, excluding caching, estimated capacity varied by roughly two orders of magnitude:
- High-cost tier: hundreds of thousands of tokens per five hours.
- Mid-cost tier: around a million tokens per five hours.
- Low-cost tier: around ten million tokens per five hours.
- Lowest-cost tier: tens of millions of tokens per five hours.
The point is not to memorize these approximate figures. It is to establish a useful relationship between budget, workload, and model tier.
3. What Drives Cost—and Where to Optimize
Output Tokens Often Cost More Than Input Tokens
Output token rates are often substantially higher than input token rates. Generating output requires sequential, token-by-token computation. Controlling output length through structured responses, maximum output limits, and stop conditions can therefore be more effective than focusing only on input compression.
Cache Hits Change Input Economics
Stable system prompts, fixed specifications, repeated retrieval context, and similar code prefixes can benefit from caching. If cached input costs only 2% of uncached input, workloads with frequent reuse should prioritize stable prefixes and context deduplication.
Failures and Retries Increase the Real Cost
A failed call consumes credits and may trigger additional retries or human review. Cost analysis should therefore focus on cost per successful task, not just cost per request.
Model Capability Should Match Task Value
High-cost models are best reserved for high-value stages with relatively small token volumes, such as planning, review, and difficult diagnosis. Lower-cost models are better suited to frequent, simpler tasks such as classification, extraction, formatting, cleaning, and batch summarization.
4. Tiered Routing: Expensive Models Plan, Cheaper Models Execute
A routing policy can divide work into four layers:
- Planning and final review: Use the high-cost tier for requirement decomposition, solution design, critical code review, and final quality checks. Limit output length and require structured results to avoid unnecessarily long responses.
- Complex reasoning: Use the mid-cost tier for multistep reasoning, complex code changes, difficult troubleshooting, and cross-file analysis.
- Primary execution: Use the low-cost tier for routine generation, document organization, tool calls, everyday question answering, and moderately complex tasks.
- Simple batch processing: Use the lowest-cost tier for bulk classification, field extraction, format conversion, log cleaning, and simple summaries.
The routing logic can be expressed as:
def route(task, budget_state):if task.risk_level == "high" or task.needs_planning:return "tier_A" # High-cost tier: planning and reviewif task.reasoning_depth > task.threshold:return "tier_B" # Mid-cost tier: complex reasoningif task.is_batch and task.is_simple:return "tier_D" # Lowest-cost tier: simple batch tasksreturn "tier_C" # Low-cost tier: primary execution
Production implementations should also include budget guardrails. When weekly consumption exceeds a threshold, automatically move noncritical tasks to cheaper tiers. If a high-cost call fails, follow a high-to-mid-to-low fallback chain. If quality evaluations for a low-cost tier deteriorate, send a sample of tasks to the mid-cost tier for review.
5. Budget Conversion and Sensitivity Analysis
Given a credit pool, input-output mix, cache-hit ratio, and unit costs for a model tier, token capacity can be estimated as follows:
def token_capacity(pool, in_ratio, out_ratio,r_in, r_out, cache_ratio=0.0, r_cache=None):if r_cache is None:r_cache = r_incost_per_token = (in_ratio * ((1 - cache_ratio) * r_in + cache_ratio * r_cache)+ out_ratio * r_out)return pool / cost_per_token
Capacity is sensitive to several factors:
- A higher output share can substantially reduce the number of tokens the budget supports.
- A higher cache-hit ratio reduces input-side costs.
- More retries multiply consumption through additional attempts.
Budget planning should therefore maintain baseline, conservative, and warning-level scenarios rather than a single static estimate. Update these scenarios using observed usage.
6. Implementation: Metering, Monitoring, and Degradation
A practical implementation should provide at least four capabilities:
- Metering: Record input tokens, output tokens, cache-hit tokens, model tier, latency, and success status for every request.
- Cost accounting: Aggregate consumption by request, task, user, or tenant.
- Monitoring: Track budget burn rate, cost per successful task, cache-hit ratio, and the share of requests moved to cheaper tiers.
- Evaluation: Use a fixed evaluation set and sampled human review to detect changes in quality.
Cache management should prioritize stable system prompts, repeated specifications, shared context, and similar prefixes.
Output management should use maximum output limits, JSON Schema, stop conditions, and summarization-based compression.
Degradation policies should preserve fallback chains and circuit breakers. The goal is to make cost, quality, and latency observable, tunable, and recoverable—not simply to minimize the price of an individual call.
7. Limitations and Key Takeaways
Unit costs inferred from usage samples describe the relationship observed in those samples; they are not official pricing commitments. Refit the model when plan rules, model versions, caching policies, or workload distributions change.
The central question in tiered multi-model routing is not “Which model is always cheapest?” It is “Which cost tier is appropriate for the value and requirements of this task?”
Reserve higher-cost models for planning and review, use lower-cost models for routine execution and batch processing, and combine that routing policy with caching, output controls, and budget monitoring. Together, these practices make token costs more predictable while keeping quality within acceptable limits.
