API Error Guide
Running into errors? This guide explains what each error means, when it happens, and exactly how to fix it.
| Code | Meaning | Quick Fix |
|---|---|---|
| 400 | Invalid request format | Check your request body |
| 401 | Authentication failed | Check your API key |
| 402 | Out of credits / budget | Deposit USDC or raise budget |
| 429 | Too many requests | Wait a few seconds, then retry |
| 502 | Provider auth failed | Auto-retried; contact support if repeated |
| 503 | No providers available | Retry in a few seconds |
| 504 | Provider timed out | Retry your request |
| 529 | Upstream overloaded | Wait 5–10s, then retry |
Can't Connect
You'll see these when there's a problem with your API key or login session.
Out of Credits
You'll see these when your account or a specific key runs out of funds.
Too Many Requests
You'll see these when you're sending requests faster than your key's limits allow.
Invalid Request
You'll see these when there's something wrong with how the request is formatted.
Other request errors (prompt too long, invalid tool format, etc.) are passed through from the upstream API with the original message.
No Providers Available
These are temporary — DeRouter can't find a provider to handle your request right now, but one should become available shortly.
Upstream Issues
These come from the AI provider (Anthropic or OpenAI) after DeRouter has already tried multiple providers automatically.
Reading Error Responses
DeRouter returns errors in the same format as the AI provider you're calling, so your existing error handling code works without changes.
Every response includes a request-id header (e.g. req_a1b2c3...). Share this ID with us so we can trace exactly what happened with your request.
Still stuck? We're happy to help.