All topics

SHVYDKO / API

Errors and retries

Distinguish validation errors, limits, insufficient reservation balance, and model unavailability.

Read the HTTP status and detail

An error is returned with an unsuccessful HTTP status and a detail field. Validation errors may also include errors: a list of fields and messages. Do not expect answers in such a response.

Example validation error structure
{
  "detail": "Request validation failed",
  "errors": [
    {
      "field": "body.questions",
      "message": "Questions must use supported types"
    }
  ]
}

The example wording is illustrative. Handle the status and structure, rather than the exact wording of detail.

Statuses

HTTPCauseWhat to do
401The key is missing, unknown, or revokedCheck the server secret; do not retry with the same key
402Insufficient available balance for a reservation in paid modeCheck the balance and active reservations
403The organization is suspended for billing reviewCheck the organization's status; do not bypass it with new keys
409The request reservation has already been finalized or expiredCheck Usage; do not automatically repeat the action
413The JSON exceeds the byte limitShorten the context or split the task
422Invalid structure, model name, or rejected contextCorrect the request or reduce the context
429Per-minute limit or daily preview quotaRespect Retry-After if present; daily quotas reset at 00:00 UTC
502The model is unavailable, returned an invalid response, or timed outRetry within a limit and with a delay; check Usage after a lost connection
503The model service is not connectedCheck the service status later

Retries must be bounded

For a per-minute 429, use Retry-After and a small random delay across clients. The daily preview quota may return 429 without this header: the message will indicate a reset at 00:00 UTC.

Do not retry 401, 402, 403, 413, or 422 without addressing the cause. For network failures and 502, set a small attempt limit and a total time budget. POST /v1/systemone provides no idempotency guarantee.

The gateway does not charge credits for a request it completed with a model error. Losing the response on your client is a different situation: the server may already have completed the request successfully.