LLM API Pricing Explained: Token Rates, Subscription Plans, and Real Task Costs

    LLM API rates tell only part of the cost story. This article explains input, output, and cached-token billing, how to compare subscription plans with usage-based pricing, and how to measure cost per task using a simple Python script. It also outlines a practical model-selection process based on workload benchmarks, cache efficiency, and model routing.

    1. Why Higher Token Prices Do Not Necessarily Mean Higher Costs

    A recently released large language model increased its output-token price to several times that of its predecessor, alongside changes to input and cached-token rates. The announcement prompted debate among developers. Supporters pointed to stronger overall capabilities and high benchmark rankings as justification. Critics argued that comparing pricing structures across providers reveals a more complicated picture than headline token rates suggest.

    The debate highlights a common problem: developers often evaluate model costs using unit prices while overlooking three important variables—task-level token consumption, plan allowances, and subscription structure.

    A model with a higher output-token price can still cost less per task if it uses fewer tokens, makes better use of context, or achieves a higher cache-hit rate. Conversely, a model with apparently low rates can produce unexpectedly large bills if it requires repeated attempts or repeatedly processes lengthy context.

    Rather than recommending or comparing specific providers, this article treats the issue as a general engineering question: How can developers build a reliable framework for evaluating LLM API costs?

    2. Understanding LLM Billing Structures

    2.1 Three Token Pricing Categories

    Mainstream LLM APIs commonly charge by token usage, with different rates for three categories:

    • Input tokens: Content sent to the model, including system instructions, conversation history, and retrieved document excerpts.
    • Output tokens: Content generated by the model. Output rates are often substantially higher than input rates—sometimes three to five times higher—reflecting the computational demands of sequential, autoregressive generation compared with parallel input processing.
    • Cached input tokens: Repeated prompt prefixes that qualify for inference-side cache reuse. These tokens may be billed at one-tenth of the standard input rate or less, depending on the provider.

    Caching is particularly important for agent applications. In a typical tool-calling workflow, system instructions, tool definitions, and previous execution steps recur across multiple requests. A well-designed caching strategy can sharply reduce the cost of processing that repeated content.

    An unstable prompt structure can have the opposite effect. For example, placing changing content at the beginning of a prompt can prevent later shared content from matching a cached prefix. Cache-hit rates may fall, substantially increasing input costs.

    2.2 Converting Subscription Plans into Effective Rates

    Many providers offer fixed monthly subscriptions alongside usage-based API billing. A subscription may appear cheaper, but its actual value depends on how much usable capacity it provides.

    The pricing structures discussed in this debate include examples such as a $20 monthly subscription associated with hundreds or thousands of dollars in nominal API-equivalent usage, or a $200 subscription associated with more than $10,000 in nominal equivalent usage. Other plans offer much lower multiples: comparable monthly fees may provide only several to a dozen times their price in equivalent usage.

    These figures should not be treated as universal or guaranteed allowances. The important point is the difference in subscription leverage: how much usable, API-equivalent capacity a plan provides relative to its fee.

    To evaluate a subscription, calculate:

    1. Effective subscription rate = Monthly fee / Actual usable equivalent usage

    Then compare that result with usage-based API pricing on a consistent basis.

    Two plans with similar monthly fees can have very different effective costs. If their usable allowances differ substantially, the resulting cost gap can approach an order of magnitude.

    3. Real Cost per Task: A More Useful Metric Than Token Price

    3.1 Why Unit Prices Can Be Misleading

    Models can differ significantly in how efficiently they complete the same task. One model may use roughly as many tokens as another, or several times more because of verbose responses, additional reasoning-token consumption, or frequent retries.

    Independent community evaluations have reported cases where highly ranked models consumed amounts of tokens comparable to more expensive alternatives. Once token usage is multiplied by the relevant rates, an attractive headline price may no longer translate into a lower cost for the capability delivered.

    A practical estimation formula is:

    1. Estimated task cost =
    2. (
    3. Uncached input tokens × Input rate
    4. + Output tokens × Output rate
    5. + Cached input tokens × Cache rate
    6. )
    7. × (1 + Retry overhead)

    Token counts and prices must use the same units. If prices are quoted per million tokens, divide each token count by one million before applying its rate.

    The retry multiplier is a simplified estimate of additional attempts relative to the initial workload. It assumes those attempts have approximately the same average cost.

    Two normalized metrics help make comparisons more meaningful:

    • Cost per task: The average spend required to complete a standardized benchmark task.
    • Quality-normalized cost: Cost per task divided by the quality score achieved on that task—effectively, the cost per point of measured performance.

    These metrics provide a stronger basis for comparison than token prices alone, provided the models are evaluated on the same tasks and scoring criteria.

    3.2 Implementing a Cost Estimate in Python

    The following minimal script can be incorporated into an evaluation pipeline to estimate costs while tracking token consumption:

    1. def task_cost(
    2. input_tokens: int,
    3. output_tokens: int,
    4. cached_tokens: int = 0,
    5. price_in: float = 20.0, # CNY per million uncached input tokens
    6. price_out: float = 100.0, # CNY per million output tokens
    7. price_cache: float = 1.0, # CNY per million cached input tokens
    8. retry_rate: float = 0.1, # Estimated additional attempts per initial attempt
    9. ) -> float:
    10. base = (
    11. input_tokens / 1e6 * price_in
    12. + output_tokens / 1e6 * price_out
    13. + cached_tokens / 1e6 * price_cache
    14. )
    15. return base * (1 + retry_rate)
    16. # Example: an agent task with long context and extensive tool history
    17. cost = task_cost(
    18. input_tokens=180_000,
    19. output_tokens=8_000,
    20. cached_tokens=150_000,
    21. )
    22. print(f"Estimated cost per task: CNY {cost:.4f}")

    The rates are illustrative and expressed in Chinese yuan; they are not a quote for a particular provider. In this function, input_tokens represents uncached input tokens, while cached_tokens is counted separately. If an API reports total input tokens including cached tokens, separate those categories before passing the values into the function.

    Running this calculation across a representative evaluation set—such as a few dozen to a few hundred tasks—produces a distribution of task costs. That distribution is more informative than a provider’s pricing table because it reflects the workload the application actually performs.

    3.3 How Cache Design Changes Costs

    Caching is an important cost variable developers can influence directly. Useful practices include:

    1. Keep the prefix stable. Place system instructions and tool schemas at the beginning of the prompt and keep them identical across requests to maximize prefix-cache reuse.
    2. Place changing content later. Put user input, retrieved results, and other variable content after the stable prefix.
    3. Reuse conversation context. Where the API supports it, continue multi-turn agent workflows with a consistent conversation structure rather than rebuilding or rearranging the history unnecessarily. The benefit depends on the provider’s caching behavior, not simply on using the same session.
    4. Monitor cache-hit rates. Track cache performance after deployment. In input-heavy workloads with heavily discounted cached tokens, increasing the hit rate from 50% to 90% can reduce total costs by nearly half, depending on the input/output mix and applicable rates.

    4. A Three-Step Framework for Model Selection

    Step 1: Benchmark Your Workload, Not Just Public Rankings

    Build a small evaluation set from real business tasks. For each task, record token consumption, elapsed time, and output quality.

    Third-party benchmarks are useful for initial screening, but they cannot replace measurements on the workload you intend to run.

    Step 2: Calculate Effective Costs

    For each candidate model, estimate:

    • Cost per task under usage-based API pricing.
    • The effective rate of any relevant subscription, based on its actual usable allowance.

    Pay particular attention to differences in subscription leverage. A plan with a low monthly fee may still be poor value for heavy usage if the included capacity is limited.

    Compare like-for-like usage rather than assuming that a nominal API-equivalent allowance translates directly into the same practical capacity.

    Step 3: Evaluate the Remaining Optimization Potential

    Under the same budget, prompt optimization, caching, output-length control, and model routing can sometimes save more than switching models.

    Routing assigns simpler requests to less expensive models and more demanding requests to higher-priced models. A mixed-model approach can offer strong cost efficiency when the routing decisions preserve the quality required by the application.

    The selection process should therefore consider not only current measured costs, but also how much room remains to improve the workload’s efficiency.

    5. Conclusion

    Debates about a new model becoming “five times more expensive” reflect a broader shift from competing on token prices to competing on the cost of useful capability.

    For developers, the practical response is to build a cost-measurement framework rather than rely on headline rates. Use real cost per task as the central metric, evaluate quality alongside spending, and improve efficiency through caching and model routing.

    Pricing transparency and the relationship between subscription fees and usable allowances also deserve attention when choosing a provider. Ultimately, the gap between listed prices and actual expenditure helps determine whether an application can scale economically.