Errors and headers
Status codes
| Status | error.code | Meaning and what to do |
|---|---|---|
| 400 | invalid_model, invalid_messages, invalid_message_item, invalid_stream, invalid_n, invalid_max_tokens | The request is malformed. The message says which field. |
| 400 | unsupported_content_part | Something that is not text was sent: a picture, sound, video or file, in a content part or in a field of the message. Remove it; the guards cannot inspect it. Not charged. |
| 400 | non_canonical_key | A key differs from a recognised one only in letter case. Use the canonical spelling. |
| 400 | unknown_model | The operator does not offer that model. See GET /v1/models. |
| 401 | invalid_api_key | Missing, revoked or unknown key. |
| 402 | insufficient_credits | Not enough credit to reserve the request. |
| 413 | 413 | Input is too large for the guards to verify. Shorten it or split it. Not charged. |
| 429 | rate_limit_exceeded | Per-key request or token limit. Retry after the interval in Retry-After. |
| 451 | 451 | Blocked by policy on input or on output. See x-wattsfor-verdict to tell which, and x-wattsfor-risk-category for why. |
| 500 | – | The guard or the gateway failed. The request was not forwarded and any reservation was refunded; retry. |
| 502 | uninspectable_output | The model answered with something that is not text (a picture, sound, video or file, or one written into the text as a data URL of 1,000 characters or more). The output guard cannot inspect it, so it was not released. Only the gate fee is charged. |
| 502 / upstream status | – | Your upstream failed or was unreachable. Upstream error bodies are passed through as JSON, including for stream requests. |
Verdict header values
x-wattsfor-verdict | Meaning |
|---|---|
| LEGAL | The input gate passed the request. |
| ILLEGAL | The input gate blocked the request; the model was not called. |
| ILLEGAL_OUTPUT | The model ran, but its completion failed the output guard and was not delivered. |
| UNVERIFIABLE | Too large to verify (HTTP 413), or an answer that is not text and was not released (HTTP 502, uninspectable_output). |
The identifiers LEGAL / ILLEGAL are historical. They mean “passed” and “blocked by policy”; they are not legal determinations.
Response headers
| Header | Content |
|---|---|
| x-wattsfor-verdict | See above. |
| x-wattsfor-risk-category | Category of the block, for example guard_parse_fallback or unverifiable_length, or a policy category. |
| x-wattsfor-policy | Policy version and the first 12 characters of its sha256, for example 1.0.0:ec26aa6e9014. Ties the decision to the exact policy. |
| x-wattsfor-classifier | The input classifier in use. |
| x-wattsfor-guard-layers, x-wattsfor-guard-verdicts | Which layers ran and what each said. |
| x-wattsfor-reserved-usd, x-wattsfor-cost-usd, x-wattsfor-credits-remaining | Reservation, final cost and remaining credit. |
| x-wattsfor-tokens-prompt, x-wattsfor-tokens-completion | Token counts used for billing. |
| x-wattsfor-upstream, x-wattsfor-billing-rail | Which upstream served the request and which billing rail was used. |
| X-RateLimit-*, Retry-After | Per-key request and token limits and remaining budget. |