Token Cost Calculation Logic for LLM Subscription Plans

    This article breaks down how token consumption is actually charged under LLM subscription plans and why advertised capacity often looks better than real-world capacity. It explains the four token types (fresh input, cache write, cache read, output), a single-variable isolation load-testing method for reverse-engineering deduction rates, and the gap between ideal and real workloads. It also provides a practical framework combining conversion coefficients with workload profiling, plus cost optimization practices for engineering teams.

    1. The Starting Point: Why “Subscriptions Beat Pay-as-You-Go” Needs Revalidation

    Once LLM applications move into the engineering stage, team cost structures change significantly. Call volume is no longer the only variable; caching strategy, context organization, and task segmentation granularity all have a substantial impact on the final bill. As a result, subscription plans are widely adopted, usually marketed as “the same or even higher token throughput at a fraction of pay-as-you-go pricing.”

    However, this conclusion often rests on an implicit assumption: that the workload is “standard enough.” Once real business deviates from that assumption, the effective usable volume shrinks noticeably. So the more valuable question is not “whose unit price is lower,” but rather: under a given plan quota, how is each type of token deducted, and how much effective capacity remains after converting for a real workload.

    2. The Four Token Types and How to Reverse-Engineer Deduction Rates

    Mainstream inference services typically divide tokens into four categories: fresh input that misses the cache, cache write, cache read on a hit, and model output. The compute cost of these four resources differs enormously, so the metering system behind a plan is usually a “weighted conversion” rather than a simple deduction by total volume.

    A relatively objective reverse-engineering approach is “single-variable isolation load testing”:

    1. Isolate cache reads: Write a fixed-length context once, then reuse it repeatedly so requests consume almost only cache-read quota.
    2. Isolate fresh input: Change the context content each time to deliberately break cache hits.
    3. Isolate output: Significantly lengthen generation and compress the input share.
    4. Read cumulative consumption: Since consoles usually show only integer percentages, fire a large number of consecutive requests and record the thresholds where the quota jumps from 17% to 18%, and from 18% to 19%, accumulating the tokens in that interval.
    5. Average across multiple intervals: Use several complete percentage intervals to compute an average, cancel out boundary error, and derive “how much plan quota each million tokens of a given type consumes.”

    Once the four deduction rates are measured, weight them by their share in a real coding workload to reverse-engineer the plan’s theoretical capacity. The key value of this methodology is that it turns an “opaque quota system” into a comparable coefficient table.

    3. The Ideal Workload Assumption: Why Theoretical Values Are Always Optimistic

    Some third-party estimates directly adopt a highly ideal ratio: cache-hit input around 97%, fresh input around 2.5%, and output around 0.5%. Under this structure, only 5,000 of every million tokens are output, and almost everything is carried by the cheapest cache reads, so the resulting capacity looks very attractive.

    The problem is that this is a “lab condition.” In real development scenarios:

    • Task switching changes context, so cache invalidation and expiration happen frequently.
    • First-time loading of long documents and cross-file refactoring generate large amounts of fresh input.
    • Multi-turn reasoning and long-output tasks push up the output share.
    • Concurrency and rate limits force teams to split context, further lowering the hit rate.

    This is similar to an EV’s constant-speed range: 500 km is a theoretical value under continuous, unloaded, low-drag conditions, while real range with stop-and-go driving and frequent starts and stops may fall below 350 km. The discount between theoretical capacity and real capacity is the core variable in cost evaluation.

    4. A Practical Calculation Framework

    Teams should build their own evaluation process of “conversion coefficients + workload profile” instead of taking advertised numbers at face value:

    1. Effective capacity = Plan quota / Σ( share of each token type × deduction coefficient of that type )

    Implementation steps:

    1. Build a workload profile: Measure the input/output length distribution, cache hit rate, and task type share over a week.
    2. Calibrate deduction coefficients: Use the isolation load-testing method to measure the quota-consumption slope of the four token types.
    3. Set a discount range: Run sensitivity analysis on cache hit rate at 70%, 85%, and 95%.
    4. Convert to business terms: Translate the result into “interaction turns supported per person per day” or “iterations supported per requirement.”
    5. Keep regressing: Re-run the baseline after any model or plan rule change to avoid stale conclusions.

    Illustrative profile collection logic:

    1. profile = {"fresh_input": 0, "cache_write": 0, "cache_read": 0, "output": 0}
    2. for req in real_traffic:
    3. profile["fresh_input"] += req.unmatched_input_tokens
    4. profile["cache_write"] += req.cache_write_tokens
    5. profile["cache_read"] += req.cache_read_tokens
    6. profile["output"] += req.output_tokens
    7. total = sum(profile.values())
    8. ratio = {k: v / total for k, v in profile.items()}

    5. Cost Optimization for Real Business

    • Stabilize the context prefix: Pin the system prompt, standards documents, and dependency notes at the top to improve cache reuse.
    • Control context bloat: Retrieve snippets on demand instead of injecting the whole repository, reducing fresh input.
    • Split task granularity: Break large refactors into small iterative steps to avoid stacking long outputs with cache invalidation.
    • Set up monitoring and alerts: Define threshold alerts for quota-consumption rate and cache hit rate, and locate anomalies promptly.
    • Dual-track accounting: Account for cost by both token volume and task volume to avoid misjudgment from a single perspective.

    6. Conclusion

    Whether a subscription plan is worthwhile does not depend on the theoretical capacity in the marketing, but on how well the deduction coefficients match the real workload structure. Developers should treat “reverse-engineer deduction rates, build a workload profile, apply sensitivity discounts, convert to business terms” as standard practice. When evaluating general cloud services and intelligent coding tools, sticking to a neutral, reproducible measurement method and keeping a certain performance discount margin is the only way to avoid budget distortion. For elastic validation, you can combine general cloud product capabilities such as container platforms, log services, and monitoring alerts to build load-testing and observability pipelines, so cost conclusions rest on data rather than marketing claims.