API reference
Errors
Status codes, error bodies and what to retry.
Errors use standard HTTP status codes and a single body shape, whether they come from Odyssey or from the model itself. Every error carries the request id, so a failure in your logs can be found in the dashboard.
Error shape
{ "error": { "type": "rate_limit_error", "code": "rate_limit_exceeded", "message": "Rate limit of 30 requests per minute reached for your plan.", "param": null, "request_id": "req_5d18ba90c47e2f6183ac5b71", "retry_after_ms": 12000 }}| Field | Description |
|---|---|
type | Broad class, such as authentication_error, invalid_request_error or upstream_error. |
code | The specific reason, stable enough to branch on. |
message | A sentence for a developer reading logs. Don't parse it. |
request_id | Matches the id in Activity and in successful responses. |
retry_after_ms | Present on 429 and some 503s. Wait at least this long. |
Status codes
| Status | Description |
|---|---|
400 | The body is malformed, or a parameter is out of range for the model. When the model refuses the request, the message carries its reason. |
401 | Missing, malformed or revoked key. |
402 | The credit balance is empty, or a spend limit was reached. |
403 | The key isn't allowed to call this model (model_not_allowed), the model can only be called from one client such as Claude Code (client_not_supported), or the account or network is suspended. |
404 | Unknown model id or request id. A name two models share is refused too, and the message lists the ids it could mean. |
408 | The endpoint didn't respond in time. |
413 | The prompt is larger than the model's context window. |
429 | Your requests-per-minute limit, or the endpoint's limit, was hit. |
500 | A fault inside Odyssey. Safe to retry. |
502 | The model failed or was unreachable (upstream_unavailable). Safe to retry. |
503 | The model is at capacity (model_busy, safe to retry), or can't be served until something is fixed: under maintenance, offline, unavailable or refused (upstream_refused). These carry x-should-retry: false. |
What to retry
- Follow
x-should-retrywhen it is present. Odyssey sendsfalsewith every error that will repeat, whatever its status, so a client that honours it (the official OpenAI and Anthropic SDKs do, and so does Claude Code) fails at once with the reason instead of retrying for minutes. - Otherwise retry on
429,408and5xx, with exponential backoff and jitter. - Don't retry
400,401,403,404or413. The same request will fail again. - Handle
402as a signal, not a fault. Add credits or raise the limit; retrying without doing so just fails again.
async function withRetries(send, attempts = 3) { for (let attempt = 0; attempt < attempts; attempt++) { try { return await send(); } catch (error) { const status = error?.status; const advice = error?.headers?.["x-should-retry"]; const retryable = advice ? advice === "true" : status === 429 || (status >= 500 && status < 600); if (!retryable || attempt === attempts - 1) throw error; const wait = error?.headers?.["retry-after-ms"] ?? 2 ** attempt * 500; await new Promise((resolve) => setTimeout(resolve, Number(wait) + Math.random() * 250)); } }}Odyssey doesn't retry for you
A 502 or 429 reaches you as it happened, so retry with backoff in your own client. The official OpenAI and Anthropic SDKs already do this for these statuses, and wait for retry-after when the model's provider asked for a pause.
Models served to one client only
A few models are served only to a particular client, such as Claude Code. Called from anything else they return 403 with client_not_supported, and the error body names the client in required_client. Called from that client, they work as any other model.
Rate limits
Your account's requests per minute surfaces as 429 with rate_limit_exceeded. When the model itself is overloaded, you get 429 with upstream_rate_limited instead, and when the model is at capacity, 503 with model_busy. All of them carry retry_after_ms.
Responses include x-ratelimit-limit-requests and x-ratelimit-remaining-requests whenever a limit applies, and a retry-after header on 429. Watching the remaining count is cheaper than backing off after the fact.
Tracing a failure
Paste a request id into Activity to see the status it returned, where the time went and what the request cost. Failed requests are kept in the log too.