API Reference
Errors
One canonical error shape, and what each status code means.
Error shape
Error responses are a flat JSON object — { code, message }. There is no OpenAI-style { error: { ... } } wrapper and no type field, on either /v1/chat/completions or /v1/messages.
Status codes
| Status | Cause | Fix |
|---|---|---|
401 | Missing or invalid API key | Check your Authorization/x-api-key header — must be sk-eu-... |
402 | Out of credit | Top up at /console/billing |
403 | Provider mismatch — key group doesn't match model | Use a Claude key for claude-* models, OpenAI key for gpt-* models |
429 | Rate limited | Back off exponentially — the SDK retries automatically |
400 | Bad request — malformed JSON or missing field | Check the message field for specifics |
5xx | Upstream provider issue | Usually means the upstream provider is degraded — retry with exponential backoff; if it persists, check the Prismma status page. |
Example responses
Both 401 cases below are curl-verified against the live gateway.
No Authorization header at all:
curl https://api.prismma.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"claude-opus-4-7","messages":[{"role":"user","content":"Hello"}]}'
# →
HTTP/1.1 401 Unauthorized
{
"code": "API_KEY_REQUIRED",
"message": "..."
}The message text above is intentionally left as "..." — only the code value and flat shape were captured verbatim; the exact wording wasn't.
A key that doesn't parse as valid:
curl https://api.prismma.ai/v1/chat/completions \
-H "Authorization: Bearer sk-eu-not-a-real-key" \
-H "Content-Type: application/json" \
-d '{"model":"claude-opus-4-7","messages":[{"role":"user","content":"Hello"}]}'
# →
HTTP/1.1 401 Unauthorized
{
"code": "INVALID_API_KEY",
"message": "Invalid API key"
}