LLM API Pricing Comparison Across Platforms: How to Choose a Channel After Limited-Time Discounts

    This article explains why the lowest per-token price often does not produce the lowest bill when using large language model APIs. It breaks API costs into input tokens, cache-hit tokens, and output tokens, shows how to read limited-time discounts correctly, and provides a reusable cost formula and Python function for consistent cross-platform comparison. It also covers four comparison dimensions—billing rules, discount structures, engineering support, and migration cost—plus practical methods such as prefix stabilization, context compression, output constraints, and tiered routing to control long-term spending.

    1. The Problem: Why the Lowest Unit Price Is Rarely the Lowest Bill

    As enterprise AI applications move into production, model invocation costs often shift from negligible to a major line item. Many teams compare a single unit price during selection, then see a bill far above expectations after launch. The reason is straightforward: the real cost of a request is determined by several billing components, and platforms differ in how they define those components, apply discounts, and handle caching.

    Take a general-purpose model tier on an open platform as an example. Its standard pricing is usually split into three parts: input (prompt) tokens at one price per million tokens, cache-hit tokens at a lower price per million tokens, and output (completion) tokens at the highest price per million tokens. When the platform runs a limited-time discount, such as 50% off, all three prices drop together. If you compare only the input price, you can easily miss scenarios with a high output share and a low cache-hit rate, which distorts the selection decision.

    The goal of this article is not to recommend a specific channel. Instead, it offers a transferable evaluation method: break the bill into explainable variables, compare channels using a consistent calculation model, and then use engineering techniques to bring costs into a reasonable range.

    2. Breaking Down the Bill: What the Three Billing Components Mean

    2.1 Input Tokens

    Input tokens are all the context carried in a request, including system prompts, conversation history, document chunks retrieved through retrieval-augmented generation (RAG), tool definitions, and more. They tend to be large in volume and highly repetitive. In multi-turn conversations and knowledge-base question answering, input often accounts for more than 70% of total tokens.

    2.2 Cache-Hit Tokens

    When a request prefix closely matches recent requests, the platform can reuse previously computed intermediate results. These tokens are billed at the cache-hit price, which is usually much lower than the standard input price. This rewards a stable prefix structure, such as a fixed system prompt, a fixed tool schema, or a fixed long document.

    2.3 Output Tokens

    Output tokens are the content generated by the model. They have the highest unit price and vary widely: in the same business, summarization tasks produce short outputs, while code generation and long-form writing produce long ones. Once output exceeds roughly 30% of the total, it tends to dominate the overall cost.

    Once you understand these three components, any cross-platform price comparison becomes a single question: given my input, cache, and output structure, which channel has the lowest total cost?

    3. How to Read Discounts Correctly: 50% Off Does Not Mean Half the Cost

    A common limited-time discount takes the form of standard price multiplied by 0.5. For example, a model tier on one platform has standard prices of CNY 0.8 for input, CNY 0.23 for cache hits, and CNY 2.8 for output, per million tokens. After a 50% discount, these become CNY 0.4, CNY 0.115, and CNY 1.4.

    Three points matter:

    • Check whether the discount applies to all components or only some. In most cases all three drop together, but you should confirm each one to avoid mistaking an input-only discount for a full 50% reduction.
    • The discount is time-limited, so run two calculations: one for the discount period and one for after it expires. The latter determines your long-term budget.
    • Discounts can change the ranking of the best channel. A channel with a higher list price but a lower cache price may overtake others after the discount, and the reverse is also possible.

    4. A Consistent Calculation Model You Can Reuse

    Let the number of input tokens be (I), cache-hit tokens be (H), and output tokens be (O), with unit prices (p_i), (p_h), and (p_o) in CNY per million tokens. The cost of a single request is:

    1. Cost = (I - H) * p_i / 1e6 + H * p_h / 1e6 + O * p_o / 1e6

    Note that (H) is usually a subset of (I), meaning cache-hit tokens are no longer billed at the standard input price. If a platform counts cache hits separately and does not deduct them from the input quota, the formula needs to be adjusted accordingly. This detail is the most common source of error in cross-platform comparisons.

    The following sample code locks in the calculation so you can evaluate many cases in batch:

    1. def cost_per_mtok(i, h, o, p_i, p_h, p_o):
    2. assert 0 <= h <= i
    3. return (i - h) * p_i / 1e6 + h * p_h / 1e6 + o * p_o / 1e6
    4. # Example: discounted prices for one model tier
    5. print(cost_per_mtok(8000, 6000, 1200, 0.4, 0.115, 1.4))

    5. Four Dimensions for Comparing Channels

    1. Consistency of billing rules: whether cache hits are deducted from input tokens, and whether a minimum billing unit applies.
    2. Discount structure: full-component discounts, tiered discounts, and combinations of subscription plans with pay-as-you-go pricing.
    3. Engineering support: whether common cloud services such as logging, monitoring and alerting, message queues, and object storage can cover observability and asynchronous processing needs across the call chain.
    4. Migration cost: API compatibility, the amount of SDK changes, and differences in rate limits and quota policies.

    In general practice on platforms such as Baidu AI Cloud, these capabilities typically appear as a combination of model services, logging services, and monitoring and alerting, making it easier to observe cost, latency, and failure rate on a single dashboard. During selection, these hidden costs should be factored in rather than judged by unit price alone.

    6. Four Engineering Techniques to Reduce Costs

    • Stabilize the prefix: place the system prompt, tool definitions, and long documents at the very beginning of the request and keep them unchanged to improve the cache-hit rate.
    • Compress context: summarize and deduplicate conversation history to reduce input tokens.
    • Constrain output: use structured output and length limits to control (O).
    • Use tiered routing: send simple requests to a lightweight tier and complex requests to a higher tier, with a unified gateway delivering the policy.

    Sample routing pseudocode:

    1. if estimated_output_tokens < 512 and intent in SIMPLE_SET:
    2. route = "light"
    3. else:
    4. route = "standard"

    7. Conclusion

    The right way to compare prices across platforms is to put input, cache, and output tokens into one consistent formula together with the discount period, then run a sensitivity analysis based on cache-hit rate and output share. Discounts only change the short-term ranking; engineering optimization determines the long-term bill. Quantify your token structure first, then discuss channels, and you can avoid the common trap of the lowest unit price producing the highest bill.