How Subscription Token Consumption Is Actually Calculated: A Measurement Guide
This article explains why subscription quotas cannot be directly converted into tokens and shows how to reverse-engineer the underlying billing logic. It covers measuring four separate token categories, using percentage-jump sampling to reduce quantization error, applying workload weighting to estimate usable capacity, and understanding why theoretical numbers run high. It also outlines practical capacity-planning steps for developers evaluating subscription plans before purchase.
1. The Starting Problem: Why Subscription Quotas Don’t Convert Directly to Tokens
In enterprise AI coding and large language model deployments, a common source of confusion is this: a plan advertised as “unlimited” or with a “very large quota” hits its ceiling within two or three days of real use. The reason is not mysterious. Subscription quotas are not displayed in tokens. They are presented as a percentage progress bar. Users see integers such as 17% or 18%, while a hidden credit system operates behind the scenes.
To determine how many tokens a subscription plan can actually support, the core task is to translate the “quota percentage” back into a “per-token deduction rate.” This is a classic black-box measurement problem: the input is a visible integer percentage, and the output is the consumption coefficient for four token categories.
2. The Four Token Categories Must Be Measured Separately
A real inference request is typically billed across four categories:
- Fresh input: context newly generated by the current request, which carries the highest cost.
- Cache write: the one-time overhead of writing a long context into the cache.
- Cache read: the portion reused after a cache hit, which carries the lowest cost.
- Output: generated content, usually billed at a relatively high unit price.
Measuring them together in a mixed workload yields only a weighted average, which cannot support any fine-grained calculation. The correct approach is to control variables. To measure cache reads, first write a fixed long context, then repeatedly reuse the same prefix. To measure fresh input, change the content on every request to force cache invalidation. To measure output, extend the generation length on its own while compressing the share of the other three categories.
A schematic measurement loop can be abstracted as:
def probe(kind, fixed_context=None, step_tokens=1_000_000):start = read_quota_percent()used = 0while True:send_request(kind, fixed_context, step_tokens)used += step_tokensnow = read_quota_percent()if now > start: # the percentage jumpsreturn used / (now - start)
3. Percentage-Jump Sampling: Averaging Over Intervals to Remove Quantization Error
Because the interface displays only integer percentages, a single measurement carries a large error. The reliable engineering strategy is to run a large number of requests continuously, record the tokens consumed as the percentage moves from 17% to 18%, and from 18% to 19%, then average across multiple complete intervals. The longer the intervals and the more samples collected, the more thoroughly the quantization error is diluted.
The essence of this step is using a large sample to restore one-decimal display precision into effective precision. Once the deduction rates for all four token categories are measured, you obtain four coefficients, denoted c_fresh, c_write, c_read, and c_out, each representing how much subscription quota one million tokens of that category consumes.
4. Weighted Reverse Calculation: Turning Coefficients into Usable Capacity
With the four coefficients in hand, weight them by the token composition of the target workload to derive the plan’s theoretical throughput:
Quota consumed per million request tokens= 0.025 * c_fresh + 0.005 * c_write+ 0.970 * c_read + 0.005 * c_outTotal usable tokens ≈ 100% / the expression above
Industry analysts often use an extremely favorable structure in similar calculations: 97% cache-hit input, 2.5% fresh input, and 0.5% output. This resembles the rated range of an electric vehicle: it is a theoretical value measured under continuous driving, no load, low speed limits, and good aerodynamics. Once you drive in stop-and-go traffic with frequent cold starts, actual range can drop from 500 kilometers to below 350.
5. Why Theoretical Values Are Systematically Too High
The sources of deviation can be summarized in four points:
- Caches expire and become invalid. Switching between long sessions or rewriting context can sharply reduce the hit rate.
- Task types vary. Retrieval, refactoring, and cross-file analysis substantially raise the share of fresh input and output.
- Cache writes are a recurring periodic cost. When long contexts are rebuilt repeatedly, the overhead accumulates.
- The output share in code generation and test-case writing scenarios is far higher than 0.5%.
Treating a 97% hit rate as the norm therefore significantly overestimates usable quota. A more robust approach is to prepare optimistic, neutral, and conservative composition models and calculate the upper and lower bounds of capacity for each.
6. Capacity Planning That Stays Close to Reality
- Measure before you buy: use the method above to measure the four coefficients for the target plan, then make a decision.
- Control context size: trim prompts and retrieved snippets to reduce cache writes and fresh input.
- Improve prefix stability: place stable content first and variable content last to increase cache reuse.
- Build observability: use monitoring, alerting, and logging services to track token composition and quota consumption rate over each period.
- Add elastic fallback: keep the stable baseline within the subscription quota, and offload burst traffic to pay-as-you-go general cloud capabilities, such as container platforms and message queues for asynchronous tasks.
7. Conclusion
Whether measured by token unit price or by task cost, subscriptions are not inherently cheaper. The difference lies only in whether the billing structure matches the workload. By understanding the reverse-calculation logic of “four token categories billed independently + interval sampling + workload weighting,” developers can calculate real capacity before purchasing and avoid being misled by theoretical peaks. In related practice, Baidu AI Cloud likewise recommends driving capacity decisions with observable data rather than relying on advertised metrics.
