Errors
Every /v1/* gateway error, chat completions, embeddings, threads, uses
the same envelope:
{
"error": {
"message": "Model gpt-4 is not served on this gateway",
"type": "invalid_request_error",
"code": "model_not_allowed"
}
}type is "invalid_request_error" for anything the caller can fix by
changing the request, and "server_error" for upstream failures.
Codes
| Code | Status | When |
|---|---|---|
missing_key | 401 | No Authorization header |
bad_key | 401 | Key is unknown, revoked, or its project is inactive |
model_not_allowed | 400 | Model isn’t served by this gateway at all |
model_not_allowed | 403 | Model is served, but this key’s allowed_models doesn’t include it |
empty_messages | 400 | messages is an empty array |
empty_input | 400 | /v1/embeddings input resolves to an empty list |
thread_messages_invalid | 400 | With thread_id, messages wasn’t exactly one user message plus any system messages |
thread_multimodal_not_supported | 400 | Image content sent alongside a thread_id |
context_length_exceeded | 400 | Prompt (or system block, or a single embeddings input) exceeds the model’s context window |
thread_not_found | 404 | Thread doesn’t exist, or belongs to another project |
nothing_to_continue | 409 | The thread’s last assistant turn already finished normally |
rate_limit_exceeded | 429 | This key’s requests-per-minute bucket is full |
budget_exceeded | 429 | This project is at or over its monthly token budget |
upstream_error | 502 (or the upstream’s own status, e.g. 503 with no reachable upstream) | Ollama or OpenRouter failed or was unreachable |
See Usage, rate limits & budgets for exactly
what the two 429s mean in practice, and Local vs. cloud routing for why a model id
might land in the 400 vs. the 403 case above.
The admin/console surface
/keys and /projects (minting and revoking API keys, managing projects)
are a separate, console-only, cookie-authenticated surface. They return
plain FastAPI {"detail": "..."} errors, not the envelope above, see Authentication & API keys.