Lyber
Request access
DocsErrors

API reference

Markdown

Errors

Failed requests return an HTTP status and a JSON error with a stable code.

error.json
{
  "error": {
    "message": "Model capacity is full; retry later",
    "type": "rate_limit_error",
    "code": "rate_limit_error"
  }
}

Branch on code; the message is for people and can change.

Status codes

StatusCodesWhat to do
400invalid_request_error unsupported_parameter context_length_exceededFix the request. Unsupported fields are rejected, never ignored.
401authentication_error api_key_expiredCheck the key. See Authentication.
402insufficient_credit request_budget_exceeded account_spend_limit_exceeded key_spend_limit_exceededAdd credit, lower max_tokens, or raise a limit. See Spending controls.
403access_approval_required model_not_allowedWait for approval, or use a model the key allows.
404model_not_foundUse one of the two offered model IDs.
408request_timeoutThe body took over 15 seconds to upload. Send a smaller request.
413invalid_request_errorThe body is over 16 MiB.
429rate_limit_errorWait and retry. See below.
502upstream_error request_outcome_unknownThe model failed. It may have run; check your request history before resending.
503service_unavailable inference_stoppedThe model isn't serving. Retry later.
504upstream_timeoutThe request ran past its time limit. It may have run; check before resending.

Retrying safely

429 and 503 come with Retry-After: 5. When a 429 also carries x-lyber-admission: not-admitted, the model was busy and your request never started: it's always safe to wait and resend.

Lyber never deduplicates or replays requests. After a 502, 504, a dropped connection or a stream that ended early, the request may have run and been charged. Look it up in GET /v1/credits/requests before you send it again.