Skip to main content
Auriko uses standard HTTP status codes and returns detailed error information in the response body.

Error response format

All errors follow this format:
{
  "error": {
    "message": "Human-readable error message",
    "type": "error_type",
    "code": "error_code",
    "param": "optional_parameter_name"
  }
}

HTTP status codes

StatusDescription
400Bad Request — Invalid parameters or missing required fields
401Unauthorized — Invalid API key or BYOK provider key
402Payment Required — Insufficient credits or budget exceeded
403Forbidden — Insufficient permissions for this action
404Not Found — Model not in catalog
429Too Many Requests — Rate limit exceeded
500Internal Server Error — Unexpected Auriko error
502Bad Gateway — Upstream provider error
503Service Unavailable — No providers available or service down
504Gateway Timeout — Upstream provider timeout

Error codes

Authentication (401)

CodeDescription
invalid_api_keyThe API key is invalid or missing
provider_auth_errorBYOK key authentication failed at the upstream provider
provider_auth_error means your own provider key (BYOK) was rejected. This is distinct from invalid_api_key, which means your Auriko API key is invalid.

Request errors (400)

CodeDescription
invalid_requestThe request body is malformed or a parameter has an invalid value
missing_required_parameterA required parameter is missing
The param field in the error response identifies the offending field (for example, messages or routing.only_byok).

Billing errors (402)

CodeDescription
insufficient_quotaAccount has insufficient credits
budget_exceededBudget limit hit (workspace, key, or BYOK scope)

Authorization (403)

CodeDescription
forbiddenYou don’t have permission for this action
API keys are read-only for management endpoints (budgets, workspaces). Write operations require session authentication. See Budget management.

Not found (404)

CodeDescription
model_not_foundThe specified model is not in the catalog

Rate limiting (429)

CodeDescription
rate_limit_exceededToo many requests — back off and retry

Server errors (500)

CodeDescription
internal_errorAn unexpected error occurred on Auriko’s side

Provider errors (502, 503, 504)

CodeStatusDescription
provider_error502Upstream provider returned an error
provider_error504Upstream provider timed out
no_providers_available503No providers can serve this model/request
service_unavailable503Auriko service temporarily unavailable

Retry guidance

StatusRetryableRecommended action
400NoFix the request parameters
401 (invalid_api_key)NoCheck your Auriko API key
401 (provider_auth_error)NoCheck your BYOK provider key
402NoAdd credits or raise budget limit
403NoCheck permissions or use session authentication
404NoUse a valid model name (see Models)
429YesBack off using Retry-After header or exponential backoff
500YesRetry with backoff
502YesRetry — different provider may be selected
503YesRetry with backoff
504YesRetry — upstream provider timed out

Provider error mapping

When an upstream provider returns an error, Auriko maps it to a client-facing response:
Upstream conditionClient statusClient code
504 timeout504provider_error
Other 5xx502provider_error
401 auth failure401provider_auth_error
429 rate limit429rate_limit_exceeded
400 bad request400invalid_request
Other 4xx502provider_error

Handle SDK errors

import os
from auriko import (
    Client,
    AurikoAPIError,
    AuthenticationError,
    RateLimitError,
    BudgetExceededError,
    ModelNotFoundError,
    ProviderError,
    # Also available: InvalidRequestError, InsufficientCreditsError,
    # InternalError, ProviderAuthError, ServiceUnavailableError
)

client = Client(
    api_key=os.environ["AURIKO_API_KEY"],
    base_url="https://api.auriko.ai/v1"
)

try:
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": "Hello!"}]
    )
except AuthenticationError as e:
    print(f"Check your API key: {e}")
except RateLimitError as e:
    print(f"Rate limited, retry later: {e}")
except BudgetExceededError as e:
    print(f"Budget exceeded: {e}")
except ModelNotFoundError as e:
    print(f"Model not found: {e}")
except ProviderError as e:
    print(f"Provider error: {e}")
except AurikoAPIError as e:
    # Catches all other Auriko errors
    print(f"API error ({e.status_code}): {e}")

Retry logic

For transient errors (429, 500, 502, 503, 504), the SDK includes built-in retries with exponential backoff. See the Error Handling guide for retry configuration and custom retry patterns.
import os
from auriko import Client

# Default: 2 retries with exponential backoff
client = Client(
    api_key=os.environ["AURIKO_API_KEY"],
    base_url="https://api.auriko.ai/v1"
)

# Disable retries for manual control
client = Client(
    api_key=os.environ["AURIKO_API_KEY"],
    base_url="https://api.auriko.ai/v1",
    max_retries=0
)
The Auriko SDK includes built-in retry logic with configurable max_retries parameter. The SDK respects Retry-After headers when present.