Skip to main content
Every error response includes a machine-readable code, a canonical type, and the request_id for support correlation.

Prerequisites

  • An Auriko API key
  • Python 3.10+ with the OpenAI SDK (pip install openai) or the auriko SDK (pip install auriko)
    • OR Node.js 18+ with the OpenAI SDK (npm install openai) or @auriko/sdk (npm install @auriko/sdk)

Error types

All Auriko errors extend AurikoAPIError. The envelope is canonical (see Errors):
FieldTypeDescription
messagestrHuman-readable error message
status_codeintHTTP status code
codestrMachine-readable error code
typestrCanonical error type (one of six values)
paramstr | NoneParameter that caused the error
request_id / requestIdstrValue of x-request-id on the failing response
retry_after_seconds / retryAfterSecondsint | NoneRetry-After header value (429 / 503 only)
doc_url / docUrlstr | NoneLink to the error’s docs page
providerstr | NoneUpstream provider that generated the error, when attributable
The SDK provides these typed exception classes:
ExceptionHTTPtype
BadRequestError400 / 413 / 422invalid_request_error
AuthenticationError401authentication_error
PermissionDeniedError403permission_error
NotFoundError404not_found_error
ConflictError409invalid_request_error
RateLimitError429rate_limit_error
InternalServerError500api_error
APIStatusError502 / 503 / 504api_error
APIConnectionErrornetwork failure before any response
Dispatch on type + HTTP status for exception class, then on code for precise handling within a class. Never branch on message text; see Errors for retry policy by code.
See the Python SDK Reference or TypeScript SDK Reference for complete error class fields and hierarchy.

Handle errors

Catch typed exceptions:

Use built-in retries

The SDK automatically retries transient errors with exponential backoff:
SettingValue
Max retries2 (default)
Initial interval500ms
Max interval30 seconds
BackoffExponential (1.5 exponent) + random jitter
Retried status codes429, 500, 502, 503, 504
Connection/timeout errorsRetried
Retry-After headerRespected (overrides backoff when present)
When the server returns a Retry-After header (common with 429 responses), the SDK uses that value instead of the calculated backoff interval.

Retry manually

For request-level control over backoff or error filtering, implement custom retry logic:

Retry asynchronously

Retry with async/await:
TypeScript is inherently async. See the TypeScript tabs in Retry manually.
Side effects and retries: When using tools or multi-step workflows, consider whether retries are safe. A retried request that triggers a tool call may execute the tool twice. For idempotency-sensitive operations, either disable automatic retries (max_retries=0) or implement your own deduplication logic.

Fall back to another model

Catch the error from your primary model and retry with a different one:

Use circuit breakers

A circuit breaker stops sending requests after repeated failures and re-tests after a timeout:

Set timeouts

Log errors

Log errors for debugging:

Map OpenAI SDK errors

If you use the OpenAI SDK directly (with base_url pointed at Auriko), you can convert OpenAI errors to typed Auriko errors using map_openai_error():
You get typed error fields (status_code, code, response_headers) and fine-grained isinstance checks, even when using the OpenAI client. map_openai_error() is Python-only. TypeScript users should use the Auriko SDK directly for typed errors. See OpenAI Compatibility for OpenAI SDK error mapping.