What to Do When Your LLM Token Quota Runs Out: A Usage Governance Guide
This guide explains what happens when an LLM API token quota runs out and why borrowing credentials is risky. It covers how tokens are counted, the three dimensions of rate limits and quotas, monitoring and alert thresholds, cost-reduction and degradation strategies, and practices for quota requests, reviews, and pre-launch checks.
1. The Cost of Running Out of Quota
LLM APIs charge by token and also limit usage by token. When the quota is exhausted, the API returns rejection or rate-limit errors. Batch jobs in progress may stop midway, and online features degrade accordingly.
Many teams’ first reaction is to top up the quota temporarily or borrow someone else’s credentials. This restores service quickly, but over time it creates three types of risk.
Business risk: A task is only half processed. Rerunning it consumes quota that has already been used, which creates a vicious cycle.
Security risk: Shared credentials cannot identify the caller, so auditing breaks down. If the credentials leak, accountability is hard to trace.
Cost risk: Without itemized usage data, you cannot tell which business is spending the budget. Budgets can only be estimated after the fact.
A better approach is to manage quota as infrastructure. Give each service its own sub-account, assign the models and quota it can call under least privilege, rotate keys regularly, and keep complete call logs. When a temporary quota increase is needed, go through an approval process rather than borrowing someone else’s key.
2. How Tokens Are Measured
A token is the smallest unit a model uses to split text. A token may be a word, part of a word, a Chinese character, or a punctuation mark. Different models use different tokenization rules (tokenizers), so the same text can produce noticeably different token counts across two models. Usage from different models therefore cannot be converted directly into one another.
Billing usually has two parts:
- Input tokens: system instructions, user prompts, conversation history, retrieved reference material, and function definitions (schemas) for tool calls.
- Output tokens: the content the model generates in its response.
Track input and output separately. Many people only watch output, but in multi-turn conversations and retrieval-augmented generation (RAG), input often accounts for most of the usage. Each turn places the conversation history back into the context, so input tokens grow with the number of turns, and the cost per turn rises too.
When no exact measurement tool is available, a rough estimate based on rules of thumb can help. The function below estimates tokens from character counts. It is only for budget warnings and must not be used for billing or settlement:
def estimate_tokens(text: str) -> int:"""Roughly estimate the token count. For budget warnings only, not for billing.Basis: CJK characters are estimated at about 1.5 tokens each, and othercharacters at about 0.3 tokens each. Punctuation, spaces, URLs, code, andemoji can have large errors. English is not estimated by word count."""cjk = sum(1 for ch in text if '\u4e00' <= ch <= '\u9fff')other = len(text) - cjkreturn int(cjk * 1.5 + other * 0.3)
Example: A request with system instructions, a user question, and conversation history totaling about 1,150 Chinese characters yields an estimate of about 1,725 tokens. This is only a warning value. Actual usage is based on the usage field returned by the server, and input and output values should be recorded separately.
3. Three Dimensions of Quotas and Rate Limits
Servers typically constrain calls along three dimensions. The exact names and limits are defined in each provider’s console.
| Dimension | Meaning | Typical problem | Response | Monitoring metrics | Responsible role |
|---|---|---|---|---|---|
| Request rate (RPM) | Number of requests allowed per minute | Batch jobs hit the limit at once and receive 429 errors | Retry with exponential backoff and random jitter on the client; queue and rate-limit tasks | Requests per minute, share of 429 responses | Platform engineering |
| Concurrency | Number of requests in progress at the same time | Long-output requests occupy all slots, and short online requests queue | Set a concurrency cap; run long tasks and online tasks in separate pools | Peak concurrency, queue wait time | Platform engineering |
| Token quota (TPM, daily quota, monthly quota) | Total tokens that can be consumed per minute, per day, or per month | Once the quota runs out, all requests are rejected | Itemized budgets, tiered alerts, fallback degradation | Share of daily consumption, remaining quota | Business owners, finance |
4. Usage Monitoring and Alerts
Monitoring should cover at least four types of data: input and output tokens split by service, model, and environment (production and testing); request success rate and error code distribution; cache hit rate; and the number of degradation triggers.
The following thresholds are examples. Adjust them to your team’s actual quotas.
- Daily quota consumption exceeds 70%: Notify the business owner.
- Daily quota consumption exceeds 90%: Pause non-core tasks and keep only online services running.
- Consumption in a single hour is 50% higher than the same hour last week: Check for retry loops or unusually long prompts.
- The share of 429 errors stays above 2% for 5 consecutive minutes: Trigger a rate-limit check.
Alert messages must include the service name and the responsible person. A notification without a named owner is of little use.
5. Cost Reduction and Degradation Measures
5.1 Prompt Trimming
- Remove duplicate system instructions, and merge the rules into one paragraph.
- Keep only the most recent few turns of conversation history and any necessary summary, instead of replaying the full history.
- Trim retrieved material by relevance, and set a maximum token count.
- Use
max_tokensto limit output length, and ask for concise answers in the prompt.
After trimming, run regression tests on the same sample set to confirm that output quality has not declined.
5.2 Result Caching
For scenarios where the same input reliably produces the same result, such as classification and summarization with fixed templates, responses can be cached. The cache key consists of the model name, model version, normalized prompt, and request parameters. Caches must have a time-to-live (TTL), and they must be invalidated immediately when the model or prompt changes. Content involving personal data should not be written to a shared cache. If caching is unavoidable, encrypt the cache and apply access control.
5.3 Model Tiering
Choose models according to task difficulty. Use smaller models for simple tasks such as classification, extraction, and format conversion. Use larger models for complex reasoning and important outputs. Before setting routing rules, compare the accuracy of each model on labeled samples.
5.4 Degradation Fallback
Degradation is divided into four tiers based on quota consumption. The thresholds are example values.
| Tier | Trigger condition | Action |
|---|---|---|
| Normal | Quota consumption below 70% | All features enabled; usage recorded normally |
| Warning | Quota consumption 70% to 90% | Notify the owner, check for abnormal calls, and force cacheable requests to use the cache |
| Throttled | Quota consumption 90% to 100% | Pause offline batch jobs; switch online services to a smaller model |
| Exhausted | Quota used up or all requests rejected | Switch online features to rule-based logic or historical results, show a clear message to users, and stop automatic retries |
Degradation switches should be toggled with one action. Run drills regularly to confirm that features still work after switching.
6. Quota Requests and Reviews
6.1 Request Template
When requesting a temporary or long-term quota, fill in the following fields:
- Business scenario and purpose
- Owner and backup contact
- Estimated daily token usage, with input and output listed separately
- Peak requests per minute and peak concurrency
- Model selection and rationale
- Degradation strategy and alert thresholds
- Requested duration and review cycle
After approval, quota is issued per sub-account and is automatically reclaimed when it expires.
6.2 Review Metrics
Review quota usage weekly or monthly, focusing on these metrics:
- Deviation between actual and estimated usage. Deviations above 20% require an explanation.
- Request failure rate and main error codes.
- Cache hit rate.
- Number and duration of degradation triggers.
- Token cost per unit of business output, such as tokens consumed per support ticket processed.
Review conclusions should lead to concrete actions: adjust quotas, optimize prompts, change model routing, or turn off ineffective features.
7. Pre-Launch Checklist
- Measurement definitions are unified, input and output are recorded separately, and server-side
usagedata is the source of truth - Each service uses its own sub-account, with no shared keys
- RPM, concurrency, daily quota, and monthly quota are all set
- Alert thresholds are configured, with a named owner
- Cache TTLs are set, and caches are invalidated when the model or prompt changes
- Degradation switches can be toggled with one action, and a drill has been completed
- There is a clear approval path for temporary quota increases
- The review cycle and metrics are defined
