Why Large Language Model APIs Return 429 Errors: Causes, Retry Strategies, and Rate-Limit Governance
A 429 response from an LLM API usually indicates active rate limiting rather than a service failure. This article explains how capacity limits, RPM/TPM quotas, burst traffic, and oversized contexts trigger 429 errors, why basic retry logic often fails, and how to improve reliability with exponential backoff, jitter, concurrency control, request queueing, context management, fallback routing, and observability.
1. The Failure Pattern: A Retry Chain That Goes Nowhere
A typical failure occurs when an AI coding tool or business service calls a cloud-based LLM API and receives the same response three times in a row:
⚠️ API call failed (attempt 1/3): RateLimitError [HTTP 429]📝 Error: The model is currently experiencing high traffic. Please try again later.📋 Details: {'code': '1305', 'message': 'The model is currently experiencing high traffic. Please try again later.'}⏱️ Elapsed: 0.37s Context: 64 msgs, ~43,303 tokens⏱️ Rate limited. Waiting 2.2s (attempt 2/3)...⏱️ Rate limited. Waiting 4.8s (attempt 3/3)...❌ Rate limited after 3 retries
Three details are important:
- The response is HTTP 429, or Too Many Requests, rather than a 5xx error. This indicates that the service is actively rejecting the request instead of experiencing an internal failure.
- Business error code
1305represents a platform-side quota or capacity issue. - The three attempts complete after 0.37 seconds, 3.19 seconds, and 8.57 seconds. The backoff interval increases, but the context remains around 43,000 tokens.
This tells us two things: the request does not have a syntax or authentication problem, and although a retry strategy exists, it is not sufficient to outlast the rate-limit window.
2. Why 429 Errors Happen: Capacity, Quotas, and Amplification
1. Capacity-based rate limiting
Inference services are resource-intensive. GPU memory and batching slots are limited. When the number of concurrent requests exceeds the batch size an instance can handle, the scheduler may reject new requests to protect the latency of requests already in the queue.
This type of rate limiting is dynamic and can change with traffic at the minute level.
2. Quota-based rate limiting
Platforms commonly enforce both requests-per-minute (RPM) and tokens-per-minute (TPM) limits at the API key, account, or subscription level. These limits work together.
An application may make relatively few requests but still hit the TPM limit if every request contains a large context.
3. Burst traffic
Token-bucket systems usually allow short-term bursts. Once the available burst capacity is exhausted, requests begin to fail.
Batch jobs and scheduled tasks that start at the same minute are a common source of self-inflicted traffic spikes.
4. Context amplification
Multi-turn conversations often resend the entire message history. In the example above, 64 messages account for approximately 43,000 tokens, multiplying the cost of a single request.
Under the same RPM limit, an application with long contexts can consume dozens of times more TPM than an application sending short requests, making rate limiting much more likely.
5. Traffic concentration around popular models
When a model becomes popular because of its output quality, traffic can quickly concentrate on a single model endpoint. The probability of capacity-based rate limiting then increases significantly.
This is a common industry pattern and is not specific to any particular provider.
3. Why Basic Retry Logic Often Fails
Fixed-interval retries, unlimited retries, and retries without jitter are three common anti-patterns.
- Without jitter, retries become synchronized. If many clients are rejected at the same time and all wait two seconds, they will send requests again simultaneously. This creates a retry storm that can turn a temporary limit into sustained throttling.
- Ignoring
Retry-Afterwastes time. If the server provides a recommended wait duration in the response headers, guessing the delay on the client side may result in either premature retries or unnecessarily long waits. - Retries amplify token consumption. Every retry resends the full context. Three attempts can therefore consume three times the tokens, making congestion worse when TPM is the limiting factor.
- Retrying non-retryable errors is ineffective. A 429 response may be retried, but retrying errors such as 400, 401, or 403 generally has no value and only wastes resources.
4. Client-Side Governance: Backoff, Jitter, and Concurrency Shaping
1. Exponential backoff with random jitter
Increase the base delay exponentially and add a random factor to distribute retries over time.
import random, timedef call_with_backoff(fn, max_attempts=5, base=0.5, cap=20.0):for attempt in range(max_attempts):try:return fn()except RateLimitError as e:if attempt == max_attempts - 1:raise# Prefer the server-provided recommendationhint = e.headers.get("Retry-After")delay = float(hint) if hint else min(cap, base * (2 ** attempt))time.sleep(delay * (0.5 + random.random())) # Jitter
2. Concurrency gates and token buckets
Maintain a global semaphore on the client side and limit concurrency to approximately 70%–80% of the available quota, leaving room for bursts.
Then use token buckets to shape traffic across both dimensions: RPM and TPM. This reduces 429 responses at the source.
3. Queue requests and smooth traffic peaks
Send non-real-time tasks to a message queue and process them with consumers running at a controlled rate.
Scheduled jobs should also use a randomized initial delay so that multiple jobs do not start at exactly the same time.
4. Manage context size
Use a sliding window for conversation history, summarize older messages, or retrieve only relevant content. The goal is to reduce each request to the minimum context it needs.
Context reduction is often the most cost-effective way to increase effective throughput.
5. Use fallback models and endpoints
When the primary model is rate-limited, route requests according to a predefined priority order to a smaller model or an alternative endpoint.
The application should clearly inform users when a fallback is being used rather than failing without explanation.
6. Make operations idempotent and resumable
For long-running tasks, persist intermediate results by step. If a retry is required, resume from the latest checkpoint instead of replaying the entire workflow.
5. Platform Controls and Observability
Service providers commonly offer general capabilities such as quota tiers, priority queues, and elastic scaling. Consumers should build monitoring and alerting before rate limits become a production incident.
Track metrics including:
- 429 response rate
- RPM and TPM utilization
- P95 latency
- Retry count
Connect these metrics to logging and monitoring systems. Trigger scaling or traffic reduction before usage reaches the limit.
General cloud capabilities such as logging, monitoring and alerting, message queues, and container platforms can support this workflow without relying on provider-specific interfaces.
For capacity planning, estimate quota requirements using:
Peak RPM × Average Tokens per Request × Safety Factor
Maintain approximately 30% headroom to absorb unexpected traffic spikes.
6. Implementation Checklist
- Distinguish 429 errors from 5xx errors, and apply backoff only to retryable failures.
- Add jitter to backoff and honor
Retry-Afterwhenever it is provided. - Use a client-side concurrency gate and two-dimensional RPM/TPM token buckets.
- Reduce context size and control tokens per request.
- Queue non-real-time tasks and spread out scheduled jobs.
- Alert on both the 429 rate and quota utilization.
- Prepare fallback models and checkpoint-based resumption.
Rate limiting is not necessarily a service failure. It is normal feedback from a system operating with shared capacity.
The key to reliable LLM API usage is to replace blind retries with traffic governance that is observable, controlled, and capable of graceful degradation.
