LLM API Cost Logic Behind Permanent Price Cuts

    This article examines the cost logic behind a recent move to turn a limited-time LLM API discount into a permanent price anchor, roughly one quarter of the original rate. It breaks down the three-part token billing structure—uncached input, cached input, and output—and shows why prefix cache hit rate has become the main cost variable. It then outlines six practical optimization techniques, supporting architecture design, common mistakes, and an action checklist for reducing and governing LLM API spending.

    1. From Limited-Time Discount to a Long-Term Price Anchor

    The industry has recently seen a notable pricing shift: a cloud provider announced that one of its large-parameter models would keep its discounted API price permanently after the promotion ended, fixing it at roughly one quarter of the original rate. The original pricing structure was: input (cache hit) CNY 0.1 per million tokens, input (cache miss) CNY 12 per million tokens, and output CNY 24 per million tokens.

    The technical implications go well beyond “it got cheaper.” First, token billing is shifting from promotion-driven to scale-driven, and the long-term price anchor means architecture decisions can be amortized over multiple years. Second, the roughly two-order-of-magnitude gap between cached and uncached input prices is now preserved long term, turning caching from an optimization into the primary variable of the cost structure.

    2. Read the Bill First: The Three-Part Token Billing Structure

    An LLM API bill typically has three components, and understanding them is the prerequisite for any optimization.

    1. Uncached input: the request prompt has no reusable prefix cache on the inference side and must be fully computed; this carries the highest unit price.
    2. Cached input: the request prefix matches cached content, so the inference side reuses intermediate computation results directly; this carries a very low unit price.
    3. Output: the model generates token by token; this is usually priced higher than input and cannot be reused.

    Plugging these prices into a typical scenario—4,000 input tokens and 500 output tokens per request:

    1. Cold start (miss): 4000/1e6 * 12 + 500/1e6 * 24 = 0.048 + 0.012 = 0.060 CNY
    2. Same prefix after hit: 4000/1e6 * 0.1 + 500/1e6 * 24 = 0.0004 + 0.012 = 0.0124 CNY

    For the same business logic, whether the prefix is reusable alone makes the per-request cost differ by about 4.8x. Under high-frequency calls, that ratio scales directly into an order-of-magnitude difference in the monthly bill.

    3. Why Cache Hit Rate Becomes the Main Variable

    The general principle of prefix caching is that the inference service reuses the computed intermediate state (the KV cache) for an identical token prefix in a request, skipping redundant computation. This yields three engineering constraints:

    • The prefix must match token by token exactly; any change at any position invalidates everything after it.
    • The cache has a capacity limit and an eviction policy, so long-tail content is hard to hit reliably.
    • A hit is a best-effort capability and should not be assumed to succeed 100% of the time.

    These constraints directly dictate how prompts should be organized: stable content first, volatile content last.

    4. Six Actionable Cost Optimization Techniques

    1. Structure the prefix. Put system instructions, tool definitions, domain knowledge, and examples at the very front and keep them byte-level stable; put timestamps, user IDs, and random values at the end.
    2. Slim down the context. In retrieval-augmented scenarios, rerank and deduplicate first and keep only necessary fragments; for long documents, summarize by section before storing.
    3. Constrain the output. Use explicit format and length limits to reduce wasted tokens; for structured output, prefer a controlled schema.
    4. Route across model tiers. Send simple tasks to smaller or lighter models and escalate only complex ones, instead of using one big hammer for every nail.
    5. Batch and go asynchronous. Merge requests and run them off-peak for offline tasks, using queues to smooth out spikes.
    6. Make observability come first. Turn token usage, cache hit status, and per-request cost into monitoring and alerting metrics; only then can cost be governed.

    Illustrative call and accounting logic:

    1. # Pseudocode: illustrates call and cost accounting only, not any vendor's real API
    2. def call_model(system_prompt, stable_context, dynamic_part, max_output=512):
    3. # Stable prefix first, volatile content last, to improve prefix reuse
    4. prompt = system_prompt + stable_context + dynamic_part
    5. resp = client.chat(model="general-purpose", messages=prompt,
    6. max_tokens=max_output)
    7. usage = resp.usage # input/output token counts, cached input token count
    8. cost = (usage.cached_input / 1e6 * 0.1
    9. + usage.uncached_input / 1e6 * 12
    10. + usage.output / 1e6 * 24)
    11. metrics.record(tokens=usage, cost=cost) # report to monitoring and alerting
    12. return resp.text

    5. Supporting Architecture Design

    • Semantic cache layer: reuse results for high-frequency similar questions via vector retrieval, with a similarity threshold and invalidation policy to avoid incorrect reuse.
    • Quotas and degradation: set token budgets and rate limits per business line, and degrade to a smaller model or templated answers when limits are exceeded.
    • Data classification: define which data may enter the context and which must be desensitized, and manage the lifecycle of caches and logs accordingly.
    • Capacity planning: budget using a blended hit/miss unit price rather than the original price, and keep flexibility for future price adjustments.

    6. Common Mistakes

    • Looking only at unit price and not hit rate: hit rate is the first lever on the bill.
    • Writing dynamic content into system instructions: this permanently invalidates the entire prefix.
    • Assuming a cache hit is guaranteed: capacity eviction can happen at any time, so a fallback is needed.
    • Ignoring output cost: in long-output scenarios, output is often the main expense.

    7. Action Checklist

    This week: review the prompt structure of the top 10 highest-frequency requests and move stable content to the front; wire up token and cost monitoring; switch offline tasks to batch processing. This month: establish model tier routing and budget alerts; launch a semantic cache and gradually evaluate hit rate and accuracy.

    8. Conclusion

    Establishing a long-term price anchor turns the cost model of LLM applications from “unpredictable” into something that can be amortized and optimized. Real competitiveness lies not in waiting for lower prices but in turning cache hit rate, context efficiency, and model routing into engineering capabilities. For complete cost governance and elastic compute support, you can build a closed loop with capabilities such as the general-purpose container platform, message queue, logging service, and monitoring and alerting offered by Baidu AI Cloud.