error object describing what went wrong.
Status codes
| Status | Meaning | What to do |
|---|---|---|
200 OK | Success | Nothing to do. |
400 Bad Request | Malformed request, or a model id that doesn’t exist in the catalog | Check your JSON body and that model is a valid catalog id. |
401 Unauthorized | Missing, malformed, or unknown API key | Verify the Authorization: Bearer sk-bf-... header. |
402 Payment Required | Out of credits | Top up your balance. |
403 Forbidden | Key revoked, or not allowed to use the requested model | Use an active key and a model your account can access. |
429 Too Many Requests | Rate limit exceeded | Back off and retry with exponential backoff. |
5xx | Temporary server error | Retry with backoff. |
A real model your key isn’t permitted to use returns
403. A model id that
doesn’t exist in the catalog returns 400, not 403 or 404.Handling errors in code
Retry transient failures (429 and 5xx) with exponential backoff, and surface the others to the user: