API
Errors
The error body every endpoint returns, and what each code means.
The error body
Errors use OpenAI's shape, so SDKs raise their usual exceptions. `param` names the offending field when there is one; `code` is stable and is what to branch on. Messages never echo your request.
{
"error": {
"message": "Not enough WIT. This request reserves 12 WIT and the wallet has 3 available. …",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_wit"
}
}Codes
| Status | `type` | `code` | Meaning |
|---|---|---|---|
| 400 | `invalid_request_error` | `invalid_request` | The body failed validation; `param` names the field. |
| 400 | `invalid_request_error` | `unsupported` | A feature Allwit does not offer, such as `response_format: "url"`, non-text content parts, or a model of the wrong modality. |
| 400 | `invalid_request_error` | `content_policy_violation` | Blocked by Allwit's content moderation before routing. Nothing was charged. |
| 400 | `invalid_request_error` | `provider_refused` | The model provider refused the request. Nothing was charged. |
| 401 | `authentication_error` | `missing_api_key` / `invalid_api_key` | No key, an unknown key, or a revoked key. |
| 402 | `insufficient_quota` | `insufficient_wit` | The wallet cannot cover the estimate. Nothing was reserved. Buy WIT at /app/wit. |
| 404 | `invalid_request_error` | `model_not_found` | No such model id; see `GET /models`. |
| 413 | `invalid_request_error` | `payload_too_large` | The body or audio file is over the limit. |
| 429 | `rate_limit_error` | `rate_limit_exceeded` | Your key's requests per minute are used up. `Retry-After` says when to retry. |
| 429 | `rate_limit_error` | `model_busy` | The provider is rate-limiting this model. `Retry-After` set. Nothing was charged. |
| 502 | `server_error` | `provider_unavailable` | The provider could not be reached. Nothing was charged. |
| 503 | `server_error` | `ledger_unavailable` | WIT accounting is unavailable; retry shortly. |
| 500 | `server_error` | `internal_error` | Something else failed. Any reservation was returned. |
During a stream, a failure after the first byte arrives as a final `data: {"error": …}` event with the same `error` object, followed by `[DONE]`; the reservation is released.