Errors
Error response shapes across the Anthropic and OpenAI dialects
Runars returns errors in the dialect of the endpoint you called. This page lists the shapes, including the ones that aren't obvious from the SDK defaults.
Error response shapes
Anthropic dialect (/v1/messages, /v1/messages/count_tokens)
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "…"
}
}OpenAI dialect (/v1/chat/completions, /v1/responses, /v1/models)
{
"error": {
"message": "…",
"type": "invalid_request_error",
"code": "…",
"param": null
}
}Error reference
401 — Unauthorized
Invalid, missing, or revoked API key. API-key revocation is cache-invalidated within a few seconds on Runars; if you just revoked a key, wait ~5s and the old key stops working.
402 — payment_required
Returned when your organization's balance is zero (or negative). Top up at Dashboard → Billing, or enable auto-reload to avoid this in production.
404 — model_not_found
Returned when the requested model id isn't in the catalog. Runars never silently substitutes another model—send a valid id from GET /v1/models. Example (OpenAI shape):
{
"error": {
"message": "model_not_found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}429 — rate limited
Returned when you exceed your organization's rate-limit tier. Includes a retry-after header (seconds) indicating how long to wait before retrying.
5xx — upstream errors
A 5xx indicates an upstream or infrastructure failure. Idempotent requests can be retried with exponential backoff.
Retry guidance
- 401 / 404: do not retry—fix the key or model id first.
- 402: do not retry—top up the balance.
- 429: retry after the
retry-aftervalue, or respect the header. - 5xx: retry with exponential backoff and jitter; cap at a few attempts.