How to Convert Subscription-Based LLM Usage into an Effective Per-Token Cost
This article explains how to translate a fixed subscription fee for LLM or AI coding tools into an equivalent pay-as-you-go price per million tokens. It covers the core conversion formula, four rules for aligning measurement boundaries, a breakdown of what drives 1.4 billion tokens of usage in a single billing cycle, and why capability tier and cost tier do not scale together. It also includes a sample Python script for tracking token composition, a practical cost-optimization checklist, and a framework for measuring cost per accepted unit of output rather than per raw token.
1. Why “how many tokens did I use this month” deserves a real calculation
When people use AI coding assistants or LLM chat services, they usually pay attention to two things: whether the model is strong enough, and whether the monthly fee is acceptable. What actually determines long-term cost is a third dimension: the effective price per token.
If one person consumes roughly 1.4 billion tokens in a single billing period, and most of those tokens are handled by the highest capability tier, converting that usage into pay-as-you-go terms can bring the equivalent unit price down to the range of a few tenths of a yuan per million tokens. That number is worth a closer look not because it is “cheap,” but because it means two things are true at the same time: the capability ceiling is being pushed continuously, while the marginal cost has been diluted to the point where it is nearly negligible.
One thing should be clear up front: subscription pricing and usage-based pricing are two different business models, and they cannot be equated directly. A subscription is essentially a fixed monthly fee plus a usage allowance plus fair-use constraints. Usage-based billing is essentially unit price multiplied by token count. The point of conversion is not to argue that one billing model is more cost-effective, but to provide a single ruler that makes different plans comparable under the same measurement.
2. Converting a subscription allowance into an effective unit price: definitions and formula
The core formula is simple:
Effective unit price (CNY per million tokens) = period cost (CNY) ÷ total tokens in period × 1,000,000
What actually causes mistakes is not the formula but aligning the numerator and the denominator. Four rules are worth fixing in place:
- Align the billing period: the numerator should be the fixed fee for one complete billing cycle, and the denominator should cover all tokens within that same window. Do not divide a full month’s fee by usage from only the last few days of the month.
- Use a consistent token definition: state clearly whether you are counting input tokens, output tokens, or the sum of both. If the service prices them separately, use a weighted calculation rather than a simple sum.
- Separate cache hits: most usage-based pricing schemes discount input tokens that hit the cache. These should be listed separately during conversion; otherwise the effective unit price will be overestimated or underestimated.
- Exclude abnormal usage: tokens generated by runaway scripts or retry loops should be flagged separately. They do not represent real business cost.
A weighted definition can be written as:
Weighted tokens = input tokens + output tokens × k
Here k reflects the cost weight of output relative to input. If you do not make this distinction and take the total directly, what you get is a “blended effective unit price,” which is sufficient for side-by-side comparison.
3. Where 1.4 billion tokens come from: a breakdown of the usage structure
1.4 billion tokens in a single period is not the result of “chatting for many days.” It is a typical pattern of engineered usage, which can be roughly split into four categories:
- Repeated long-context feeding: entire repositories, long documents, and log fragments are placed into the context as a whole, making the input tokens for a single request very large.
- Multi-round iterative convergence: one requirement goes through multiple rounds of generation, verification, and correction, and each round carries the full history.
- Automated batch tasks: batch refactoring, batch commenting, and batch test-case generation, where the number of requests grows linearly or even exponentially.
- Failures, retries, and fallbacks: repeated requests caused by parse failures, format mismatches, and timeouts are a major hidden cost.
A simple script for self-checking:
# Summarize the token composition of each session and produce the data needed for conversionsessions = [{"name": "repo_review", "input": 820_000, "output": 60_000, "cached": 700_000, "retry": 3},{"name": "test_gen", "input": 410_000, "output": 120_000, "cached": 120_000, "retry": 1},]total = sum(s["input"] + s["output"] for s in sessions)cached_ratio = sum(s["cached"] for s in sessions) / totalprint(f"Total tokens: {total:,}, cached ratio: {cached_ratio:.1%}")
When the cache hit ratio is high, the real cost is far below the estimate based on total tokens. This is one of the main reasons the effective unit price can look extremely low.
4. Capability tier and cost tier are not the same curve
A common misconception is that the strongest model must be the most expensive, so the idea of “using the strongest model and still spending little” seems unreasonable. In reality, cost is determined by four variables together: unit price, total tokens, cache hit rate, and the proportion of ineffective retries. The capability tier only affects the first one, while engineering habits can amplify any of the other three. As a result, a combination of “high capability tier + high cache hit rate + low ineffective retry rate” can push the effective unit price into a very low range. Conversely, a cheap model that is called repeatedly without restraint can end up costing more in total.
The conclusion is not that “more expensive is better value” or “cheaper is always a loss.” It is this: do not make decisions based on unit price; make decisions based on the cost per unit of effective output. This can be defined as:
Cost per unit of effective output = period cost ÷ number of accepted output units (e.g., merged code snippets, passing test cases)
5. An actionable cost-optimization checklist
- Trim the context: feed only the files and fragments relevant to the task, and retrieve context rather than stuffing in the entire repository.
- Improve cache reuse: place stable system prompts, specification notes, and API contracts in a reusable prefix position to raise prefix-cache hit rates.
- Layer your routing: send simple tasks to a lighter tier and escalate complex reasoning to a higher capability tier, instead of using the highest configuration for everything.
- Constrain retries: set a maximum retry count and timeout for parse failures to prevent runaway loops.
- Build observability first: use log services and monitoring alerts to record tokens, cache hits, and retry counts per session, forming a cost dashboard.
- Add budget guardrails: enforce quotas and rate limits on the client side so abnormal usage is blocked before it reaches the bill.
6. Conclusion
Converting a subscription allowance into an equivalent usage-based unit price is a low-cost, high-value engineering habit. It shows that when a high-capability model is used in an engineered, cache-friendly way, the effective unit price can drop to the range of a few tenths of a yuan per million tokens. That is not a recommendation for any specific plan; it is a reminder to pay attention to measurement definitions, usage structure, and ineffective overhead.
A mature view of cost is built on top of the general-purpose capabilities offered by platforms such as Baidu AI Cloud (for example, log services, monitoring and alerting, and container platforms), combined with your own usage definitions and optimization loop, so that every unit of budget maps to verifiable effective output.
