Reverse-Engineering Subscription AI Coding Quotas into Equivalent Tokens

    Subscription AI coding plans often expose only a usage percentage while billing against an unpublished credit system. This article explains how to reverse-engineer that black box with single-token-class saturation tests, convert percentage jumps into per-class credit rates, and weight those rates by a real workload mix so ideal cache-heavy estimates are not mistaken for usable capacity.

    1. The starting point: subscription quotas are a black-box meter

    Subscription coding assistants usually show only a progress percentage, while an unpublished credit system runs underneath. Users mainly notice two things: whether the quota drops quickly or slowly, and whether they hit a limit before the billing period ends. To judge how many tokens a plan is actually worth, that black-box meter has to be reverse-engineered.

    The basic assumption is that credit use is approximately linear with token use, and that different token classes carry different weights. Interactive coding traffic is commonly split into four classes:

    • Fresh input: context added by the current request and not covered by cache.
    • Cache write: context written the first time a cache entry is created; this class is usually the most expensive.
    • Cache read: repeated reads after a cache hit; this class is usually the cheapest.
    • Output: generated code and explanatory text; this class is usually the most expensive or the second most expensive.

    Weights across these four classes often differ by one or two orders of magnitude. “How many tokens can this plan run?” is therefore an incomplete question. The useful question is how many tokens it can run under a given workload mix.

    2. Method: saturate one class, then measure percentage jumps

    A careful third-party evaluation approach is to saturate one token class at a time under controlled conditions and watch how the quota percentage moves.

    The procedure has four steps:

    1. Build a single-class load
      • Cache reads: write a fixed-length context once, then reuse the same prefix repeatedly.
      • Fresh input: change the request content every time so nothing hits cache.
      • Cache writes: keep introducing new prefixes so the cache is rebuilt again and again.
      • Output: keep the input short and push generation length as far as it will go.
    2. Measure intervals from integer percentage jumps
      The UI shows only integers, so record the tokens consumed as the display moves from 17% to 18%, then from 18% to 19%, and so on.
    3. Average several intervals to reduce boundary error
      Each interval has truncation error at both ends. Running several complete intervals and averaging them spreads that error out.
    4. Normalize and weight
      Once you know how many credits one million tokens of each class consume, weight those rates by the four-class mix of a real workload and estimate the plan’s equivalent capacity.

    The sketch below is illustrative only. The numbers are assumed demo values, not parameters of any real product:

    1. # Single-class saturation results: tokens of that class supported per 1 credit
    2. RATE = {
    3. "cache_read": 5_000_000,
    4. "fresh_input": 1_200_000,
    5. "cache_write": 800_000,
    6. "output": 300_000,
    7. }
    8. def effective_tokens(credit_budget, mix):
    9. """mix: share of each token class in total tokens; must be normalized"""
    10. s = sum(mix.values())
    11. mix = {k: v / s for k, v in mix.items()}
    12. # Credit cost per million tokens
    13. cost_per_mtok = sum(
    14. mix[k] * (1_000_000 / RATE[k]) for k in RATE
    15. )
    16. return credit_budget / cost_per_mtok * 1_000_000
    17. ideal = {"cache_read": 0.97, "fresh_input": 0.025, "output": 0.005}
    18. real = {"cache_read": 0.55, "fresh_input": 0.25,
    19. "cache_write": 0.05, "output": 0.15}
    20. print(effective_tokens(1000, ideal)) # theoretical upper bound
    21. print(effective_tokens(1000, real)) # closer to actual use

    3. Why an ideal workload mix badly overstates capacity

    Some public estimates use 97% cache-hit input, 2.5% fresh input, and 0.5% output. That is an extremely cache-friendly coding scenario: of every million tokens, 970,000 are cache reads and only 5,000 are output. Under that mix, equivalent capacity is pushed toward a theoretical ceiling.

    Real use is less friendly, for four reasons:

    • Task switches invalidate prefixes. Changing repositories, branches, or a global setting changes the prefix hash and drops the cache.
    • Caches expire. Coming back after idle time requires a rewrite, so high-weight cache-write tokens are charged.
    • Context is compressed and reordered. Summaries or truncation in a long session change the prefix and lower the hit rate.
    • Output share is naturally higher. Debugging, refactoring, and writing tests generate far more than 0.5% output.

    This is similar to an EV’s rated range: 500 km assumes continuous driving, no load, a low speed limit, and no wind resistance. With stop-and-go traffic and the climate control on, 350 km can already be a good result. The gap between the theoretical figure and what you feel is the discount imposed by the workload mix.

    4. Build your own estimate

    Sampling your own traffic is more reliable than citing someone else’s conclusion. Track three signals: daily totals for the four token classes, cache hit rate, and how fast the quota percentage falls. With those series you can fit a local weight table and check it with least squares:

    1. import numpy as np
    2. # X: each row is one observation window of the four token classes (millions)
    3. # y: quota-percentage drop in the same window
    4. X = np.array([[3.2, 0.1, 0.05, 0.4],
    5. [1.8, 0.3, 0.10, 0.6],
    6. [4.5, 0.0, 0.00, 0.2]])
    7. y = np.array([1.0, 1.4, 0.9])
    8. w, *_ = np.linalg.lstsq(X, y, rcond=None)
    9. print(dict(zip(["cache_read","fresh_input","cache_write","output"], w)))

    The fitted w is a local estimate of credits consumed per million tokens of each class. Budgeting with that estimate is more accurate than any nominal headline figure.

    5. Engineering controls

    • Keep prefixes stable. Put unchanging system prompts, dependency lists, and coding rules first, and variable content later, so cache hits stay high.
    • Control session size. Start a new session when the task changes instead of letting a long session accumulate useless context.
    • Route by model tier. Send mechanical completion to a lighter model and architectural reasoning to a stronger one, and trade model mix for cost structure.
    • Measure before you optimize. Instrument token and credit use in the application, and connect logging and alerts as shared capabilities so cost can be reviewed later.
    • Attribute cost to tasks. Account in credits per task, not price per token, if the number is supposed to line up with business value.

    6. Conclusion

    Comparing subscription plans by list price alone, or by a theoretical token equivalent alone, is not enough. The reliable path is to measure the charge weight of each of the four token classes, apply your real workload mix, and get a localized equivalent capacity. Figures based on an ideal cache hit rate are an upper bound, not an expectation. Using them as a planning baseline almost guarantees an overrun. Whether pricing is per token or per task, cost discussions only make sense after the metering units are aligned.