LLM Cost Transparency: A Practical Guide to Token Billing, Peak Pricing, and Caching

    This article explains how large language model billing works and how to turn it into an engineering problem you can optimize. It covers why tokens, not characters, are the billing unit and why output tokens cost more than input tokens; how peak and off-peak pricing maps inference demand onto a compute supply curve; how prefix cache hits can cut input costs by one to two orders of magnitude; and why free-tier quotas are tightening. It closes with a four-layer cost observability checklist—collection, aggregation, attribution, and governance—so you can measure, attribute, and reduce spend per session, per user, and per model tier.

    Introduction: What 0.000528 Yuan Actually Means

    A single “hello”—60 input tokens, 51 output tokens—works out to 0.000528 yuan. The number itself is trivial. What matters is where it appears: on a chat interface that ordinary users can see.

    For the past two years, the industry’s dominant narrative has been that intelligence keeps getting cheaper. Taking a model with GPT-3.5-level performance on the MMLU benchmark as the reference point, the price per million tokens fell from roughly $20 in November 2022 to roughly $0.07 in October 2024—about a 286x drop. That collapse reshaped how the industry thinks about cost as a barrier to entry: high-level intelligence no longer has to be expensive.

    But once unit prices fall to this range, an overlooked fact surfaces: cheap is not the same as sufficient, and it does not mean the cost disappears. The demand elasticity created by lower unit prices takes the money you saved and spends it again—sometimes spends more. So vendors have started doing two things: capping free allowances, and making consumption visible. The first is resource scheduling; the second is cost education. Together, they amount to installing an electricity meter on intelligence.

    1. Tokens: The Metering Unit of the Intelligence World

    An electricity meter measures kilowatt-hours. An LLM measures tokens. To understand billing, you first have to accept that a token is not a “word count.”

    A token is the smallest unit of text the model splits input into, produced by a tokenizer working against a vocabulary. In English, a single long word may be split into several subwords. In Chinese, a common word is usually one token, while rare characters or punctuation may be split into several. There is no fixed conversion ratio between token count and character count; only the specific tokenizer decides.

    More importantly, input and output are billed separately, and the output unit price is usually significantly higher. The reason lies in the compute characteristics: the input stage can be processed in parallel, while the output stage is autoregressive, generated token by token, with every step reading the entire prior context. That puts heavy pressure on memory bandwidth and allows little parallelism.

    1. # Skeleton: cost estimation for a single call (not a real API)
    2. def estimate_cost(input_tokens, output_tokens, price):
    3. in_cost = input_tokens * price["input"] / 1_000_000
    4. out_cost = output_tokens * price["output"] / 1_000_000
    5. return round(in_cost + out_cost, 6)
    6. # 60 input + 51 output, input 2 yuan/million, output 8 yuan/million
    7. print(estimate_cost(60, 51, {"input": 2, "output": 8})) # 0.000528

    This calculation reproduces where “0.000528 yuan” comes from, and it also shows something else: for a short conversation, the cost is dominated almost entirely by the output side, while for long-context scenarios the cost is dominated by the input side. The optimization strategies are therefore completely different.

    2. Peak and Off-Peak Pricing: Scheduling Compute Like a Power Grid

    One platform introduced peak and off-peak pricing in August 2026, with peak hours defined explicitly as 9:00–12:00 and 14:00–18:00 on weekdays. All other hours, plus weekends and public holidays, run at the off-peak price, which is about half the peak price. This is not a marketing gimmick; it is a direct mapping of the compute supply-and-demand curve.

    LLM inference load is strongly periodic: concurrency is high during working hours, GPU utilization approaches saturation, and marginal resources are scarce. At night and on weekends, load collapses and expensive accelerators sit idle. Peak pricing uses a price signal to push deferrable workloads into the trough—structurally the same idea as off-peak electricity usage.

    The direct implication for developers: offline jobs should be treated as schedulable load, not something you trigger whenever you happen to think of it.

    • Batch summarization, log analysis, data cleaning, benchmark runs, and fine-tuning data construction should all go into a queue and execute during off-peak hours.
    • Interactive paths stay available at peak, with caching and smaller models used to push down per-call cost.
    • Billing needs to distinguish cache hits from misses; the two unit prices can differ by one to two orders of magnitude.

    3. Cache Hits: The Undervalued Cost Lever

    On mainstream platforms, the input price is usually split into two tiers: a cache-hit price and a cache-miss price, with the former often only a few percent of the latter. Using one platform’s published figures as an example: for Flash-class models at peak, a cache hit is 0.04 yuan versus 2 yuan for a miss; for Pro-class models, the corresponding figures are 0.3 yuan and 9 yuan. The gaps are close to 50x and 30x.

    The precondition for cache reuse is that the prefix is exactly identical. This means the way you organize a prompt directly determines the bill: put stable system instructions, tool definitions, and domain knowledge at the front, and put user input, timestamps, and random IDs at the end. Insert variable content into the prefix once, and the cache for that entire prefix is invalidated.

    1. # Recommended: stable prefix first, variable content last
    2. [System role and constraints] <- unchanged long-term, cacheable
    3. [Tool/function definitions] <- versioned changes, cacheable
    4. [Domain knowledge/long documents] <- cached per document version
    5. [This turn's user input + timestamp] <- changes every time, keep at the end

    One caveat: platforms differ in cache granularity, invalidation rules, and how hits are determined. In engineering practice, go by the actual bill and the official metering definitions, and do not assume behavior is consistent across platforms.

    4. Quota Limits: From “Unlimited Free” to a Perceptible Allowance

    Tighter free allowances are the other side of the same logic. Typical manifestations: the maximum length of a single text input is compressed (for example, down to roughly 40,000 characters from a longer context), long sessions inactive beyond a certain number of days can no longer be resumed, and once continuous usage crosses a threshold you are prompted to wait for the quota to recover.

    Each of these policies serves an engineering purpose. Capping single-request context length constrains peak memory usage and the worst-case latency of a single request. Expiring and reclaiming sessions releases KV cache that has been mounted for a long time. Rate limits and quota recovery provide fair scheduling under a fixed resource pool.

    For application designers, the advice is to treat quota as a first-class concern:

    1. Log the input/output tokens and converted cost of every turn on the server side, forming usage metrics you can aggregate.
    2. Set a sliding-window token budget per session, and compress history proactively when it is exceeded rather than failing outright.
    3. Periodically summarize long sessions and persist the summary, replacing raw history with a short digest—this both avoids expiry-based reclamation and lowers input cost.
    4. Feed usage metrics into monitoring and alerting, with thresholds set per tenant, per scenario, and per model tier.

    5. Wiring the Meter Into Your System: An Observability Checklist

    The real value of billing transparency is that it turns cost from a finance problem into an engineering problem you can optimize. A minimal viable cost observability system has four layers:

    • Collection layer: emit one structured record per call, with fields covering at least the scenario identifier, model tier, input/output tokens, cache hit status, time-slot label, and converted amount.
    • Aggregation layer: aggregate by scenario and time slot to compute three core metrics—cost per session, cost per user per day, and cache hit rate.
    • Attribution layer: distinguish “expensive on input” from “expensive on output.” Input-dominated means context management is the problem; output-dominated means there is no constraint on generation length.
    • Governance layer: set budgets and circuit breakers, automatically downgrading to a smaller model or shorter context when growth is abnormal.
    1. {
    2. "scene": "doc_qa",
    3. "tier": "flash",
    4. "input_tokens": 8421,
    5. "output_tokens": 316,
    6. "cache_hit_ratio": 0.87,
    7. "peak": false,
    8. "cost": 0.00412
    9. }

    With this table, optimization has a direction: raising the hit rate from 0.5 to 0.9 can cut input cost by an order of magnitude; moving non-real-time jobs to off-peak hours halves cost outright; and setting a length cap on output with structural constraints keeps the model from spending budget on redundant elaboration.

    Conclusion: Transparency Is the Prerequisite for Governance

    From $20 per million tokens to the 0.07-yuan range, the industry took two years to drive the price of intelligence to the floor. The point of a feature like a conversation tariff lookup is not that users will actually pay that 0.000528 yuan, but that it translates abstract compute consumption into a number everyone can read.

    When the metering unit is clear, the price signal is explicit, and consumption is attributable, cost optimization stops being guesswork and becomes engineering. Whether you are a developer consuming intelligence or a platform providing it—including cloud vendors such as Baidu AI Cloud that offer capabilities in the form of general-purpose compute and model services—you need this meter: it first makes waste visible, then makes optimization feasible.