Why LLM API Pricing Should Not Be Judged by Per-Token Price Alone
This article explains why comparing large language model APIs by output token price alone leads to misleading cost conclusions. It breaks down tiered input billing and cache hit rates, introduces a task-level cost framework that factors in retries, tool calls, human intervention, and success rate, and offers a simple rule for deciding whether a price premium is justified. Readers will learn how to build an evaluation set, track cost by task rather than by token, and route requests across model tiers.
1. The Misread “Expensive”: Unit Price Is Not Total Cost
When evaluating LLM API pricing, the most common mistake developers make is multiplying the output token price by an estimated call volume and concluding that it is “too expensive.” That approximation holds up reasonably well for short, general-purpose conversations, but once the workload becomes long-context, multi-turn tool calling, code generation, or agent automation, the cost structure changes non-linearly: on the input side, caching can substantially dilute the cost, while on the output side, the task success rate scales the cost up or down in reverse. What actually determines the bill is the cost per effective task, not the list price of any single dimension.
So before arguing about whether the pricing of a long-horizon model class is unreasonably high, three implicit assumptions need to be dismantled: that all tokens cost the same, that every call is independent with no reuse, and that failures carry no cost. The sections below unpack each one.
2. Positioning Determines Price: Long-Horizon Models Are Not General Chat Tools
A class of long-horizon models aimed at programming, knowledge work, and deep reasoning is not designed for high-frequency short Q&A. It is designed to push complex tasks to a deliverable state in a single pass. The capabilities that support this goal typically include very long context windows, native multimodal understanding, reasoning depth from large parameter counts, and reliable instruction following across long chains.
These specifications expand the capability boundary, and they also raise inference cost: a longer context means more attention computation and more memory usage, and deeper reasoning means more decoding steps. Comparing its unit price with a lightweight general chat model is like comparing the fuel consumption of an engineering vehicle with that of a family sedan — the baseline for the comparison itself does not hold. The reasonable comparison targets are peer long-horizon models, and the time cost of a human completing the same task.
3. Cache Billing: The Most Overlooked Cost Lever
Mainstream platforms generally use tiered input billing: cached input is priced significantly lower than uncached input, and output is the most expensive. An illustrative price structure is shown below (it expresses only the order of magnitude and is not any vendor’s actual quote):
cache_hit_input : 0.30 / 1M tokenscache_miss_input : 3.00 / 1M tokensoutput : 15.00 / 1M tokens
The cache hit rate has a decisive impact on the bill. Let the total input be I and the hit rate be h, then the effective input cost is:
C_in = I * (h * 0.30 + (1 - h) * 3.00) / 1e6
When h = 0.9, the effective input unit price drops to 0.57/1M, only 19% of the uncached price. In a typical agent workload with long context plus a fixed system prompt plus code repository snippets, a high hit rate is the norm rather than the exception, because the prefix content is highly repetitive across calls.
There are three engineering practices to improve the hit rate: put the stable system prompt and tool definitions at the very front of the context; avoid rewriting the prefix midway through a session; and place volatile user input and retrieval results at the end. Example:
def build_prompt(system_block, tools_block, dynamic_ctx):# Stable prefix -> favors cache hits; dynamic content goes lastreturn f"{system_block}\n{tools_block}\n---\n{dynamic_ctx}"
4. A Task-Level Cost Accounting Framework
Switching the perspective from tokens to tasks, the cost formula should include six variables: effective input cost, effective output cost, retry cost, tool call cost, human intervention cost, and success-rate weighting. Let the cost of a single attempt be c, the average number of attempts be n, the success rate be s, and the amortized cost of human intervention be m, then:
C_task = (c * n + m) / s
This equation reveals a counter-intuitive conclusion: because the success rate s sits in the denominator, improving it improves total cost multiplicatively. If a stronger model cuts the number of attempts from 5 to 2 and raises the success rate from 0.5 to 0.8, the task cost can still drop by more than half even if the per-call price is three times higher.
Public benchmark data can serve as an order-of-magnitude reference: on a certain software engineering benchmark, the top configuration of a long-horizon model reaches about 69% task success rate, with an average cost of about $4.65 and an average of about 98 execution steps. The value of these numbers is not the ranking, but the fact that such tasks genuinely require long-chain execution of dozens of steps, where unit-price thinking completely breaks down.
5. Rules for Judging Whether “Expensive” Is Justified
A simple rule can be used for a first pass: if the price is three times higher but the task success rate improves by only five percentage points, it is usually not worth it; if the price is three times higher but the number of attempts, the amount of rework, and the completion time all drop significantly, then the premium is justified. A more rigorous approach is to run an A/B measurement on your own small sample task set:
premium_multiple = price_new / price_basebenefit_multiple = C_task_base / C_task_newif benefit_multiple > premium_multiple -> adopt the higher-capability model
6. Implementation Recommendations
First, build an evaluation set from 50 to 100 representative tasks in real business scenarios, recording success rate, average number of steps, cache hit rate, and human takeover rate. Then combine logging services and monitoring/alerting systems to build a cost dashboard that aggregates costs by task dimension rather than by token dimension. Restructure stable prefixes to improve cache reuse. Finally, route by task tier: send simple requests to lightweight models and complex long-horizon tasks to higher-capability models. If an enterprise already runs inference services on general capabilities such as container platforms, object storage, and log monitoring on Baidu AI Cloud, it can directly reuse the existing observability pipeline for the calculations above, with no additional build-out required.
The conclusion is that the pricing of long-horizon models, high or low, only has meaning under a task-level cost measure. Once you account for the two multipliers — cache hit rate and success rate — the bill will often give an answer that is contrary to intuition but closer to the truth.
