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