Token-Based LLM Cost Estimation and Tiered Scheduling in Practice
This article explains how to back-calculate per-token pricing coefficients from usage records using linear fitting, convert credit quotas into usable token volume, and design a four-tier task scheduling framework that balances cost and quality. It also outlines engineering practices for usage instrumentation, automated routing, cache utilization, and continuous calibration.
Token-Based LLM Cost Estimation and Tiered Scheduling in Practice
Why You Need Your Own Cost Measurement Method
After integrating large language models into daily development workflows, many teams run into the same confusion: the rate at which credits or quota are consumed on the bill is far from intuitive. It often feels as if the quota is exhausted after only a few calls. The root cause is that unit prices vary greatly across models and call patterns—input, output, and cache hits—while official pricing rules are often presented as abstract “quota packages” that are hard for users to convert directly into “how many tokens can I actually use?”
Rather than guessing, it is better to use engineering methods to infer the real unit prices. Based on a real usage record, this article demonstrates how to fit pricing coefficients for different models and then design a tiered scheduling strategy on that basis.
Usage Records and Back-Calculating Pricing Coefficients
Method: Multiple Samples and Linear Fitting
The core idea is simple: quota consumption is a linear function of the number of input tokens, output tokens, and cache-hit tokens. As long as you record these three token counts and the corresponding quota consumption for several sessions, you can solve for each model’s unit price using multiple linear regression. The criterion for judging whether the fit is credible is the coefficient of determination, R². When R² = 1.0 and the residuals approach zero, the back-calculated unit prices are fully consistent with actual billing, and the model is reliable.
Back-Calculated Results (Credits Consumed per Million Tokens)
The measured back-calculated results for several common models in a platform’s credit-based plan are as follows:
- Flagship chat model A (long context, strong planning capability): input about 80k per million tokens, output about 400k per million tokens
- High-reasoning model B: input about 32k per million tokens, output about 112k per million tokens
- Lightweight high-speed model C: input about 4,000 per million tokens, output about 8,000 per million tokens, and cache hits only about 80 per million tokens
- Minimal model D: input and output both about 2,000 per million tokens
Several conclusions stand out from these numbers:
First, output is far more expensive than input. For the flagship model, the output unit price is five times the input unit price. This matches the general industry pattern: generation is computed token by token in serial, while input can be processed in parallel. Making prompts longer is not a major problem; making the model talk less is what saves money.
Second, cache hits are almost free. For the lightweight model, the cost after a cache hit is only 2% of normal input. For scenarios that repeatedly carry a large amount of fixed context, such as long system prompts and multi-turn agent sessions, proper use of context caching can reduce input cost to a negligible level.
Third, the price gap between models can reach two orders of magnitude. The output cost of the flagship model is 200 times that of the minimal model. In other words, if the wrong model is chosen for the same task, the cost difference is not tens of percent but a hundredfold.
Converting Unit Prices into “How Many Tokens You Can Use”
Assume the plan provides a quota of about 60k credits per 5 hours and 600k credits per week, and assume a typical workload of 80% input and 20% output, ignoring cache benefits for now. The usable token volume for each model can be calculated as follows:
- Flagship chat model A: about 417k tokens per 5 hours
- High-reasoning model B: about 1.25M tokens
- Lightweight high-speed model C: about 12.5M tokens
- Minimal model D: about 30M tokens
The gap is obvious: with the same budget, the flagship model is enough for only dozens of rounds of deep conversation, while the lightweight model can support batch processing at the tens-of-millions token level. This is the economic basis for tiered scheduling: not every task deserves the most expensive model.
Four-Tier Task Scheduling Framework
Based on the cost structure above, traffic can be allocated to four tiers according to task complexity:
- Planning and final review tier (flagship model A): used only for task decomposition, solution design, and final quality review. The number of calls is small, the quality requirement per call is high, and the cost share remains manageable.
- Complex reasoning tier (high-reasoning model B): handles subproblems that require multi-step logical reasoning, such as algorithm design and difficult bug localization.
- Main execution tier (lightweight model C): handles the vast majority of code generation, rewriting, and Q&A traffic, while further reducing cost through cache hits.
- Batch chores tier (minimal model D): handles simple tasks such as formatting, classification, summarization, and regex generation, running batch pipelines at tens-of-millions token throughput.
In one sentence: high-priced models think, low-priced models execute. This is fully consistent with the division of labor in human organizations—let senior experts make decisions and let execution teams implement them.
Engineering Implementation Recommendations
- Establish usage instrumentation: record the model name, input/output/cache-hit token counts, and charged quota for each call, and periodically refit unit prices to prevent the strategy from becoming invalid after platform price changes.
- Automate routing: at the gateway layer, automatically route to the corresponding tier based on task labels such as complexity and whether long context is required, avoiding reliance on manual judgment.
- Prioritize cache extraction: fix system prompts, reuse session prefixes, and treat cache hit rate as a core optimization metric.
- Calibrate continuously: the data in this article are personal back-calculated measurements, not official price lists. Billing rules may change at any time, and the methodology is more valuable in the long term than the specific numbers.
It is important to emphasize that the lowest cost does not mean optimal. The essence of tiering is cost optimization under quality constraints. The final review tier and reasoning tier exist precisely to protect the quality floor of lower-priced models.
