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

StatusCauseFix
401Missing or invalid API keyCheck your Authorization/x-api-key header — must be sk-eu-...
402Out of creditTop up at /console/billing
403Provider mismatch — key group doesn't match modelUse a Claude key for claude-* models, OpenAI key for gpt-* models
429Rate limitedBack off exponentially — the SDK retries automatically
400Bad request — malformed JSON or missing fieldCheck the message field for specifics
5xxUpstream provider issueUsually 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:

shell
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:

shell
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"
}