Error Handling

Tchavi returns standard HTTP status codes with a structured JSON error body.

Tchavi returns standard HTTP status codes. Errors include a JSON body:

JSON
{
  "error": {
    "code": "insufficient_credits",
    "message": "You don't have enough credits for this request.",
    "status": 402
  }
}

Common error codes

StatusCodeDescription
401invalid_api_keyMissing or invalid API key
402insufficient_creditsNot enough credits — recharge to continue
403model_not_allowedYour account tier doesn't include this model
429rate_limit_exceededRPM limit reached — check Retry-After header
429user_rate_limit_exceededPer-user RPM limit reached — upgrade plan to increase
429tpm_rate_limit_exceededToken-per-minute limit reached — wait before retrying
500internal_errorServer error — retry or contact support
502upstream_errorAI provider is temporarily unavailable

See also Rate Limits and Credits & Billing.

On this page