Error Reference

HTTP status codes and error responses from the API.

Error Format

{
  "error": {
    "message": "Insufficient credits",
    "type": "payment_required",
    "code": 402
  }
}

Status Codes

CodeNameDescription
400Bad RequestThe request body is malformed or missing required fields.
401UnauthorizedMissing or invalid API key.
402Payment RequiredInsufficient credit balance.
404Not FoundThe requested model or resource does not exist.
429Too Many RequestsRate limit exceeded. Wait and retry.
500Internal Server ErrorUnexpected server error. Contact support if persistent.
503Service UnavailableThe upstream model provider is temporarily unavailable.

Retry Strategy

For 429 and 503 errors, implement exponential backoff starting at 1 second. For 402, top up your balance before retrying.