Skip to content
Docs

Errors

Errors use HTTP status codes and a JSON body:

{
  "error": {
    "message": "Rate limit of 600 requests a minute reached for this key.",
    "type": "rate_limited",
    "code": "ORYX_4292",
    "request_id": "req_..."
  }
}
  • type is stable and machine-readable; branch on it.
  • code is a specific ORYVOX code (ORYX_xxxx) to quote to support.
  • request_id identifies the request in the log (also in X-Oryvox-Request-Id).

Error types

StatustypeWhenSDK classRetried by SDKs
400invalid_requestMissing or invalid fields (e.g. no messages, no input).ValidationError (BadRequestError)No
400blocked_by_policyThe project policy stopped secrets or personal data in the prompt.ValidationErrorNo
400bad_request, context_too_longA provider refused the request, or it does not fit the context.ValidationErrorNo
401invalid_api_keyMissing, unknown, expired or revoked key.AuthenticationErrorNo
402budget_exceededA project, key or workflow budget is reached.BudgetExceededErrorNo
402insufficient_creditsPrepaid credit (or the postpaid credit limit) does not cover the request.InsufficientCreditsError (subclass of BudgetExceededError)No
402plan_limitLive keys: the company's Core plan request allowance for the month is used up (Free: 10,000 requests).BudgetExceededErrorNo
403permission_deniedThe key lacks the endpoint's scope.PermissionDeniedErrorNo
403ip_not_allowedThe caller's IP is not on the company or key allowlist.PermissionDeniedErrorNo
404model_not_foundUnknown model (or not an embedding model).NotFoundErrorNo
404not_foundUnknown request id in this project.NotFoundErrorNo
409conflictORYX_4091: a request with this Idempotency-Key is still running. ORYX_4092: it already ran and its result was not kept (streamed, or Zero retention).ConflictErrorORYX_4091 yes, ORYX_4092 no
422idempotency_mismatchThe Idempotency-Key was used with a different body.ValidationErrorNo
429rate_limitedORYX_4292: the key's requests-per-minute limit. ORYX_4291: every provider route was rate limited after fallbacks.RateLimitErrorYes
502provider_error, invalid_response, authEvery attempt failed: provider error, unusable answer, or the provider rejected its key (e.g. a BYOK key).InternalServerErrorYes
503no_model_available, provider_unavailableNo allowed model can serve it, or providers are down.ProviderUnavailableErrorYes
504timeoutThe model did not answer in time.TimeoutError (Python: OryvoxTimeoutError)Yes
nonenetwork failureNo HTTP response.APIConnectionError (ConnectionError)Yes
noneclient timeoutTimeoutError / OryvoxTimeoutErrorYes

Field validation on /cache/invalidate and /requests/{id}/feedback (e.g. a rating of 9) answers 422 with {"message": "...", "errors": {"field": ["..."]}} instead of the error object; the SDKs raise it as ValidationError with that message.

All SDK errors extend APIError, which extends OryvoxError, and expose status, type, code and requestId (Node) / request_id (Python). When type and status disagree, the SDKs choose the class by type. Test keys can trigger rate_limited, timeout, provider_unavailable and invalid_response on demand (see Getting started).

Handling errors

import Oryvox, { BudgetExceededError, InsufficientCreditsError, ValidationError } from '@oryvox/sdk';

try {
  await client.responses.create({ model: 'oryvox-auto', input });
} catch (err) {
  if (err instanceof InsufficientCreditsError) askForTopUp();
  else if (err instanceof BudgetExceededError) notifyBilling(err.requestId);
  else if (err instanceof ValidationError && err.type === 'blocked_by_policy') askUserToRemoveSecrets();
  else throw err;
}
from oryvox import BudgetExceededError, InsufficientCreditsError, ValidationError

try:
    client.responses.create(model="oryvox-auto", input=text)
except InsufficientCreditsError:
    ask_for_top_up()
except BudgetExceededError as e:
    notify_billing(e.request_id)
except ValidationError as e:
    if e.type == "context_too_long":
        ...

Errors in streams

After a stream has started, errors arrive in the stream (data: {"error": ...} for chat, event: error for responses). The SDKs raise them as the same classes, with status unset.

Retry policy

See SDKs > Retries. If you call the API without an SDK, retry only the statuses marked "Yes" above, with exponential backoff, and reuse the same Idempotency-Key (see Billing > Idempotency).

Was this page helpful?