- Authentication, plan, and balance errors (
401,402,403) return a JSON body withcodeandmessageat the top level, as shown below. The status says which kind of problem it is; use thecodeto decide what to fix. - Other errors can come from the API gateway, the model server, or an upstream model provider, and their body format varies. Handle them by HTTP status code. For example, an unknown model ID returns
404with{"message": "Model not found", "type": "Not Found", "code": 404}.
Authentication, plan, and balance errors
Requests that fail an authentication, plan, or balance check return one of three statuses, each with acode and a readable message:
401: the credential is missing, invalid, or expired.402: the account or Organization has no credits left.403: the account’s plan doesn’t include inference.
message says what to do next and may change. The code doesn’t change, so branch on code in your client.
The
session_* and account_not_found codes apply to requests from the Model Playground, which uses your dashboard session instead of an API key.
Other status codes
You aren’t charged for requests that return an error.
Retry with backoff
Retry429 and 5xx responses, waiting longer after each attempt. Don’t retry 400, 401, 402, or 403 responses, because the same request fails again until you fix it: the request, the credential, the balance, or the plan.
429 and 5xx responses automatically. Set max_retries (Python) or maxRetries (Node.js) on the client to change how many times.
Next steps
Account management
Create and revoke API keys.
Getting support
Contact the team about persistent errors.

