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
OpenAI
- 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