LLM Token Cost Benchmarking and Scheduling Strategies: Why Cheap Per-Token Pricing Doesn't Mean Low Total Cost

    This article breaks down why comparing per-million-token prices alone often leads to unexpected LLM bills, and shows how to build a cost model from real usage logs using controlled sampling and least-squares fitting. It covers input/output pricing asymmetry, prompt caching effects, credit-based quota systems, an illustrative cost gradient across model tiers, quota-to-token conversion, and a tiered routing strategy that assigns high-cost models to planning and low-cost models to execution. Readers will learn how to estimate effective cost per unit of output, improve cache hit rates, and design a routing layer for better cost efficiency.

    1. The Problem: Why a Low Unit Price Doesn’t Mean Low Total Cost

    In enterprise applications and AI-assisted coding, teams often integrate multiple large language models at once: some excel at long-context planning, some at complex reasoning, and some are fast and cheap enough for batch execution. On the surface, model selection looks like a simple comparison of price per million tokens, but the actual bill frequently diverges from expectations.

    There are three reasons for this:

    1. Input and output tokens are priced asymmetrically. Most models charge different rates for input and output tokens, with output usually significantly more expensive. A task focused on generating long code or long documents gets amplified on the output side.
    2. Caching changes the real cost structure. When system prompts, project context, and tool definitions are reused repeatedly, cached portions may be billed at only a tiny fraction of the normal input price, pulling the effective average cost down substantially.
    3. Quotas are credit-based, not token-based. Many platforms sell credits or quota packages (for example, “60,000 credits per 5 hours and 600,000 credits per week”). Users never see a direct per-token price and can only infer it from consumption records.

    So the meaningful question is not “which model has the lowest unit price,” but rather: under my task structure (input/output ratio, cache hit rate, call frequency), what is the cost per unit of effective output?

    2. Method: Reverse-Engineering Credit Consumption from Real Usage Logs

    Instead of relying on marketing pages, you can build your own cost model using controlled variables and linear fitting. The core idea is that credit consumption is linear in input and output tokens:

    1. credits = a * input_tokens(M) + b * output_tokens(M) + c * cached_tokens(M) + ε

    Here a, b, and c are the consumption rates to solve for, and ε is the error term. As long as you collect enough samples of “credit delta before and after a call + input/output/cached token counts for that call,” least-squares fitting yields stable coefficients.

    Practical tips:

    • Sample across different task shapes: pure Q&A (high input, low output), code generation (high output), long-document summarization (very high input), and repeated context (high cache).
    • Keep fine-grained records: for each session, log starting and ending credits, input tokens, output tokens, and cached tokens.
    • Check residuals: if R² is close to 1 and residuals are near 0, the billing model is approximately linear and the sampling is sufficient, so the inferred rates are trustworthy.
    • Re-run periodically: platform rules may change, so re-run the fit weekly and watch for coefficient drift.

    Illustrative pseudocode:

    1. # Collect samples: record (credit_delta, input_M, output_M, cache_M) per call
    2. samples = collect_usage_logs()
    3. # Least-squares fit for consumption rates
    4. A = [[s.input_m, s.output_m, s.cache_m] for s in samples]
    5. y = [s.credit_delta for s in samples]
    6. a, b, c = least_squares(A, y)
    7. print(f"Input {a:.0f} / Output {b:.0f} / Cache {c:.0f} credits per million tokens")

    3. Benchmark Results: Cost Gradient Across Model Tiers

    Applying this method to several mainstream models—representing a flagship reasoning tier, a balanced tier, a high-speed economy tier, and a lightweight budget tier—reveals a clear cost gradient. The figures below are order-of-magnitude illustrations (credits per million tokens) meant to show structural differences, not official pricing:

    Model tier Input Output Cache hit
    Flagship reasoning ~80,000 ~400,000 Not listed separately
    Balanced ~32,000 ~112,000 Not listed separately
    High-speed economy ~4,000 ~8,000 ~80
    Lightweight budget ~2,000 ~2,000 ~2,000

    Three key takeaways:

    1. Output cost between flagship and lightweight tiers can differ by roughly 200x. Handing batch, low-difficulty tasks to a flagship model is a cost disaster.
    2. Cache hits are the killer feature of economy models. For the high-speed economy tier, a cache hit costs only about 2% of the normal input cost. In coding assistants where the system prompt and codebase context are heavily reused, the effective average input cost is significantly diluted.
    3. The lightweight tier charges the same for input and output, giving the best cost predictability and making it suitable for high-volume execution.

    4. Quota Conversion: How Many Tokens Fit in 5 Hours and a Week

    Assume an 80%:20% input-to-output ratio, ignore caching for now, and a quota of “60,000 credits per 5 hours and 600,000 credits per week.” The token volume supported per quota window (per 5 hours) is roughly:

    • Flagship reasoning: ~417,000 tokens
    • Balanced: ~1.25 million tokens
    • High-speed economy: ~12.5 million tokens
    • Lightweight budget: ~30 million tokens

    The conversion is straightforward: available_tokens = quota / (0.8*a + 0.2*b) (with a and b in credits per million tokens, the result is in millions of tokens). The effective capacity gap between flagship and lightweight tiers is about 70x. With cache hits factored in, the economy tier’s capacity climbs even higher.

    5. Tiered Scheduling: High-Cost Models Think, Low-Cost Models Do

    Based on the cost gradient, a scheduling architecture organized by cognitive load is recommended:

    • Flagship reasoning: requirement clarification, solution design, architecture trade-offs, and final code review. Characterized by few calls but high value per call.
    • Balanced: complex reasoning, cross-module refactoring, and tough bug localization.
    • High-speed economy: the main execution workhorse—batch code generation from an approved plan, writing tests, updating comments. Paired with high cache hit rates, it offers the best value.
    • Lightweight budget: batch simple tasks such as formatting, renaming, documentation completion, and log classification.

    In practice, introduce a routing layer that uses rules or a small model for intent classification:

    1. if task is "planning/review" -> flagship model
    2. elif task is "complex reasoning/refactor" -> balanced model
    3. elif task is "execute a given plan" -> economy model (caching on)
    4. else -> lightweight model

    On the engineering side, general-purpose components can help: use a message queue for task classification and asynchronous dispatch, object storage to accumulate reusable context templates, and logging plus monitoring and alerting to continuously track call volume and credit consumption per tier, forming a closed-loop optimization cycle.

    6. Common Pitfalls and Caveats

    1. Don’t decide based on unit price alone. You must plug in your own input/output ratio and cache hit rate.
    2. Don’t ignore caching prerequisites. Cache hits depend on a stable prefix: keep system prompts, tool definitions, and context order unchanged to raise the hit rate.
    3. Don’t use a flagship model as an executor. Batch tasks on a flagship model are a cost-structure mismatch.
    4. Label inferred results as personal benchmarks. Platform rules, promotions, and credit packages can change, so re-run the fit periodically.
    5. Watch quality cost. Cheap models may cause rework, so factor the rework rate into the total cost model rather than looking only at the token bill.

    7. Conclusion

    Cost optimization in the multi-model era is fundamentally an engineering problem of task tiering plus consumption modeling. By running linear fits on real usage logs, you turn opaque credits into predictable capacity; by separating “thinking” from “doing” in your scheduling strategy, you get several times the effective output from the same quota. If an organization wants to deploy a similar architecture on Baidu AI Cloud, it can combine general-purpose large model services, container platforms, and monitoring and alerting capabilities to build its own metering and routing system, achieving control over both cost and quality.