Use this file to discover all available pages before exploring further.
Auriko returns errors in the format matching the endpoint’s API family. OpenAI-compatible endpoints (/v1/chat/completions, /v1/models, etc.) use the OpenAI error envelope. Anthropic-compatible endpoints (/v1/messages, /v1/messages/count_tokens) use the Anthropic error envelope.
Every non-2xx response on OpenAI-compatible endpoints uses this shape:
{ "error": { "message": "Model 'gpt-5-turbo' is not in the catalog. See the models endpoint for the current list.", "type": "not_found_error", "code": "model_not_found", "param": "model", "doc_url": "https://docs.auriko.ai/errors/model_not_found" }}
Field
Type
Required
Purpose
message
string
yes
Human-readable, actionable. Don’t branch on text.
type
string
yes
One of six categories (see below). Drives SDK class.
code
string | null
yes
Stable machine identifier. Branch on this.
param
string | null
yes
Offending field name. null when not attributable.
doc_url
string
recommended
Link to the error’s docs page.
provider
string | null
no
Upstream provider that generated the error. Null for non-provider errors.
suggestion
string
no
Actionable fix hint for routing/capability errors. Absent for other error types.
Notes:
The envelope is flat under error. There is no details[] array and no nested error objects.
Content-Type is application/json; charset=utf-8 on every error response.
The response body is never empty; even 401 and 404 carry the envelope.
Anthropic-compatible endpoints (/v1/messages and /v1/messages/count_tokens) return errors in the Anthropic Messages API format:
{ "type": "error", "error": { "type": "invalid_request_error", "message": "Request body must be a JSON object." }}
Field
Type
Required
Purpose
type (top-level)
string
yes
Always "error".
error.type
string
yes
One of nine categories (see table below).
error.message
string
yes
Human-readable description. Don’t branch on text.
error.suggestion
string
no
Actionable fix hint for routing/capability errors. Absent for other error types.
The Anthropic envelope doesn’t carry code, param, or doc_url. Routing failures include an optional suggestion with an actionable fix hint. Branch on error.type and HTTP status instead.
x-request-id — unique per request. Copy this when opening a support ticket. SDKs expose it as request_id (Python) / requestId (TypeScript) on every raised exception.
Error responses also carry, when applicable:
Retry-After — integer seconds. Present on 429 and 503. SDKs read this for automatic backoff.
Auriko abstracts over multiple upstream LLM providers. Error messages name the model and the upstream provider that produced the error. The provider name appears in error.provider and may appear in error.message. Failover across providers happens automatically before a 429 or 5xx surfaces to the client.
Streaming endpoints return Content-Type: text/event-stream. When the HTTP status is already committed as 200 OK and an error occurs mid-stream, the envelope surfaces as a final data: event and the stream closes:
HTTP/1.1 200 OKContent-Type: text/event-streamx-request-id: req_01HXABCDEFGHJKMNPQRSTVWXYZdata: {"id":"chatcmpl_01HX...","choices":[{"delta":{"content":"Hello"},"index":0}]}data: {"error":{"message":"Upstream timed out after 30 seconds.","type":"api_error","code":"upstream_timeout","param":null,"provider":"openai","doc_url":"https://docs.auriko.ai/errors/upstream_timeout"}}
Rules:
Errors never emit as partial JSON or a different SSE event name.
data: [DONE] signals successful completion only. After an error event, no [DONE] follows.
The connection closes immediately after the error event.
The Python and TypeScript SDKs dispatch incoming envelopes to typed exceptions. Every instance exposes message, type, code, param, request_id, doc_url, status_code, retry_after_seconds, and provider.
import osfrom auriko import Clientfrom auriko.errors import ( AurikoAPIError, APIConnectionError, AuthenticationError, PermissionDeniedError, BadRequestError, ConflictError, NotFoundError, RateLimitError, InternalServerError, APIStatusError,)client = Client(api_key=os.environ["AURIKO_API_KEY"])try: response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "Hello!"}], )except AuthenticationError as e: print(f"Check your API key. request_id={e.request_id}")except PermissionDeniedError as e: print(f"Not allowed: {e.message} (code={e.code})")except RateLimitError as e: print(f"Rate limited, retry after {e.retry_after_seconds}s")except NotFoundError as e: print(f"Not found: {e.message} (param={e.param})")except BadRequestError as e: print(f"Bad request: {e.message} (param={e.param})")except ConflictError as e: print(f"Conflict: {e.message} (code={e.code})")except InternalServerError as e: print(f"Server error. request_id={e.request_id}")except APIStatusError as e: print(f"Upstream error ({e.status_code}): {e.message}")except APIConnectionError as e: print(f"Network error: {e.message}")except AurikoAPIError as e: print(f"API error ({e.status_code}): {e.message}")
The SDK retries on APIConnectionError, rate_limit_error (except budget_exhausted and insufficient_quota), and api_error (except code: internal_error). Retries use exponential backoff and honor Retry-After when present.
When reporting a failure to support, include the x-request-id from the response header (or request_id / requestId on the SDK exception). That single identifier pairs the client view with the server log.