How to Compare LLM API Pricing: A Total Cost Calculation Method

    This article explains how to fairly compare large language model (LLM) API prices across providers and channels. It covers why prices for the same model can vary widely, how to normalize pricing units, how to calculate weighted cost based on input/output ratios, how different channel types set prices, how to ensure version alignment, and how to account for hidden costs such as cache hit rates, reasoning token billing, and retry overhead.

    1. Why Does the Same Model Have Such Different Prices?

    Under the same model name, quotes from different channels can differ by several times. Intuitively, the official provider’s price should be the lowest and resellers should charge more, but real-world calculations often contradict this intuition. LLM service pricing is not a single unified price curve; it is shaped jointly by each channel’s cost structure, promotional strategy, billing method, and pricing unit. Making selection decisions based on a single number alone easily leads to wrong conclusions.

    Therefore, you need to establish a consistent baseline before comparing prices. The sections below cover six aspects: pricing units, total cost calculation, channel differences, version alignment, hidden costs, and data verification.

    2. Normalize the Pricing Units First

    LLM APIs are typically billed per token, with prices usually quoted per million tokens. There are three main price types:

    • Input price: The content sent to the model, including prompts, context, and conversation history.
    • Output price: The content generated by the model. For most models, the output price is significantly higher than the input price.
    • Cached input price: The input price when an identical prefix is reused from cache, usually much lower than the regular input price.

    When comparing across channels, keep three things in mind. First, units must be consistent: some channels quote in one currency and some in another, and some prices include tax while others do not. Second, currency conversion should use a fixed exchange rate with the reference date stated, because exchange rate fluctuations can change comparison results. Third, the comparison must cover all billable items. Comparing only input prices ignores the dominant role of output prices in total cost.

    3. Calculate Total Cost Using the Input/Output Ratio

    Neither the input price nor the output price alone reflects the real cost. The true cost depends on the ratio of input to output tokens in your workload, and this ratio varies greatly across scenarios: Q&A applications typically produce short outputs, while code generation and long-document rewriting have a much higher share of output tokens.

    Let the input unit price be P_in, the output unit price be P_out, and the input share be r. The weighted price per million combined tokens is:

    Weighted price = P_in × r + P_out × (1 − r)

    If your workload is 30% input and 70% output, then r = 0.3. This ratio is common in scenarios that generate large amounts of code or long results. The ratio should be derived from your own call logs rather than borrowed from generic rules of thumb.

    4. Understand How Each Channel Sets Its Prices

    Common access channels fall into four categories:

    1. Direct connection to the model provider: Prices are set directly by the provider and may include limited-time promotions, tiered discounts, or regional pricing.
    2. Cloud platform hosted services: Prices may vary by region, billing entity, or resource package, and are often tied to other billing items on the platform.
    3. Aggregation and relay platforms: These provide unified access to multiple models through one interface. Prices typically include a platform service fee, and some platforms offer volume or top-up discounts.
    4. Third-party independent providers: Prices are set by the provider itself. Promotions can be aggressive, but there may also be minimum-spend requirements or concurrency limits.

    The official direct channel is not necessarily the most expensive, and resellers are not necessarily cheaper. Possible reasons include: the official provider offering promotional prices for specific periods or plans; resellers adding a service fee on top of a negotiated purchase price; different channels applying different billing rules for cache hits; and regional pricing creating exchange-rate gaps between quotes in different currencies. Therefore, any comparison must be based on publicly available pricing data captured at the same point in time, not on assumptions or experience.

    5. Ensure Model Version Alignment

    The same model name does not mean the same version. A model family may simultaneously include a flagship version, a lightweight version, a coding-specialized version, and older versions, and different channels may list different versions. If a channel only offers a previous-generation version, or only a variant with different capabilities, comparing prices directly produces misleading conclusions.

    The correct approach is:

    • Use the specific version identifier as the smallest unit of comparison, and record which version each channel actually lists.
    • For versions not available on a channel, explicitly mark them as “not available” in the table instead of substituting the price of a similar version.
    • For items where no public pricing can be found, mark them as “not found” and note how you searched.

    This will leave blanks in your table, but every number in it can withstand verification.

    6. Account for Hidden Costs

    Beyond unit prices, the following factors also change actual spending.

    Cache hit rate. If many requests share the same system prompt or document prefix, the cached input price can significantly reduce input costs. The effective input price can be estimated as:

    Effective input price = hit rate × cached price + (1 − hit rate) × regular input price

    Reasoning token billing. Some models include reasoning steps in their output. Whether these tokens count toward output billing, and at which price tier they are charged, must be verified item by item. When billing policies differ, the same request volume can produce noticeably different bills.

    Retries and failed requests. Retries caused by network timeouts and rate limiting generate duplicate or wasted consumption. Long-running tasks should track the failure rate, and…