Errors and headers

Status codes

Statuserror.codeMeaning and what to do
400invalid_model, invalid_messages, invalid_message_item, invalid_stream, invalid_n, invalid_max_tokensThe request is malformed. The message says which field.
400unsupported_content_partSomething 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.
400non_canonical_keyA key differs from a recognised one only in letter case. Use the canonical spelling.
400unknown_modelThe operator does not offer that model. See GET /v1/models.
401invalid_api_keyMissing, revoked or unknown key.
402insufficient_creditsNot enough credit to reserve the request.
413413Input is too large for the guards to verify. Shorten it or split it. Not charged.
429rate_limit_exceededPer-key request or token limit. Retry after the interval in Retry-After.
451451Blocked 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.
502uninspectable_outputThe 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-verdictMeaning
LEGALThe input gate passed the request.
ILLEGALThe input gate blocked the request; the model was not called.
ILLEGAL_OUTPUTThe model ran, but its completion failed the output guard and was not delivered.
UNVERIFIABLEToo 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

HeaderContent
x-wattsfor-verdictSee above.
x-wattsfor-risk-categoryCategory of the block, for example guard_parse_fallback or unverifiable_length, or a policy category.
x-wattsfor-policyPolicy version and the first 12 characters of its sha256, for example 1.0.0:ec26aa6e9014. Ties the decision to the exact policy.
x-wattsfor-classifierThe input classifier in use.
x-wattsfor-guard-layers, x-wattsfor-guard-verdictsWhich layers ran and what each said.
x-wattsfor-reserved-usd, x-wattsfor-cost-usd, x-wattsfor-credits-remainingReservation, final cost and remaining credit.
x-wattsfor-tokens-prompt, x-wattsfor-tokens-completionToken counts used for billing.
x-wattsfor-upstream, x-wattsfor-billing-railWhich upstream served the request and which billing rail was used.
X-RateLimit-*, Retry-AfterPer-key request and token limits and remaining budget.