Why Are LLM Bills Skyrocketing? Token and Cache Cost Governance

    Many teams estimate their LLM budget by the number of calls, only to see the bill multiply after launch. This article explains why model pricing is based on token volume rather than request count, how input, cached, and output prices differ across model tiers, and how to control costs through token observability, prompt caching, model routing, and output constraints. It also includes a pre-launch cost review checklist.

    1. Why Bills Skyrocket: Costs Are Billed by Volume, Not by Call

    When teams integrate a large language model for the first time, they often estimate the budget by the number of calls, only to see the bill grow several times over after launch. The reason is that the billing model does not match intuition: the mainstream approach uses tokens as the basic unit of measurement, with input and output priced separately, and the output price is usually several times the input price. In addition, long contexts, multi-turn conversations, tool calls, and agent loops can amplify the token consumption of a single task by one or two orders of magnitude.

    Therefore, the first step in cost governance is not to cut requirements, but to translate “one request” into “how many tokens a task consumes.” Only with a unified measurement can subsequent optimization have a basis.

    2. Three Types of Price Structures: Treat the Current Model as a Sample, Not a Permanent Conclusion

    Models iterate quickly, and specific model names and unit prices keep changing, but the cost analysis method remains stable over time. The table below only demonstrates the calculation method (in USD per 1 million tokens); actual billing should be based on the provider’s console.

    Provider type Example tier Input price Cache hit price Output price Suitable scenarios
    Flagship reasoning High-capability general model $5.00 $0.50 $30.00 Complex reasoning, agents, code, critical business
    Lightweight Small-parameter general model $0.75 $0.075 $4.50 Medium tasks, summarization, routine generation
    Long-task Complex agent workflow model $5.00 $0.50 $25.00 Long-chain tasks, complex code, agent workflows
    Multimodal (low) Long-context multimodal $2.00 $0.20 $12.00 Multimodal, long context
    Multimodal (high) Long-context multimodal $4.00 $0.40 $18.00 High-complexity multimodal reasoning
    High concurrency Light reasoning model $0.50 $0.05 $3.00 High concurrency, customer service, classification, light reasoning

    Three patterns can be drawn from the table:

    1. Output is more expensive than input. In most tiers, the output price is 4 to 6 times the input price, so compressing output length is often more effective than compressing input.
    2. Cache hit prices are extremely low. The hit price is usually only one-tenth of the input price, and the reuse value of repeated prefixes is severely underestimated.
    3. The gap between tiers is an order of magnitude. The unit price of the flagship tier can be more than 10 times that of the high-concurrency tier, so routing decisions directly determine the order of magnitude of the bill.

    3. Token Measurement: Build Observability First, Then Optimize

    Without measurement, there is no governance. It is recommended to add instrumentation across all call chains, recording the input tokens, output tokens, cached tokens, task identifier, and business scenario tag for each request.

    Example structure:

    1. {
    2. "task_id": "invoice_extract_8821",
    3. "scene": "document extraction",
    4. "model_tier": "light",
    5. "input_tokens": 4200,
    6. "cached_tokens": 3800,
    7. "output_tokens": 260,
    8. "estimated_cost": 0.00042
    9. }

    With this data, you can answer three key questions: which scenarios consume the most tokens, which scenarios have the lowest cache hit rate, and which tasks are incorrectly routed to the flagship model. In practice, billing anomalies are usually concentrated in a few scenarios, following an obvious long-tail distribution, so the return on investment of governance is high.

    4. Caching: Turn Repeated Prefixes into Discount Coupons

    The core idea of caching is to reuse computation results for stable, unchanged prefix content (system prompts, tool descriptions, knowledge base snippets, few-shot examples), with the hit portion billed at a price far lower than the input price. To make caching truly effective, several engineering constraints must be followed:

    • Stable prefix: Put volatile content (timestamps, random IDs, user input) at the end of the prompt to avoid polluting the prefix.
    • Fixed order: The concatenation order of templates cannot be changed arbitrarily; any byte-level change will cause a cache miss.
    • Lifecycle matching: Caches usually have a time-to-live window. Content reused at high frequency yields the greatest benefit; do not force one-off content into the cache.
    • Split cold and hot: Divide the prompt into a “cold section (almost unchanged)” and a “hot section (changes every time).” The longer and more stable the cold section, the greater the discount.

    A simple example of template layering:

    1. def build_prompt(tool_spec, faq_block, user_query):
    2. # Cold section: stable prefix, favorable for cache hits
    3. cold = SYSTEM_HEADER + tool_spec + faq_block
    4. # Hot section: variable part, placed at the end
    5. hot = f"\nUser question: {user_query}\nPlease output JSON as required."
    6. return cold, hot

    It is worth emphasizing that caching is a “structural optimization” that sacrifices no quality and should be enabled by default. Shortening context and reducing the number of examples are “lossy optimizations” whose quality regression must be validated on an offline evaluation set before going live.

    5. Routing: Spend Every Dollar on the Difficulty It Needs

    The goal of routing is to assign tasks to the model tier that is “just enough.” Actionable strategies include:

    1. Rules first: Tasks such as classification, extraction, format conversion, and keyword matching go to the lightweight tier first, and are upgraded only when confidence falls below a threshold.
    2. Cascade validation: The lightweight model produces a result first, and a small validation step judges whether it is suspicious; only suspicious samples are escalated to the flagship tier.
    3. Complexity estimation: Score features such as input length, whether multi-step reasoning is required, and whether code is involved, then map them to different tiers.
    4. Fallback and degradation: Set timeout and retry policies to avoid retry storms driving up the bill.

    Example logic:

    1. def route(task):
    2. if task.type in {"classify", "extract", "format"} and task.input_tokens < 8000:
    3. return "light"
    4. if task.requires_multi_step or task.has_code:
    5. return "flagship"
    6. return "mid"

    Routing often delivers the greatest benefit: moving 80% of routine traffic from the flagship tier to the lightweight tier can reduce overall costs by several times, with quality loss within an acceptable range.

    6. Output Governance: The Most Overlooked Amplifier

    Because the output unit price is higher, output length is an invisible amplifier of the bill. Common practices include: explicitly limiting the output structure (fixed fields, enumerated values, length limits); avoiding long, free-form explanations from the model; setting word count ranges for summarization tasks; and delegating large-scale formatting work to deterministic code rather than model generation. In engineering, “structured output plus post-processing validation” can replace lengthy natural language output, saving money while improving stability.

    7. Pre-Launch Cost Review Checklist

    • Have scenarios been tagged and token and cache hit data collected?
    • Has the prompt been layered into cold and hot sections, and is the prefix stable?
    • Are routing rules and escalation thresholds in place, supported by offline evaluation?
    • Are length and structure constraints set for outputs?
    • Are quotas, budget alerts, and abnormal usage circuit breakers configured?
    • Has the pricing model been verified against the provider’s console prices?

    8. Conclusion

    LLM bill governance is not a one-time cost cut, but the establishment of an “observable—attributable—optimizable” loop: use the token measurement to unify metrics, use caching to eliminate repeated overhead, use routing to match difficulty with tiers, and use output constraints to suppress amplifiers. In practice on platforms such as Baidu AI Cloud, solidifying these methods into default engineering standards can keep the cost per task under control while model capabilities continue to improve.