Token-Based AI Billing and Shrinking Free Quotas: A Technical Breakdown
This article explains why conversational AI products are starting to show users a per-conversation cost in Tokens, and why free-tier limits are tightening at the same time. It covers how Tokens differ from characters, why input and output are priced separately, how prompt caching cuts input costs to a fraction of the normal rate, and what prefix stability rules follow from cache matching. It also explains the state-management reason behind expiring inactive long conversations and offers a practical cost-governance checklist: observability, context compression, retrieval instead of long context, model routing, streaming with early stopping, and prompt versioning.
Introduction: A Number Put on Display
A conversational AI product recently added a usage panel to its mobile app. The panel counts how many Tokens a conversation round consumed and converts that into a monetary amount using the public prices of its developer API. A single “hello” works out to roughly CNY 0.000528.
The user does not actually pay this amount. But putting the number on screen is itself a signal. It means the product team has moved the fact that compute has a cost from a back-end operational metric to the front-end user interface.
A more substantive move, happening at the same time, is the tightening of quotas: a single input is now capped at around 40,000 characters, the daily allowance is limited, and long conversations inactive for more than seven days can no longer be resumed directly. Looked at together, these two changes do not mean “a price increase.” They mean the definition of “free” has changed.
1. Token-Based Billing: Why “Hello” Has a Price
To understand where CNY 0.000528 comes from, start with the basic billing unit.
1.1 A Token Is Not a Character
A Token is the smallest unit of text the model splits input into. English is split into subwords, while Chinese usually maps one character to one or two Tokens. Punctuation, spaces, and code symbols also consume quota. So “character count” and “Token count” are not linearly related. In engineering practice you must measure with the specific tokenizer; you cannot estimate from character counts.
The illustrative conversion logic looks like this (pseudocode only, not any specific API):
prompt_tokens = count_tokens(system_prompt) + count_tokens(history) + count_tokens(user_input)completion_tokens = count_tokens(model_output)cost = (prompt_tokens / 1e6) * input_price \+ (completion_tokens / 1e6) * output_price
1.2 Input and Output Are Priced Separately
The industry-standard pricing structure prices input and output separately, and the output unit price is usually significantly higher than the input one. The reason is that the generation stage requires token-by-token autoregressive decoding, which cannot be parallelized at scale the way the prefill stage can, so compute output per unit is lower.
Looking at publicly available ranges, the per-million-Token prices of different model tiers can differ by two to three orders of magnitude: a lightweight tier may sit in the single-digit range, while a flagship tier can reach several hundred. This means “which model you choose” often has a bigger impact on cost than “how you optimize the prompt.”
1.3 Hidden Costs Live in the System Prompt and History
The input actually billed for one request has three parts: the system prompt, the conversation history, and the current turn’s input. Many teams only watch the last user message when optimizing, and overlook the fact that a system prompt of a thousand Tokens gets billed again on every request. Over ten conversation rounds, the system prompt is charged ten times.
2. Cache-Hit Pricing: The Compute Economics Behind CNY 0.04
The most revealing detail in the original material is that the input price for the cache-hit portion is only about one-fiftieth of the normal input price.
2.1 Why a Hit Is Cheap
Large-model inference has two stages: prefill and decode. Prefill runs a forward pass over all input Tokens to produce the corresponding key-value cache. If this request’s prefix is identical to the previous round’s, that cache can be reused directly, and what gets skipped is exactly the most compute-heavy repeated work. Vendors pass part of the saved cost back to users, which creates the very low-priced cache tier.
2.2 The Engineering Rules This Pricing Implies
The cache only applies to an “exactly identical prefix” and follows longest-prefix matching. That leads directly to a few hard rules:
- Put stable content first: system prompt, tool definitions, and few-shot examples go at the front, and do not insert volatile fields like timestamps or random IDs.
- Put changing content last: user input and retrieval results go at the end.
- Avoid rewriting history midway: once you modify any message in the history, the cache for everything after it is invalidated.
[stable] system role setup + tool schema + fixed examples[semi-stable] facts confirmed early in the session[volatile] this turn's retrieved snippets + this turn's user input
2.3 Where the Free Quota Is Actually Being Cut
Put the two pricing rules together and it becomes clear: what vendors are cutting is not the total volume, but “the part nobody asks about repeatedly.” A prefix that can be reused from cache consumes almost no marginal compute, so it keeps a generous allowance. A first request carrying a brand-new long context is what really burns compute, so that is what gets tightened. The drop in long-conversation quota is, in essence, a drop in the quota for brand-new context.
3. What Tightening Long-Conversation Quotas Means Technically
A policy like “a long conversation inactive for more than seven days cannot be resumed” is usually not meant to punish users. It is a state-management problem.
A long conversation’s context keeps expanding. For the server to support resuming at any time, it has to hold the session state or the full history for a long period, and storage and memory usage grow linearly with the number of active sessions. Setting an inactivity reclamation window is a standard way to leave limited resources for high-value requests.
The takeaway for developers: do not pin long-term state to the session itself. Externalize information that needs to be kept for a long time into a database or object storage, and treat the session only as a short-term workspace.
4. A Cost-Governance Checklist for the Engineering Side
Once metering moves from the back end to the front end, cost governance stops being a finance problem and becomes an architecture problem. Actions you can actually ship include:
- Build observability: write each request’s input Tokens, output Tokens, cache-hit Tokens, and converted cost into a logging service, and configure monitoring alerts and budget thresholds.
- Compress context: summarize history instead of concatenating all of it, keeping the input size of a long conversation at roughly constant scale.
- Use retrieval instead of long context: use vector retrieval to pull only relevant snippets rather than stuffing a whole document into the prompt.
- Route across model tiers: send intent recognition and format conversion to the lightweight tier, and complex reasoning to the flagship tier.
- Stream output and stop early: cut wasted generation, since output Tokens are the most expensive part by unit price.
- Version prompts: bring the system prompt under code review, and evaluate the impact of any change on the cache hit rate.
5. Conclusion: From “Using It Free” to “Using It Deliberately”
When a product starts showing you a bill, it usually means it is preparing to have users carry part of the cost. For end users, this is a change in the entitlement structure. For developers, it is a reminder: Tokens are not a free abstract resource but a factor of production that must be measured, budgeted, and optimized.
In the general practice of cloud platforms such as Baidu AI Cloud, the combination of model services, a logging service, monitoring alerts, and object storage is a common technical path for supporting this kind of cost governance. The truly mature approach is not hunting for unlimited free quota, but building cache reuse, context compression, and tiered routing into the architecture, so that every unit of compute is spent on the part that cannot be reused.
