OwnLLM Docs
API

Errors

HTTP error codes returned by the OwnLLM API and how to handle each.

OwnLLM follows the OpenAI error envelope so any client that handles OpenAI errors handles ours.

{
  "error": {
    "type": "<type>",
    "code": "<machine-readable-code>",
    "message": "<human-readable explanation>"
  }
}

type is one of invalid_request_error, authentication_error, permission_error, rate_limit_exceeded, agent_unavailable, internal_error. code is a more specific machine-readable string documented below.

400 — invalid_request_error

CodeWhen
model_requiredRequest is missing model.
messages_requiredRequest is missing messages or it's empty.
model_does_not_support_toolsRequest includes tools but the model's capabilities.tools is false. Switch to a tool-capable model.
model_does_not_support_visionRequest has image parts but the model isn't vision-capable.
context_length_exceededRequest token count exceeds the model's context_window. Trim the messages.
invalid_response_formatresponse_format.type isn't json_object or json_schema.

401 — authentication_error

CodeWhen
key_invalidThe API key doesn't exist or has been revoked.
key_expiredThe API key's TTL elapsed. Generate a new one.
key_malformedThe Authorization header doesn't match Bearer sk-ownllm-....

403 — permission_error

CodeWhen
scope_requiredThe key isn't scoped for the requested model. Edit the key or pick another model.
tenant_disabledThe tenant is suspended (billing failure, manual hold).
user_deactivatedThe user owning the key was deactivated (manual or SCIM).

429 — rate_limit_exceeded

CodeWhen
budget_exceededThe key's monthly budget cap is hit. Bump the budget or wait until next month.
concurrency_limitToo many in-flight requests for this key. Back off.
tenant_qps_limitThe tenant's overall QPS limit is hit (rare; only enforced at heavy abuse).

The standard Retry-After header is set on 429 responses.

503 — agent_unavailable

CodeWhen
agent_offlineThe paired GPU machine isn't reachable. The user should check Atlas / ownllm status.
tunnel_downThe Cloudflare Tunnel is down even though the agent is reachable. Same fix.
model_loadingThe model isn't ready yet. Retry after a few seconds.

500 — internal_error

CodeWhen
internal_errorGeneric 500. Sentry has the details on our side. Retry; if it persists, open an issue.

Handling errors in code

try {
  const response = await client.chat.completions.create({ ... });
} catch (err) {
  if (err.status === 400 && err.code === "model_does_not_support_tools") {
    // fall back to a tool-capable model
  } else if (err.status === 503) {
    // agent is offline; retry with exponential backoff
  } else {
    throw err;
  }
}

The OpenAI SDK exposes err.status (HTTP code), err.code (our machine code), and err.message.

Why custom codes?

Plain OpenAI codes weren't enough to distinguish OwnLLM-specific failures (offline agent vs scope error vs missing capability). Adding the code field is additive and doesn't break clients that only look at the HTTP status.

On this page