Reference

Error codes

Errors come in the shape of the chosen surface (OpenAI or Anthropic).

Code reference

HTTPerror.typeMeaning
400invalid_request_errorBad JSON, missing field, or malformed tools[]
401authentication_errorMissing or wrong key
402insufficient_creditsBalance below estimated cost
403model_not_foundModel not enabled or not allowed for the key
429rate_limit_errorPer-minute rate limit exceeded
502api_errorUpstream 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.

Telegram