Cost Modeling and Tiered Routing for Multi-Model LLM Calls
This article presents a neutral, reusable method for estimating and controlling the cost of calling multiple large language models under token-based or credit-based pricing. It explains why unit price alone is misleading, how to back-calculate per-token credit rates from billing logs, how to convert relative costs into budget capacity, how caching and retries affect spending, and how to build a four-tier routing strategy supported by monitoring and regular calibration.
In token-based or credit-based plans, a common mistake is to compare only the price per million tokens. This overlooks several factors: input and output prices are asymmetric, cache hits are discounted, budget windows limit usage, and retries consume credits again. A more reliable approach is to treat model calls as a cost system that can be modeled. First, back-calculate the credit consumption rate per token from real billing data. Then route tasks into tiers based on complexity. Finally, keep calibrating the model with monitoring data. This article presents a neutral, reusable method that does not depend on any vendor’s price list. The numbers shown are anonymized samples and illustrative assumptions only.
1. Problem Definition: Why Model Cost Cannot Be Judged by Unit Price Alone
Cost differences between models usually come from four dimensions: input price, output price, cache-hit price, and available credits within the budget window. Output tokens often cost more than input tokens because generation involves decoding step by step. Long-context tasks increase cost through large input volumes. Cache hits can significantly reduce the input cost of repeated prefixes. Credit-based plans often have both short-term and long-term budget windows, and these windows directly determine how many requests can be handled in a given period.
Therefore, deciding whether a model is “cheap” requires looking at the total cost under the target workload, not just the list price. For example, a high-capability model with a high output price may cost far less overall if it is used only for planning, review, and a small number of key decisions, rather than for bulk execution. Conversely, a lightweight model with low input and output prices can lose its advantage if it is used for complex reasoning, because repeated retries and long outputs can offset the savings.
2. Cost Model and Back-Calculation Method
Let a model cost a credits per million input tokens, b credits per million output tokens, and c credits per million cache-hit tokens. The credit consumption of a single request can be approximated as:
cost = input_tokens / 1e6 * a+ output_tokens / 1e6 * b+ cache_hit_tokens / 1e6 * c+ retry_overhead
If caching and retries are ignored for now:
cost = 0.8 * a + 0.2 * b // Example with 80% input and 20% output
For back-calculation, collect request logs over a period of time. Each log entry should include input tokens, output tokens, cache-hit tokens, actual credits consumed, whether the request was a retry, and the task type. For each model, fit a linear regression or least-squares model to solve for a, b, and c. In the anonymized samples, a goodness of fit close to 1 and residuals close to 0 indicate that actual billing closely matches the linear model, so the fitted values can be used for budget conversion. This result is back-calculated from an individual or team’s billing data. It is not an official price list. Billing rules, caching policies, and window rules may change, so the calculation should be repeated regularly.
3. Relative Multipliers and Budget Conversion
Relative multipliers are more useful than absolute prices for routing decisions. The anonymized samples showed three patterns. The output cost of a high-capability model can reach roughly 200 times that of a lightweight model. The cost of a cache hit can drop to about 2% of the normal input cost. The input and output multipliers also differ across models. These patterns suggest that high-cost capability should be concentrated on thinking and reviewing, while low-cost capability should handle execution and batch work.
Assume a credit-based plan provides 60,000 credits per 5 hours and 600,000 credits per week. Also assume a workload of 80% input and 20% output, with caching ignored. Usable token capacity can then be estimated as budget / (0.8*a + 0.2*b). The illustrative results are as follows:
| Model tier | Typical responsibilities | Illustrative capacity within a 5-hour window |
|---|---|---|
| High-capability model | Planning, final review | About 417,000 tokens |
| Mid-tier reasoning model | Complex reasoning, difficult analysis | About 1.25 million tokens |
| Low-cost execution model | Main execution, routine generation | About 12.5 million tokens |
| Lightweight batch model | Batch simple tasks | About 30 million tokens |
The numbers in the table only illustrate the method. With the same budget, a lightweight model may handle tokens at an order of magnitude or more above a high-capability model. In engineering practice, budget should go to decision points and execution paths, not be split evenly across all calls.
4. Caching: An Underestimated Cost Lever
Caching is a key lever for cost optimization. For scenarios with a fixed system prompt, stable retrieval ordering, and a high rate of repeated prefixes, caching can reduce the cost of repeated input to a very low level. In practice, keep system prompts and templates stable, reduce random ordering, split and summarize long documents, place frequently used knowledge at the front of the prompt, and record the cache hit rate as part of monitoring.
Caching is not a cure-all. If request prefixes change frequently, the hit rate will drop. Teams should measure actual cached tokens from logs rather than rely on assumptions.
5. Tiered Routing: High-Cost Models Plan, Low-Cost Models Execute
Four-tier routing is recommended:
- High-capability model: Handles requirement breakdown, solution planning, risk review, and final quality control. It is called infrequently but determines overall quality.
- Mid-tier reasoning model: Handles complex reasoning, cross-document analysis, and difficult code explanations at medium frequency.
- Low-cost execution model: Handles main generation, routine rewriting, structured extraction, and general Q&A.
- Lightweight batch model: Handles classification, tagging, simple summarization, format conversion, and other high-volume tasks.
Routing should adjust dynamically based on task type, risk level, input length, expected output length, cache hit rate, and remaining budget. The following pseudocode illustrates the idea:
function route(request):if request.risk == "high" or request.need_plan:return high_capability_modelif request.complexity == "high":return mid_reasoning_modelif request.batch == true and request.simple == true:return lightweight_modelif request.cache_hit_ratio > threshold:return low_cost_modelreturn low_cost_executor
Downgrade and escalation mechanisms should also be defined. When a low-cost model produces low-confidence output, fails format validation, or receives abnormal user feedback, the request should be escalated to a mid-tier or high-capability model for review. High-capability models should output only plans and review comments. They should not generate large volumes of final text.
6. Engineering Implementation and Monitoring
Build a unified model call gateway that records, for each request, the model tier, input and output tokens, cache hits, credits consumed, latency, retry count, and task tags. Aggregate these logs with a logging service, and set monitoring alerts for daily budget, hourly budget, and sudden spikes in usage. Set both soft and hard budget thresholds. A soft threshold triggers routing downgrades, and a hard threshold rejects non-critical batch tasks. Replay billing data regularly to calibrate price parameters, so that rule changes do not cause estimation drift.
7. Risk Boundaries and Conclusion
Several limits apply. Back-calculated unit prices are not official prices and should not be presented to others as commitments. Cache savings depend on the stability of business prefixes. Retries, long outputs, and very long contexts increase costs. Budget rules for different windows may change. The right approach is to treat the cost model as an engineering parameter that can be calibrated, and to keep updating it with real data.
The goal of multi-model cost optimization is a closed loop of cost modeling, tiered routing, cache optimization, and monitoring calibration. High-capability models handle planning and review. Mid-tier models handle complex reasoning. Low-cost models carry the main execution load, and lightweight models handle batch tasks. This structure balances quality, latency, and cost in a sustainable way.
