LLM Token Cost: How to Calculate Real Costs After a 5x API Price Hike

    A fivefold jump in a flagship model's API price raises an obvious question: does it become unaffordable? This article answers from an engineering perspective. It breaks LLM API billing into input, cache-hit, and output tiers; shows how to move from per-token list prices to the cost per successful task, including a retry factor; explains how subscription tiers convert tokens into usage credits and why their advertised value can differ severalfold; and analyzes why reasoning models push inference costs up on both the supply and demand sides. It also warns that benchmark averages can mislead cost decisions, and lays out practical techniques for cache optimization plus a governance framework covering budgets, tiered routing, context compression, and cost regression tests. The takeaway: what matters is not the sticker price per million tokens, but the cost of each successfully completed task.

    Does a fivefold price increase mean a model becomes “unaffordable”? To answer that, you first need to understand two things: how an API bill is assembled, and how many tokens your application actually consumes. A new generation of flagship models has raised output pricing to 100 RMB per million tokens, with input at 20 RMB and cache hits at just 1 RMB — roughly five times the previous generation overall. Social platforms quickly filled with complaints about “outrageous” pricing, yet once you compare it with the roughly $20 and $200 monthly subscription tiers offered by major overseas model providers, the picture becomes more nuanced.

    This article doesn’t judge whether any single vendor’s pricing is fair. Instead, it takes an engineering perspective and breaks the price increase down into four questions:

    • If unit prices rise fivefold, does the real cost rise fivefold too?
    • How is the “tens of thousands of RMB in usage” advertised by subscription plans actually derived?
    • Why does stronger flagship capability inevitably push up inference costs?
    • How should teams build a measurable, governable approach to cost?

    1. Start With the Pricing Structure: Input, Cache Hits, and Output

    Most mainstream LLM APIs use pay-as-you-go billing, priced per million tokens and usually split into three tiers:

    • Input: the full context sent with every request, including system instructions, conversation history, retrieved snippets, and tool results.
    • Cache hit: the portion of the input whose prefix matches already-cached content and can be reused directly.
    • Output: the text the model generates. For reasoning models, the output also includes tokens produced by the model’s internal reasoning process.

    This flagship pricing can be written as “input 20 / cache hit 1 / output 100” (all in RMB per million tokens). The three tiers sit at roughly a 20:1:100 ratio — that is, 1 : 0.05 : 5. The cache-hit price is only 5% of the input price, which shows the vendor is using price as a lever to encourage developers to reuse context; the output price, at five times the input price, is the single most expensive line on the bill.

    “A fivefold increase” and “is it expensive?” are two different questions. Here’s a unified example to quantify it. Suppose a typical task sends 12,000 input tokens each time, of which about 10,000 form a reusable fixed prefix, and produces 4,000 output tokens. Assume the previous generation’s three-tier pricing was roughly one-fifth of the new flagship (for example, input 4 RMB, cache 0.4 RMB, output 20 RMB).

    Scenario Cache hit rate Previous gen (RMB/task) New flagship (RMB/task) Multiple
    Single call, no cache 0% 0.128 0.64 5.0x
    Single call, prefix hit 83% 0.032 0.16 5.0x
    4-turn chat, full history resent each turn, no cache — 0.64 3.20 5.0x
    4-turn chat, only fixed prefix hit ~43% 0.275 1.37 5.0x
    4-turn chat, existing content also hits ~81% 0.07 0.35 5.0x

    (All figures are illustrative estimates; actual billing follows each provider’s current rules.)

    Three conclusions follow:

    1. If the way you organize context stays the same, a fivefold unit-price increase translates into an almost fivefold cost increase.
    2. With the same model and the same prices, how well you organize context can make a four-turn conversation cost about 9x more (3.20 vs 0.35 RMB).
    3. What really determines whether something is “expensive” is how many input and output tokens each task actually consumes.

    2. From Unit Price to Task Cost: Build Your Own Estimation Model

    1. The basic formula and estimation code

    Let the number of input tokens be N_in, of which N_cache hit the cache, and the number of output tokens be N_out, with per-tier unit prices P_in, P_cache, P_out (RMB per million tokens). The cost of a single request is:

    1. C = [(N_in − N_cache) × P_in + N_cache × P_cache + N_out × P_out] / 1,000,000

    The total cost of a multi-turn conversation or an agent is the sum of all request costs. The sample code below implements this formula so you can quickly compare different price tiers and cache-hit rates:

    1. # Illustrative code (Python pseudocode); prices in RMB per 1M tokens
    2. PRICE = {'in': 20.0, 'cache': 1.0, 'out': 100.0}
    3. def cost_per_call(in_tokens, out_tokens, cache_hit_tokens=0):
    4. miss = in_tokens - cache_hit_tokens
    5. return (miss * PRICE['in']
    6. + cache_hit_tokens * PRICE['cache']
    7. + out_tokens * PRICE['out']) / 1_000_000
    8. # Typical task: 12,000 input, 4,000 output
    9. print(cost_per_call(12000, 4000)) # 0.64 RMB
    10. print(cost_per_call(12000, 4000, cache_hit_tokens=10000)) # 0.16 RMB
    11. # Same task under the previous price tier
    12. PRICE = {'in': 4.0, 'cache': 0.4, 'out': 20.0}
    13. print(cost_per_call(12000, 4000)) # 0.128 RMB

    2. The real workload: task cost × number of attempts

    The true per-task cost in a real business must be multiplied by one more key factor: the number of attempts. Retries after output validation fails, recovery after a failed tool call, and the multi-step loops an agent plans for itself all multiply token consumption.

    1. # Illustrative code (Python pseudocode)
    2. def cost_per_task(prompt, max_attempts=3, validator=None):
    3. total = 0.0
    4. for _ in range(max_attempts):
    5. resp = model.chat(prompt) # resp.usage includes input / cached / output token counts
    6. u = resp.usage
    7. total += cost_per_call(u.input_tokens, u.output_tokens, u.cached_tokens)
    8. if validator is None or validator(resp.text):
    9. break # stop immediately after passing to avoid wasted retries
    10. return total

    If a task needs to be attempted 1.5 times on average to pass validation, its effective cost is 1.5x the cost of a single call. So “how much per million tokens” is just the list price — the number to actually watch is “how much per successful task.”

    3. Subscription Tiers Explained: Why a Low-Cost Plan Can Advertise ‘Tens of Thousands of RMB in Usage’

    Subscription plans are the mainstream option for individual developers: a fixed monthly fee provides a certain amount of model usage within a billing period. The key point is that providers generally don’t meter directly by token count. Instead, they convert tokens of different types into a unified “credit,” commonly using rules like:

    • Output tokens are converted at the highest multiplier;
    • Ordinary input tokens at a lower multiplier;
    • Cached input tokens at the lowest discount;
    • Reasoning tokens generated by a model’s chain of thought are usually billed the same as ordinary output.

    A subscription plan is essentially “prepay to get a discount”: the platform locks in revenue ahead of time at a lower price than pay-as-you-go, while users trade a usage commitment for a lower unit price. After conversion, the plan fee often amounts to only a small fraction of the advertised usage. Still using the example task above, here’s an estimate of how many tasks a plan advertised as “2,000–5,000 RMB of usage” can actually support:

    Conversion basis Conversion relationship Est. tasks Converted real value
    All converted at output price 199 RMB ÷ (100 RMB/million) ~300 ~192 RMB
    All converted at input price 199 RMB ÷ (20 RMB/million) ~1,500 ~960 RMB
    Mixed output:input at 5:1 (example) same as above ~550 ~290 RMB
    High-hit fixed prefix, mixed conversion (example) same as above ~770 ~340 RMB

    (Conversion multipliers are illustrative assumptions, used only to explain the method.)

    As you can see, plans all advertised as “2,000–5,000 RMB of usage” can differ by roughly 5x in real value, depending on the platform’s multiplier design. To evaluate a subscription plan, take three steps:

    1. Find the official conversion rules for output, input, and cache hits;
    2. Use your own real task profile (average input size, output size, number of turns, cache-hit rate) to estimate how many tasks you can complete per month;
    3. Calculate the real cost per successful task.

    A useful comparison

    You can convert a subscription tier into a “multiple of pay-as-you-go value” — the ratio of advertised usable credit to the plan price:

    • A subscription product from a major overseas AI vendor, according to public discussion, has a low tier of around $20 with about $400–800 in advertised usage, a multiple of 20–40x; its high tier is around $200 with about $10,000 in advertised usage, roughly 50x.
    • The flagship model discussed in this article has a low tier of around 199 RMB, where users have measured usable pay-as-you-go value of about 1,200–2,800 RMB — a multiple of only about 6–14x.

    Note that measured values like these fluctuate significantly with whether context hits the cache, output length, and task type, so they shouldn’t be treated as precise conclusions. But they point to a signal worth taking seriously: the subscription multiplier is the first touchpoint where ordinary users feel whether a plan is “expensive.” Only when a roughly 200 RMB tier can deliver twenty or thirty times (or more) in pay-as-you-go value — and higher tiers widen that multiplier further — will individual developers and small independent teams realistically afford flagship-level capabilities. In that sense, the real gap between model services isn’t just benchmark scores, but the price of a given level of capability.

    4. Why a Capability Leap Pushes Up Costs: Starting With Reasoning Models

    You can’t judge a price increase by unit price alone — you also have to look at changes in the model’s capability structure. The most notable feature of the new flagship generation is that the “reasoning model” has become the default form: before giving an answer, the model performs a long internal reasoning process, commonly known as a chain of thought. This shift pushes up costs from both the supply and demand sides.

    1. On the demand side: output tokens go from supporting role to leading role

    A traditional chat model might need only a few hundred tokens to answer a question; a reasoning model solving math problems, competition questions, or complex programming tasks can use thousands or even tens of thousands of tokens for internal reasoning plus the final answer. Combined with the data in Part 1, when output grows from 4,000 to 12,000 tokens, the single-call cost with no cache under the new flagship rises from 0.64 RMB to 1.44 RMB, versus 0.288 RMB under the previous tier. Two multipliers drive the increase:

    • The unit price rose fivefold;
    • Output volume may have grown several times over.

    Stacked together, the per-task cost increase can exceed 10x.

    2. On the supply side: the inherent nature of the decode stage

    LLM inference has two phases:

    • Prefill: all input tokens are processed in parallel at once. It’s compute-intensive with high GPU utilization.
    • Decode: output tokens are generated one at a time, and each step must read all model weights plus the key-value cache of every prior token, so the bottleneck is memory bandwidth rather than compute.

    This means that on the same hardware, producing one output token takes far more time than processing one input token. Pricing output higher than input is a universal rule across all kinds of model services.

    3. Fixed overhead from longer inference times

    The longer the chain of thought, the longer each request’s end-to-end latency, and the longer concurrent requests occupy the cluster. On top of pure token billing, this adds costs at the queuing, scheduling, and operations levels.

    4. The pricing logic of cache hits

    The cost of different cache tiers differs markedly:

    • Hitting the key-value cache in the provider’s GPU memory or a dedicated cache: the lowest cost;
    • Hitting a snapshot cache in disk or memory: medium cost;
    • A cache miss that requires full recomputation: billed at the full input price.

    “Cache hit at 1 RMB” corresponds to the lowest tier, which also explains why vendors are willing to offer such a large discount: what it saves is the most expensive prefill compute.

    (All of the above is a general explanation of industry-standard inference and caching mechanisms, and does not involve any specific vendor’s internal implementation.)

    5. Benchmark Rankings vs. Real Cost: Don’t Be Fooled by the Average

    Public leaderboards show the new flagship ranking in the world’s top three, which confirms its “capability density per token” is genuinely first-tier. But between ranking and cost sits your own workload distribution, and there are three things to keep in mind.

    1. Averages hide the distribution

    Leaderboards measure average performance on a fixed set of problems, while your business may be highly concentrated in one type of task — say, code completion, customer-support Q&A, or structured extraction. A model that ranks third on a general leaderboard isn’t necessarily better value than the second-place model on your specific vertical task.

    2. Look at “cost per successful task,” not just accuracy

    1. # Illustrative code (Python pseudocode): track cost inside the eval loop
    2. def evaluate(models, tasks):
    3. for m in models:
    4. passed, cost = 0, 0.0
    5. for t in tasks:
    6. r = m.run(t)
    7. cost += cost_per_call(r.usage.input_tokens,
    8. r.usage.output_tokens,
    9. r.usage.cached_tokens)
    10. passed += bool(r.correct)
    11. n = len(tasks)
    12. print(f'{m.name}: pass rate {passed/n:.1%}, '
    13. f'avg cost/task {cost/n:.4f} RMB, '
    14. f'cost per successful task {cost/max(passed,1):.4f} RMB')

    The last metric is the one worth watching most. Suppose Model A has a 70% pass rate at 0.5 RMB per task, and Model B has a 90% pass rate at 1.0 RMB per task; their cost per successful task is about 0.71 RMB and 1.11 RMB respectively. A is still cheaper — but if A needs multiple retries to reach the pass rate B hits on the first try, the gap closes quickly, or even reverses.

    3. Don’t ignore “the cost of failure”

    Requests that fail validation, time out, or get blocked by safety policies are still billed. When evaluating cost, you must include retries and failed samples in the statistics.

    6. Make the Most of Cache Hits: The Highest-Leverage Cost Optimization

    The table in Part 1 shows that under the same pricing, whether a four-turn conversation uses the cache can make its cost differ by nearly 10x. To reliably get the “1 RMB” cache price, you need to follow a few engineering principles when organizing requests.

    1. Keep the prefix stable

    Context caching in model services is typically matched on an exact-match request prefix. Put unchanging content as far front as possible and volatile content at the back:

    1. # Illustrative code (Python pseudocode)
    2. stable_prefix = system_prompt + tool_definitions + retrieved_docs # keep as stable as possible
    3. volatile_suffix = f'User question: {question}\nCurrent time: {now}' # put changing content last
    4. messages = stable_prefix + volatile_suffix

    In practice:

    • Place tool definitions, system instructions, and knowledge-base snippets all at the very front, and don’t insert timestamps, request IDs, or random numbers in the middle;
    • In multi-turn conversations, don’t rewrite the history every turn — use a “stable prefix + incremental append” approach;
    • In retrieval-augmented scenarios, concatenate fixed documents and dynamic retrieval results in separate segments.

    2. Mind the minimum cache length and validity period

    Most caching mechanisms define a minimum number of cacheable tokens, a validity period, and an invalidation policy. Short requests or those spaced too far apart are likely to miss the cache. High-frequency, short-interval calls with a fixed prefix are best suited to caching; for low-frequency tasks, weigh the cost of maintaining a cache.

    3. Verify hit rates with monitoring

    Responses usually include cache-hit usage fields. Bring them into your logs and monitoring, and track hit rates by business line. A persistently low hit rate often means there’s a “hidden variable” in your prompt templates.

    7. An Enterprise Token Cost Governance Framework

    As call volume grows from individual experimentation to production systems, cost governance should be engineered the way you would manage CPU and memory.

    1. Budgets and quotas

    Set token quotas and cost caps for each business line and each tenant, trigger alerts as they approach thresholds, and downgrade to a cheaper model or refuse service when they’re exceeded:

    1. # Illustrative code (Python pseudocode)
    2. def guard(user_id, estimated_tokens):
    3. used = budget_store.get(user_id)
    4. if used + estimated_tokens > QUOTA[user_id]:
    5. raise QuotaExceeded(user_id)
    6. if used + estimated_tokens > QUOTA[user_id] * 0.8:
    7. alert.warn(f'{user_id} has reached 80% usage')

    2. Per-request cost instrumentation

    For every call, log the input, cache-hit, and output token counts plus the estimated cost, tagged with the business line, tenant, session, feature, and so on. Only when you know “who is spending, and on what feature” does optimization have a direction.

    3. Tiered model routing

    Not every request needs the flagship model. Route by task difficulty:

    • Send intent classification, format conversion, and simple Q&A to a lightweight model;
    • Reserve complex reasoning and code generation for the flagship model.
    1. # Illustrative code (Python pseudocode)
    2. def route(task):
    3. if task.difficulty == 'low':
    4. return light_model
    5. if task.difficulty == 'medium':
    6. return standard_model
    7. return flagship_model

    4. Compress context and output

    For context: use rolling summaries of conversation history, deduplicate then truncate retrieved snippets, and keep only the necessary fields from tool return values. For output: explicitly constrain the format and length (for example, require JSON and cap the maximum output tokens) to reduce wasted reasoning. For code-generation tasks, having the model output a patch rather than a whole file can significantly cut output tokens.

    5. Async and batch processing

    Offline tasks (batch summarization, data cleaning, document labeling) are latency-insensitive and can run off-peak. If your platform offers batch inference, it usually also comes with a lower unit price.

    6. Cost guardrail tests

    Add a fixed set of test cases to your CI pipeline and run a cost regression automatically whenever a prompt or model version changes. If any task’s average token consumption rises noticeably, alert immediately — to avoid a “silent price increase.”

    Conclusion: Expensive or Not Depends on the Price per Successful Task

    Back to the original question: with the new flagship at output 100 RMB, input 20 RMB, and cache hits at 1 RMB — is it expensive?

    By unit price, it’s genuinely five times the previous generation, and higher than most mid- and light-weight models. But by capability density, if it raises the pass rate on your core tasks from 70% to 90% and cuts manual rework in half, the cost per successful task may actually go down, not up.

    As a developer, the right stance is neither to be scared off by the sticker price nor to blindly chase the newest model, but to do three things well:

    • Build your own cost model: break it into input, cache-hit, and output, then multiply by the retry factor;
    • Organize your context well: stable prefix, incremental append, and make cache hits the norm;
    • Govern your call pipeline: tiered routing, budget quotas, and cost guardrails.

    Model pricing is determined jointly by the market and compute costs, and ordinary developers can’t change it. But “how much each task costs” is largely in the hands of the people writing the code. Whether you’re calling any model service or building upper-layer applications on a cloud platform like Baidu AI Cloud, this approach applies. If one day a roughly 200 RMB tier can offer twenty or thirty times (or even more) in pay-as-you-go value, the day when flagship capabilities truly reach everyday developers won’t be far off.