Reference
Error codes
Errors come in the shape of the chosen surface (OpenAI or Anthropic).
Code reference
| HTTP | error.type | Meaning |
|---|---|---|
| 400 | invalid_request_error | Bad JSON, missing field, or malformed tools[] |
| 401 | authentication_error | Missing or wrong key |
| 402 | insufficient_credits | Balance below estimated cost |
| 403 | model_not_found | Model not enabled or not allowed for the key |
| 429 | rate_limit_error | Per-minute rate limit exceeded |
| 502 | api_error | Upstream failed — retryable |
Retry strategy
Retryable: 429 and 502 — use exponential backoff with jitter, cap at 3 retries. Other codes indicate a problem with the request itself: retrying yields the same error, fix the cause first.