AI API error codes, decoded and fixed
Every commercial AI API throws errors — and most surface as a terse HTTP status with a
cryptic message. When your production app starts returning 429,
401, or a context-length error, you need the cause and the fix, not a
forum thread from two model generations ago.
These pages cover the errors developers actually hit against OpenAI, Anthropic, Google Gemini, Mistral, and DeepSeek. Each one explains what the error means in plain language, lists the specific causes (with the conditions that trigger them), and gives working Python, JavaScript, and cURL fixes you can paste straight into your codebase. We also cover prevention, because the cheapest error is the one that never fires. Numbers like rate-limit ceilings and pricing are stamped with the date we verified them — always confirm against the provider's official docs before you ship, since these change often.
Anthropic
- 429 high
Anthropic Claude 429 Rate Limit Error: Causes and Fixes
Fix Anthropic Claude 429 rate_limit_error: read the anthropic-ratelimit headers, add backoff in Python/JS, throttle, tier up, and tell it apart from a 529.
Updated June 18, 2026 - context window medium
Anthropic 'prompt is too long' Error: Fix the Context Window Limit
Fix Anthropic Claude's 'prompt is too long' / context window error: why input plus max_tokens overflows, and how to count, trim, summarize, or chunk. With code.
Updated June 18, 2026 - 529 medium
Anthropic Error 529: Overloaded — Causes and Fixes
Fix Anthropic Claude 529 Overloaded errors: what it means vs a 429, how to back off with jitter, and add provider failover. Python and JS code.
Updated May 28, 2026
DeepSeek
- 429 medium
DeepSeek 429 / Rate Limit Errors: Causes and Fixes
Fix DeepSeek 429 and slow-response throttling: why there's no fixed rate limit, how dynamic throttling works under load, backoff code, and timeout tuning.
Updated June 18, 2026 - insufficient_balance high
DeepSeek 'Insufficient Balance' Error: Causes and How to Fix It
Fix DeepSeek's Insufficient Balance error (402): why it's a prepaid-billing stop not a rate limit, how to top up, monitor balance, and stop retrying. With code.
Updated June 18, 2026
Google Gemini
OpenAI
- context_length_exceeded medium
OpenAI context_length_exceeded: Fix the Maximum Context Length Error
Fix OpenAI's context_length_exceeded: why tokens overflow the context window, and how to count, trim, summarize, or chunk input. Python and JS code included.
Updated June 18, 2026 - insufficient_quota high
OpenAI insufficient_quota Error: Causes and How to Fix It
Fix OpenAI's insufficient_quota 429: why it's a billing problem (not rate limiting), how to add credits, raise budget caps, and stop retrying. With code.
Updated June 18, 2026 - model_not_found medium
OpenAI 'model does not exist' Error (model_not_found): Causes & Fix
Fix OpenAI's 404 model_not_found error: wrong model name, no access, wrong endpoint, or org verification. How to list available models and resolve it.
Updated June 18, 2026 - 429 high
OpenAI Error 429: Rate Limit Exceeded — Causes and Fixes
Fix OpenAI 429 rate limit errors fast: causes, exponential backoff in Python/JS/cURL, throttling, tier upgrades, and prevention. Working code, no fluff.
Updated June 6, 2026 - 401 high
OpenAI Error 401: Invalid Authentication — Causes and Fixes
Fix OpenAI 401 invalid authentication errors: bad or revoked API keys, wrong org/project headers, and env-var mistakes. Working checks in Python, JS, and cURL.
Updated May 20, 2026