After LLM API Costs Doubled: How to Calculate and Choose Cost-Effective API Channels

    This article explains how to compare LLM API prices across channels and calculate a weighted unit price that reflects your own workload. It covers why official and third-party prices can differ, how input and output token ratios change the result, how cache pricing affects a bill, and how to build a repeatable cost calculation process. It also includes practical tips for choosing a channel and avoiding hidden risks.

    Why Price Differences Have Become an Engineering Problem

    We used to assume that the official list price was the market baseline, and that third-party resellers added a small service fee on top. Recent tests on a real project showed that this assumption does not hold. For the same model, the price per million tokens can differ by several times across channels, and the price level does not depend on whether a channel is official or third-party.

    For an individual developer making a few hundred calls, even a price gap of several dozen times may amount to only the cost of a cup of coffee. For a production service that runs agent tasks and processes 100 million or more tokens per day, a difference of 1 yuan per million tokens in the blended unit price can change the monthly bill by tens of thousands of yuan. Channel pricing should therefore be treated as an engineering decision, not as a matter of picking any channel that works.

    Measurement Basis: Why Use a 30%/70% Weighting

    Comparing input prices or output prices alone gives misleading results. The ratio of input to output tokens varies widely by scenario:

    • Short text Q&A: input and output are close to 1:1.
    • Long-context reading comprehension: input can account for more than 80% of tokens.
    • Agent programming and code generation: the model needs extensive reasoning and generation, so output tokens far exceed input tokens. A common industry ratio is about 30% input and 70% output.

    A practical approach is to define a blended unit price:

    Blended unit price = input price × 30% + output price × 70%

    For retrieval-augmented generation (RAG) or long document summarization, adjust the weights to match the workload, or compare input prices directly. Different measurement bases can produce opposite conclusions. This is one main reason why published price comparisons often contradict each other.

    When comparing prices in different currencies, use one fixed exchange rate, for example, a fixed rate for converting to RMB. State the date of the exchange rate in the article so that currency fluctuations do not introduce errors.

    Three Typical Patterns from Hands-On Testing

    We checked the public pricing pages of several mainstream models across multiple channels, including official direct access, cloud provider hosting platforms, and third-party aggregation platforms. Using the measurement basis above, we found three recurring patterns.

    1. Official direct access is not always the most expensive option. The flagship version of one open-source model family had a blended unit price well below the price of some cloud platforms that resell it. Official providers sometimes set low prices for new versions to win developer adoption, while hosting platforms add infrastructure and service costs. The assumption that a reseller is always more expensive than the official channel does not hold.

    2. Flagship versions are not available on every channel. A newly released flagship model often launches only on the official channel and a few hosting platforms. Some aggregation platforms offer only a coding-specialized or lightweight version. When the same version is unavailable, mark it as “not listed” rather than substituting a similar model name. Different versions have different prices and capabilities, so they cannot be compared directly.

    3. Cache hit prices are easy to overlook. Many channels offer discounts for repeated prefixes, such as fixed system prompts or reused long context. A cached input price can be an order of magnitude lower than the regular input price. For agent workloads with highly repetitive prefixes, the cache hit rate can affect the bill more than the price difference between channels.

    A Reproducible Cost Calculation Workflow

    Follow these steps and keep a record of each step so the results can be verified later.

    1. Fix a data snapshot. Collect all prices from each channel’s public pricing page and record the collection date for each one. Pricing pages change often, so data without a timestamp is of little use.
    2. Separate versions and regions. The same model can have different prices in different regions, such as a China site and an overseas site. Some official pricing pages are rendered on the client side, so the HTML alone may not contain the price table. In that case, use a browser to render the page or check the prices manually.
    3. Standardize units and currencies. Convert all prices to one unit, such as price per million tokens, instead of mixing per-thousand and per-million figures. Convert USD prices using the fixed exchange rate.
    4. Calculate the weighted price and cross-check it. Apply the weights that match your actual workload. Then check the result against the bill from one or two real requests to catch unit conversion errors.
    5. Record missing items. Mark any version that a channel does not offer. Do not fill the gap with estimates.

    Four Practical Suggestions for Channel Selection

    1. Define the workload ratio before comparing prices. A channel that is cheap for chat may not be cheap for agent workloads. Use the input and output distribution of your real workload as the weights, rather than applying someone else’s conclusions.
    2. Look at the bill structure, not only the unit price. Cache pricing, batch discounts, free quotas, and the boundary between pay-as-you-go and subscription plans all change the actual cost. Before you commit, run a small-traffic pilot for about a week, then work backward from the real bill to find the blended unit price.
    3. Keep the ability to switch channels. Abstract model calls at the gateway layer, and store channel settings, including the base URL, API key, and model name mapping, as switchable configuration. If a channel raises prices or limits requests, you can migrate with low effort. The following example shows the idea:
    1. CHANNELS = {
    2. "official": {"base_url": "https://api.a.example/v1", "model": "model-x"},
    3. "hosted": {"base_url": "https://host.b.example/v1", "model": "model-x"},
    4. }
    5. def call(prompt, channel="official"):
    6. cfg = CHANNELS[channel]
    7. return client.chat(model=cfg["model"], base_url=cfg["base_url"], messages=[...])
    1. Verify channels that are much cheaper than the market rate. Confirm rate limits, any reduction in concurrency, whether your data may be used for training, and the SLA terms. In production, the retry cost caused by instability can cancel out the entire price advantage.

    Final Thoughts

    LLM pricing is still changing quickly, so any static comparison only reflects prices at one point in time. The most valuable part is not a single price table but the method behind it: a fixed measurement basis, recorded and verifiable data, weights based on your workload, and validation against real bills. If you turn this method into a standard cost calculation process for your team, you can recalculate your best option within a few hours whenever prices change. Do not rely on anyone else’s conclusions. The pricing pages are public, so check them yourself.