LLM API Pricing Increased 5x: How to Calculate the Real Cost

    When a major LLM API raises its output price fivefold, the bill does not necessarily grow at the same rate. This article breaks down three-tier token pricing, explains why cost per task matters more than price per million tokens, and provides a practical cost-control checklist covering context trimming, output constraints, model routing, observability, and capacity testing. Use these engineering practices to keep per-task costs under control after a price increase.

    1. The Phenomenon: A 5x Unit Price Does Not Mean a 5x Bill

    A new round of price adjustments has appeared in the industry: a general-purpose LLM service’s latest version charges roughly five times the previous generation’s output price, with a noticeable increase on the input side as well. A tier for separately pricing cache hits is retained. The first reaction from developers in the community is usually “we can’t afford this,” but the conclusion is often less absolute once you break the bill apart.

    The reason is that the cost of a single request is not determined by one unit price alone. Four variables determine it together:

    1. Cost per request = input tokens × input price
    2. + output tokens × output price
    3. + cached tokens × cache price (usually significantly lower than regular input)
    4. + add-on capability fees (e.g., web retrieval, tool calls, long context)

    The unit price is the “sticker price”; the task structure is the “consumption pattern.” At the same sticker price, an agent task that repeatedly brings the system prompt and knowledge base into context and a question-answering task that sends a single sentence can differ by one to two orders of magnitude on the bill.

    2. Breaking Down the Pricing Structure: What Three-Tier Pricing Means for Engineering

    Current mainstream pay-as-you-go billing generally uses a three-tier structure. Understanding the engineering meaning of each tier is the prerequisite for cost control.

    • Input side: Includes the system prompt, conversation history, retrieved document fragments, code context, and more. It is the largest component in long-context applications and the one most prone to “paying repeatedly.”
    • Output side: The unit price is usually several times that of the input side, because generation requires token-by-token forward computation and the compute overhead is inherently higher. Any scenario that makes the model produce long text will have its cost amplified by this item.
    • Cache side: When the request prefix is exactly identical to a previous request, the matched portion is billed at a lower price. It turns “repeated context” from a cost item into an optimizable item, provided the caller actively places stable content at the prefix position.

    From this, a practical rule follows: put invariant content first and variable content last. The system prompt, tool definitions, few-shot examples, and the body of long documents should all be concatenated at the front, with the user’s current-turn input at the end. This way the prefix stays consistent across multiple calls, giving the cache a chance to hit.

    1. def build_prompt(system: str, doc: str, question: str) -> list:
    2. # Stable prefix: helps cache hits; variable suffix: differs each turn
    3. return [
    4. {"role": "system", "content": system},
    5. {"role": "user", "content": f"[Document]\n{doc}\n[Question]\n{question}"},
    6. ]

    It is important to emphasize that whether a cache hits and how the matched scope is defined differ across services. In engineering, defer to the official billing documentation and measure the actual hit rate in your own load tests, rather than assuming “adding a cache automatically makes it cheaper.”

    3. Why “Cost per Task” Matters More Than “Price per Million Tokens”

    The most valuable point in the original discussion is the introduction of the perspective “how much quota an average task consumes.” This is the metric closer to the business in capacity planning:

    1. Cost per task ≈ (input token + output token structure) × unit price × number of task calls
    2. Tasks supported per unit of budget = plan quota / cost per task

    A complex agent task often involves multiple stages such as planning, retrieval, coding, execution, and review, and a single task may consume dozens of times what a simple question-answering task does. Therefore, when the unit price rises fivefold, the bill rises nearly linearly if the task structure stays unchanged; but if context trimming and cache reuse are applied at the same time, the actual increase can be pushed well below fivefold.

    The conclusion is not romantic: the price increase does squeeze the gross margin of heavy callers. Whether you can “arm-wrestle” the provider depends on whether the product can bring down the per-task cost, and that is exactly where engineering can make a difference.

    4. Cost Governance Checklist

    1. Context trimming: Truncate retrieved fragments by relevance, summarize and compress conversation history, and avoid pasting entire blocks.
    2. Output constraints: Use structured output, field whitelists, and maximum length limits to compress redundant generation.
    3. Tiered model routing: Assign lightweight tasks such as intent classification and format validation to small models or a rules engine, and call the high-capability model only on the hard parts.
    1. def route(task):
    2. if task["complexity"] == "low":
    3. return small_model_call(task) # Low-cost channel
    4. return flagship_model_call(task) # High-capability channel
    1. Observability: Record the input/output/cached token counts and cost for each call, connect to monitoring, alerting, and logging services, and set daily budget thresholds and circuit breakers.
    2. Capacity load testing: Before launch, replay real business samples to obtain the distribution of per-task cost (P50/P95), and then choose between pay-as-you-go and plan quota accordingly.

    5. Selection Recommendations

    In the face of a price increase, the rational approach is not an either-or choice but building a “capability-cost” matrix: keep the high-capability model on core paths to ensure quality, and downgrade or localize edge paths; invest the saved budget into caching and context engineering. If you use Baidu AI Cloud services, you can combine general capabilities such as its container platform, object storage, logging service, and monitoring and alerting to build load-testing and cost dashboards, making scaling and downgrade decisions with data rather than intuition.