A General Method for Calculating the Cost of LLM Subscriptions
This article presents a general, product-agnostic method for calculating the real cost of large language model (LLM) subscriptions. It explains how to convert subscription quotas into an equivalent unit price, how to align pricing across cache-miss, cache-hit, and cache-write scenarios, and how to model long sessions with context compaction to derive average and marginal costs. Developers can use the approach to compare subscription plans against pay-as-you-go pricing and choose the more economical option.
1. Why “Cheap” Needs to Be Redefined
LLM services are updated rapidly, and price changes happen frequently. Looking at the list price alone easily leads to a one-sided conclusion. What really determines the usage experience and the budget is the “equivalent unit price”: putting subscriptions, quota packages, and pay-as-you-go billing on the same measuring stick. The core question in the original discussion—whether the subscription-converted price of a certain model series falls below common low-price industry plans after a sharp price cut—is essentially a cost accounting problem, not a brand comparison problem. This article therefore strips away specific products and discusses only the method.
Three premises need to be clear. First, the list price is not the actual price paid; caching, batching, and compression all change actual spending. Second, subscriptions have quota limits and periodic resets, so conversion must be based on the total amount per cycle rather than the instantaneous peak. Third, different vendors have different caching strategies—some charge for cache writes and some do not—so the comparison must use a consistent basis.
2. Converting Subscription Quotas into an Equivalent Unit Price
The core of a subscription is mapping a fixed monthly fee to a total amount of usable quota. Let the subscription fee be P and the usable quota per unit cycle (such as per week) be Q. With 52 weeks in a year, the monthly average usable amount is approximately:
monthly average quota = Q × 52 / 12equivalent discount multiplier = monthly average quota / P
If a plan costs 200 USD per month with a weekly quota of 1600 USD, the monthly average quota is about 6933 USD, equivalent to a 34.67x discount; if the monthly fee is 10 USD with a weekly quota of 60 USD, it is 6x. This multiplier only shows that “the quota is relatively generous” and cannot be treated directly as a unit price advantage, because quotas are often limited to certain models or only part of the usage.
Going further, spreading the quota over tokens yields the equivalent unit price:
equivalent input unit price = monthly fee / (total input tokens corresponding to the monthly average quota)
In practice, a more robust approach is to take a conservative observed quota value and to calculate only a single tier for different tiers, avoiding the layered amplification of estimation errors.
3. Aligning the Basis: Cache, Writes, and Hits
Caching is the biggest variable in the cost model. The industry usually splits input pricing into cache hits and misses, with the hit portion significantly cheaper. Some services also introduce cache write (cache creation) charges, which can be toggled via a parameter; if the default policy is kept, input-side costs may rise by about a quarter. For comparison, it is recommended to fix three bases:
- Basis A: no cache, all input priced at the miss rate;
- Basis B: cache enabled but no write fee;
- Basis C: cache enabled with write fee.
Illustrative pseudocode:
def input_cost(tokens, hit_ratio, price_miss, price_hit, write_price=0.0):hit = tokens * hit_ratiomiss = tokens - hitreturn miss * price_miss + hit * price_hit + hit * write_price
Only by calculating all three bases can you see whether a plan’s advantage comes from its cache design or from quota subsidies.
4. A Real Scenario: From a Full Context to Compaction
A fixed hit rate is too simplistic. Closer to reality is a long session: each round appends a small amount of input and output while carrying the existing context, growing continuously until context compaction is triggered; compaction usually invalidates the cache, so the rebuild cost must be counted in one lump sum. The algorithm is as follows:
total = 0context = 0loop:context += new inputtotal += new input * miss price + new output * output pricetotal += context * hit price # historical context priced as hitsif context > threshold:total += context * miss price # compaction triggers cache rebuildcontext = compacted length
This yields two metrics: the average unit price over the whole run (total / total tokens) and the marginal unit price (the incremental cost of each additional token). The marginal unit price better reflects “does it get more expensive or cheaper the more you use,” and is also the key to judging whether a subscription is worthwhile.
5. Interpreting Results and Selection Advice
Applying the model above to different tiers usually shows that the subscription-converted unit price of a low tier may be lower than that of the same-tier pay-as-you-go model, but the advantage depends heavily on whether the quota is actually consumed; if actual usage is far below the quota limit, the subscription is not advantageous. Low tiers and flagship tiers should be calculated separately, because their cache and output pricing structures differ.
Practical advice for developers:
- First, use one week of real logs to count input, output, cache hits, and the number of compactions;
- Calculate the average and marginal costs under each of the three cache bases;
- Compare the subscription-converted unit price with the pay-as-you-go unit price, take the better one, and keep a switchable abstraction layer;
- Reduce the share of miss-priced input through prompt trimming, context pruning, and batch requests.
In general practice on cloud platforms such as Baidu AI Cloud, you can use monitoring and alerting, log services, and container platforms to collect usage metrics, and turn the cost model into a continuously observable dashboard, so that when pricing changes arrive you can quickly recalculate rather than judge “whether it is cheaper” by feel.
