Errors
Claude API error codes and troubleshooting — 401, 429, 500 status codes. How to handle rate limits and authentication errors.
LLMsRelay is an independently operated API gateway. It is not affiliated with or endorsed by Anthropic, PBC. Product and model names are used only to describe compatibility.
401: Invalid or missing sk-cs4-* key. 402: Out of credits — top up to continue. 429: Rate limited — back off using Retry-After. 500/502/504: Transient — retry with exponential backoff.
Anthropic Error Format
Anthropic-style errorjson
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "model: Invalid model ID"
}
}OpenAI Error Format
OpenAI-style errorjson
{
"error": {
"message": "Invalid model ID",
"type": "invalid_request_error",
"code": "invalid_model"
}
}HTTP Status Codes
| Status | Meaning | Action |
|---|---|---|
| 400 | Bad Request — invalid parameters | Check request body and parameters |
| 401 | Unauthorized — invalid or missing API key | Verify your API key |
| 403 | Forbidden — insufficient permissions | Check key permissions and credit balance |
| 429 | Rate Limited — too many requests | Reduce request rate, implement backoff |
| 500 | Internal Server Error | Retry with exponential backoff |
| 502 | Bad Gateway — upstream error | Retry after a brief delay |
| 529 | Overloaded — service at capacity | Retry with exponential backoff |
Debugging Tips
- Always check the
error.typeanderror.messagefields for specific information - For 429 errors, implement exponential backoff starting at 1 second
- For 5xx errors, retry up to 3 times with increasing delays
- Use
GET /healthto check service status - Verify model IDs match exactly (e.g.,
claude-sonnet-4.6)