How to Estimate LLM Token Usage from Revenue
This article explains how to estimate large language model (LLM) token usage by reverse-engineering revenue data. It covers the core estimation formula, step-by-step calculation logic including blended pricing and traffic weighting, a Python script for automation, data source reliability grading, common error sources, and engineering best practices for cost prediction and capacity planning.
1. Background: Why Estimate Token Usage from Revenue?
LLM APIs are billed based on tokens, where both input and output for every API call contribute to the total usage. External observers typically only have access to revenue, list prices, and limited statistics, rarely getting direct access to API call volumes. Therefore, a common approach is to estimate the monthly total token volume using “Revenue ÷ Weighted Average Price.” While simple, each step of this method relies on assumptions, and the reliability of the conclusion depends on whether these assumptions hold true.
This article uses this estimation process as a guideline to explain the calculation logic of each step, potential sources of error, and how engineering teams can reuse this method for cost forecasting or capacity planning.
2. Core Formula
The basic relationship for the estimation is as follows:
Monthly Token Volume ≈ Monthly Revenue ÷ Weighted Average Price
The weighted average price is determined by three factors:
- The unit price of each model tier, with separate pricing for input and output;
- The ratio of input to output tokens;
- The proportion of each tier in the total API call volume.
All three are essential. Any deviation in one of them will cause the final token estimate to shift accordingly.
3. Step 1: Calculate the Blended Price
LLM pricing usually distinguishes between input and output, with the output unit price often being several times that of the input. Since the number of input and output tokens in a single API call are not equal, the two unit prices must first be consolidated into a blended price.
The calculation for the blended price is:
Blended Price = (Input Price × Input Ratio + Output Price × Output Ratio) ÷ (Input Ratio + Output Ratio)
Assume an input-to-output token ratio of 3:1, meaning input accounts for 75% and output for 25%. The prices for the following three tiers are hypothetical values for demonstration and do not correspond to any real product:
| Tier | Input Price (USD/Million Tokens) | Output Price (USD/Million Tokens) | 3:1 Blended Price | Traffic Share |
|---|---|---|---|---|
| High-end | 3 | 15 | 6 | 40% |
| Mid-range | 1 | 5 | 2 | 30% |
| Lightweight | 0.2 | 1 | 0.4 | 30% |
The calculation for the High-end tier is: (3 × 3 + 15 × 1) ÷ 4 = 6.
4. Step 2: Weight by Traffic Structure
The blended price only reflects the pricing of a single tier. To obtain the overall price, a weighted average must be calculated using the traffic share of each tier:
Weighted Average Price = 6 × 40% + 2 × 30% + 0.4 × 30% = 2.4 + 0.6 + 0.12 = 3.12 (USD/Million Tokens)
The sum of the shares must equal 100%, which is the most basic validation check. If the share data comes from a partial sample, such as traffic statistics from a specific platform, the weighted result only represents the structure of that sample and cannot be directly extrapolated to the entire business.
5. Step 3: Conversion and Magnitude Check
Assuming a monthly revenue of $100 million USD:
Monthly Token Volume = 100,000,000 ÷ 3.12 × 1,000,000 ≈ 3.2 × 10^13, or about 32 trillion tokens
After conversion, a magnitude check is necessary. Cross-reference the result with known infrastructure scale, the average token count per request, and the daily average request volume. If the result significantly contradicts other metrics, prioritize investigating the assumptions rather than accepting the conclusion directly.
The input-to-output ratio has a massive impact. If the ratio is changed to 1:1, the blended price for the High-end tier increases from 6 to 9, the weighted average price becomes 4.68 USD/Million Tokens, and the estimated total volume drops to about 21 trillion tokens, a reduction of roughly one-third. Scenarios like long-context and Retrieval-Augmented Generation (RAG) have a high input proportion, while conversational and code generation scenarios might have a higher output proportion. Therefore, the ratio should be selected based on actual business use cases.
The following script encapsulates the above process into a function with external parameters, making it easy to reproduce and perform sensitivity analysis:
def estimate_monthly_tokens(revenue_usd, tiers, input_ratio, output_ratio):# tiers: {tier_name: (input_price, output_price, share)}, price in USD/Million Tokenstotal_ratio = input_ratio + output_ratioshares = sum(share for _, _, share in tiers.values())if abs(shares - 1.0) > 1e-9:raise ValueError("The sum of all tier shares must be 100%")weighted_price = 0.0for in_price, out_price, share in tiers.values():blended = (in_price * input_ratio + out_price * output_ratio) / total_ratioweighted_price += blended * sharemillion_tokens = revenue_usd / weighted_pricereturn million_tokens * 1_000_000tiers = {"High-end": (3, 15, 0.40),"Mid-range": (1, 5, 0.30),"Lightweight": (0.2, 1, 0.30),}print(estimate_monthly_tokens(1e8, tiers, 3, 1)) # Approx. 3.2e13print(estimate_monthly_tokens(1e8, tiers, 1, 1)) # Approx. 2.1e13
6. Data Source Reliability Grading
Within the same estimate, the reliability of each input often varies. It is recommended to grade the source for each input to avoid treating numbers of different precisions as the same precision:
- Level 1: Audited financial reports. The revenue definition is clear and can be used directly for calculation.
- Level 2: Public pricing pages. Prices are reliable but do not include actual transaction conditions like discounts, enterprise contract pricing, and cached billing.
- Level 3: Third-party platform statistics. The data is real but only covers traffic within that specific platform, limiting its representativeness.
- Level 4: Roadshow materials, media reports, or non-audited disclosures. Can be used as a reference but should be explicitly noted; not suitable as a basis for precise conclusions.
Stating conclusions derived from Level 4 data as definitive facts is one of the most common mistakes.
7. Common Error Sources
- Platform share does not equal total business share. If the traffic structure of a platform differs from the overall business, the weighted price will produce a systematic bias.
- List price does not equal actual transaction price. Volume discounts, enterprise contracts, and free credits will lower the actual unit price, causing the token estimate to be higher than reality.
- Revenue includes non-usage-based components. Subscription fees, service fees, and custom development fees do not directly correspond to tokens and should be excluded before calculation.
- Inaccurate input-output ratio assumptions. A deviation in the ratio directly changes the blended price. As shown above, the impact can reach up to one-third.
- Pricing differences between cached and inference tokens. Cached input tokens usually have a different price. Internal tokens generated during the inference process are generally billed as output, meaning the actual billed token count may far exceed the visible text length.
- Time mismatch. When the dates of quarterly revenue and pricing snapshots are inconsistent, the estimate will be skewed by price changes.
- Unclear statistical definitions. “Daily consumption” might refer to token count or request count, and it also needs to be verified whether it covers all users.
8. Engineering Best Practices
- Write the formula as a reproducible script. Store parameters (ratios, shares, prices, sources, and dates) separately so that every calculation is traceable to its inputs.
- Perform range estimation rather than point estimation. Conduct sensitivity analysis on input ratios and shares, output upper and lower bounds, and explain which parameter has the greatest impact on the result.
- Calibrate with internal billing. If the team has access to its own usage and billing data, internal data should be the primary source, with external estimates serving only as a reference.
- State assumptions and error margins for external publication. List the source grade of each input, the ratios used, and uncovered factors, allowing readers to independently judge the credibility of the conclusion.
