LLM Quota Conversion Guide: From Monetary Limits to Token Capacity
This guide explains how to convert LLM API monetary limits into actual token capacity. It covers the three-tier quota system—monthly nominal, weekly cap, and rolling window limits—provides formulas for calculating single request costs, and offers a Python script for capacity estimation. Learn how to avoid common quota pitfalls and implement engineering best practices to ensure stable service during traffic peaks.
1. Why Nominal Quota Does Not Equal Available Quota
Large language model (LLM) interfaces that bill based on quotas typically advertise a monthly monetary amount. However, the actual amount you can use depends on the combined result of multiple layers of limits. Nominal amount, periodic cap, and rolling window caps take effect simultaneously, and any layer can become the bottleneck first. Looking only at the nominal number often leads to overestimating available capacity, resulting in rejected requests during peak business hours.
This article uses a generic quota model to demonstrate the conversion process. The unit prices and quotas mentioned are hypothetical parameters and do not correspond to any specific service. By replacing them with the real numbers from your own platform, you can apply the same methodology.
2. What the Three Tiers Manage
Quotas generally consist of three tiers:
- Period Nominal Quota: The total budget for the account within a billing cycle, such as a specific amount provided per month. It determines the total volume.
- Weekly Cap: Limits the maximum consumption within a single natural week, used to smooth out the consumption pace throughout the month. It determines the maximum usable amount within a week.
- Window Cap: Limits the maximum consumption within any consecutive 5-hour window, used to control instantaneous bursts. It determines peak carrying capacity.
The calibers of these three limits are different and cannot be directly added or substituted for one another. During a given time period, the available amount equals the minimum value allowed across all tiers. Assuming a monthly quota of 1000 units, a weekly cap of 50% of the monthly quota, and a 5-hour window cap of 20% of the monthly quota, the limits are as follows:
- A maximum consumption of 1000 units for the entire billing cycle;
- A maximum consumption of 500 units in any single natural week;
- A maximum consumption of 200 units in any consecutive 5-hour window.
Even if the monthly quota is sufficient, as long as requests are concentrated in a specific time slot, the window cap will be triggered first.
3. From Unit Price to Token Capacity
3.1 Single Request Cost
LLM interfaces typically divide input into standard input and cache hit components, while output is priced separately. The formula for calculating the cost of a single request is as follows:
Single Cost = (New Input Tokens × Standard Input Price + Cached Input Tokens × Cache Price + Output Tokens × Output Price) ÷ 1,000,000
The unit for prices is “units/million tokens”.
3.2 An Example
Assume a request contains 1,000 new input tokens, 40,000 cached input tokens, and 200 output tokens. The three price rates are 2.0, 0.2, and 8.0 units/million tokens, respectively.
- Standard input cost: 1,000 × 2.0 ÷ 1,000,000 = 0.002 units
- Cached input cost: 40,000 × 0.2 ÷ 1,000,000 = 0.008 units
- Output cost: 200 × 8.0 ÷ 1,000,000 = 0.0016 units
- Total per request: 0.0116 units
This request consumes a total of 41,200 tokens. When converting, the caliber must be consistent with the billing statement. If the quota is measured by total tokens, cached input tokens must also be included. If it is measured only by billable tokens, a separate conversion based on billing rules is required.
3.3 Capacity Across Tiers
Using the single request cost of 0.0116 units, the capacities corresponding to the three-tier limits are shown in the table below:
| Quota Tier | Monetary Cap (units) | Caliber | Approx. Processable Requests | Approx. Token Volume |
|---|---|---|---|---|
| Monthly nominal quota | 1000 | Total for the entire billing period | 86,200 | 3.55 billion |
| Weekly cap | 500 | Max processing in a single natural week | 43,100 | 1.78 billion |
| 5-hour window | 200 | Max processing in any consecutive 5 hours | 17,200 | 710 million |
The numbers corresponding to the weekly cap and window cap in the table are not monthly totals. The 710 million tokens for the 5-hour window only represents the processing limit within those 5 hours and cannot be treated as the total monthly available volume.
Converted per unit of currency, every 1 unit can process approximately 86 requests, or about 3.55 million tokens. This ratio depends on the request structure. For requests with long contexts and high cache hit rates, the token volume per unit of currency will be significantly higher.
4. Time Dimension: How Windows Change Availability
The window cap determines how the quota is released over time. Taking a weekly cap of 500 units and a window cap of 200 units as an example, this can be understood in terms of rate.
The 200-unit window cap corresponds to an average rate of 200 ÷ 5 = 40 units/hour. This means that regardless of how requests are distributed, the long-term hourly consumption cannot exceed approximately 40 units. If the 500-unit weekly cap is consumed continuously at this rate, it will take at least 500 ÷ 40 = 12.5 hours.
This has two practical implications:
- If requests are concentrated at the beginning of the week, the weekly cap will be exhausted in about half a day. After that, until the end of the week, even if the monthly quota still has a balance, the available amount for the current week is zero.
- If calls are distributed evenly throughout the week, the average rate is 500 ÷ 168 ≈ 2.98 units/hour, and the consumption for each 5-hour window is about 14.9 units, well below the 200-unit window cap.
Because a rolling window requires that any consecutive 5 hours satisfy the limit, segmented calculations are only approximations. When planning, use the rate model for estimation and validate with real logs.
Capacity planning cannot rely solely on total volume; the time distribution must also be considered. The monthly quota determines the total volume, the weekly cap determines the maximum weekly processing volume, and the window cap determines the peak carrying capacity. All three are indispensable.
5. Estimating with Code
The script below encapsulates the conversion process into functions. By replacing it with real unit prices and request profiles, you can obtain capacity estimates for your own business.
from dataclasses import dataclass@dataclassclass Pricing:input_per_m: float # Standard input price, units/million tokenscached_per_m: float # Cache hit price, units/million tokensoutput_per_m: float # Output price, units/million tokens@dataclassclass RequestProfile:new_input: int # New input tokens per requestcached_input: int # Cached input tokens per requestoutput: int # Output tokens per requestdef cost_per_request(p: Pricing, r: RequestProfile) -> float:"""Calculate the monetary cost of a single request (units)."""cost = (r.new_input * p.input_per_m+ r.cached_input * p.cached_per_m+ r.output * p.output_per_m) / 1_000_000if cost <= 0:raise ValueError("Cost per request must be greater than 0, check pricing and request profile")return costdef capacity(budget: float, p: Pricing, r: RequestProfile) -> tuple[int, int]:"""Given a budget, return the number of processable requests and total tokens."""unit = cost_per_request(p, r)requests = int(budget // unit)tokens = requests * (r.new_input + r.cached_input + r.output)return requests, tokensdef window_plan(weekly_cap: float, window_cap: float,window_hours: float = 5, week_hours: float = 168) -> dict:"""Calculate the rate limit for the window cap and weekly consumption pace."""rate_cap = window_cap / window_hours # units/houravg_rate = weekly_cap / week_hours # units/hour, uniform weekly consumptionreturn {"Rate limit (units/hour)": rate_cap,"Consumption per window if uniform (units)": avg_rate * window_hours,"Hours to exhaust weekly cap at rate limit": weekly_cap / rate_cap,}if __name__ == "__main__":pricing = Pricing(input_per_m=2.0, cached_per_m=0.2, output_per_m=8.0)profile = RequestProfile(new_input=1000, cached_input=40000, output=200)monthly_budget = 1000.0limits = {"Monthly nominal quota": monthly_budget,"Weekly cap": monthly_budget * 0.5,"5-hour window": monthly_budget * 0.2,}for name, budget in limits.items():reqs, toks = capacity(budget, pricing, profile)print(f"{name}: ~{reqs:,} requests, ~{toks / 1e8:.2f} billion tokens")plan = window_plan(weekly_cap=500.0, window_cap=200.0)for key, value in plan.items():print(f"{key}: {value:.2f}")
When run, the first three output lines will roughly match the table in Section 3. The last three lines output a rate limit of 40.00 units/hour, a uniform consumption of 14.88 units per window, and 12.50 hours required to exhaust the weekly cap at the rate limit.
The single request profile in the script is only suitable for demonstration. In a real business environment, request lengths vary greatly. The single profile should be replaced with a list of requests extracted from logs. Calculating costs based on P50 and P90 percentiles, and then aggregating them by week and 5-hour windows, will yield results much closer to reality.
6. Common Pitfalls
- Treating nominal quota as available quota. The nominal quota does not account for weekly and window caps; the actual available volume is usually lower.
- Ignoring the window cap. The window limit determines peak carrying capacity. Passing the average usage test does not mean the service will function normally during peak hours.
- Overlooking cache pricing differences. In long-context scenarios, the proportion of cache hits is very high. The gap between the cache price and the standard input price will determine the total cost structure. Ignoring this can lead to significant estimation deviations.
- Estimating using average requests. The cost of long and short requests can differ by tens of times. Estimations should be based on real logs to determine the distribution of input and output lengths, using percentiles like P50 and P90.
- Ignoring billing caliber. You must confirm whether the input includes the cached portion, whether the output uses the same metering rules as the input, and whether the billing cycle is a natural week or a rolling week.
7. Engineering Best Practices
- Telemetry: Record the new input, cache hit, and output token counts for each request. Aggregate them by hour, day, and week, and reconcile regularly with the billing statement.
- Pre-Request Budget Guard: Estimate the cost before sending a request. If approaching the window cap, enter a queue or switch to a smaller model instead of failing outright.
- Client-Side Throttling: Use algorithms like token buckets to smooth out requests and prevent batch tasks from firing in short bursts.
- Tiered Alerts: Send notifications when the weekly and window quotas reach 70% and 90%, giving operations and business teams time to adjust.
- Backoff and Retry: Use exponential backoff when receiving rate-limiting responses, and log each throttling event as a basis for future capacity adjustments.
- Cost Attribution: Break down usage by business line and functional module to identify the most resource-intensive segments, then decide whether to optimize prompts, compress context, or adjust call frequency.
8. Summary
There are three key points to quota estimation. First, unify the conversion caliber so the relationship between monetary amounts, tokens, and request counts is consistent with the bill. Second, take the tightest limit among all restrictions, considering the periodic total, weekly cap, and rolling window simultaneously. Third, replace averages with real request distributions and smooth calls across the time dimension. By building an estimation model based on these three steps and regularly calibrating it with bills and real logs, service interruptions caused by quota exhaustion can be identified and avoided in advance.
