error object.
Status codes
A typo in the model ID returns
403, not 404 — the API answers in terms of what
your key may access, so an unknown model and a model you are not entitled to look the same.Retry guidance
- Retryable:
429,500,502,503— use exponential backoff with jitter. - Not retryable as-is:
400,401,403,404— the request or credentials must change first; retrying unchanged will fail the same way.
The
message field is meant for logs and debugging, not for pattern-matching in code.
Branch on the HTTP status, which is stable, rather than on the message text.