Errors

The gateway error contract — status codes, error codes, and how to handle each one.

Every error from the gateway follows the same shape, so you can write one handler instead of one per endpoint.

{
"error": {
  "code": "policy_violation",
  "message": "Request blocked by guardrail",
  "blocked_by": "geo_block",
  "action": "reject",
  "docs_url": "https://developers.relixr.com/docs/errors",
  "dashboard_fix": "/dashboard/guardrails"
}
}

Status Codes

StatusCodeMeaningWhat to do
400invalid_requestMalformed JSON or missing required fields.Fix the body; see Chat completions.
401unauthorizedMissing/invalid key, or wrong key type (management vs inference).Use an rlx_ inference key.
402insufficient_balanceReserve would exceed workspace balance.Top up; or lower max_tokens.
403policy_violationGuardrail blocked the request — see blocked_by.Adjust content or guardrails.
404model_not_foundModel id not in catalog / not allowlisted.Check /models and key allowlist.
429rate_limitedKey or workspace rate limit.Back off and retry.
502 / 503upstream_errorProvider or gateway temporary failure.Retry; Relixr may failover if routing allows.
504upstream_timeoutUpstream took too long.Retry with smaller output or another model.
Tip:

Retry 429 and most 5xx with backoff. Do not retry 402 or 403 without changing balance or the request. Use the Integration doctor to catch base URL / key mistakes before they hit production.

Future gateway builds may include docs_url and dashboard_fix on error bodies for deep links.

Next steps
Guardrails
What can trigger a policy_violation.
Billing & credits
How balance reservation works.
Was this helpful?

Still stuck? Help center · Doctor

AuthenticationOpenAPI