Errors and limits
Every error from /v1 has an HTTP status and a stable code. Branch on the code, not on the message, which can change.
Error shape
Errors use the OpenAI error shape, so the OpenAI SDKs raise their usual exceptions. param names the offending field, or is null. On /v1/messages the same codes arrive in Anthropic’s shape, in error.details.error_code (see Messages).
{
"error": {
"message": "Your wallet balance is too low for this request.",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_balance"
}
}Every response, errors included, carries x-request-id. Quote it to support.
Error codes
- Fix, then send again: 400, 401, 402, 403, 404, 405, 413
- Retry after a wait: 429, 500, 502, 503, 504
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_request | The body is malformed, a field is missing or invalid, or the model rejected the request (the message then starts with “Upstream rejected the request”). | Fix the request. param names the field. |
| 400 | unsupported_parameter | A parameter this API rejects (see the parameter policy on each API page), or a file part with file_id. | Remove the parameter named in param. |
| 400 | unsupported_value | A value this API or the chosen model cannot honour: for example a forced tool_choice on a model without forced tool use, an image for a model without vision, or an effort level the model lacks. | Change the value, or use a model that supports it. |
| 400 | context_length_exceeded | The prompt is over your plan’s or key’s context limit. | Shorten the messages or summarise earlier turns. |
| 401 | missing_api_key | No key was sent. | Send Authorization: Bearer <your key>. |
| 401 | invalid_api_key | The key is malformed, unknown, revoked or expired. | Copy the whole key again, or create a new one in the Console under API keys. |
| 402 | insufficient_balance | The wallet balance is too low for this request. | Top up in the Console under Wallet, then send it again. |
| 402 | spend_cap_reached | Spend has reached a daily or monthly cap of the key or the organisation, or the agent run’s cap. | Wait for the time in x-steerwise-spend-cap-reset, raise the cap under Spend caps, or start a new session for a run cap. |
| 402 | request_cost_cap_exceeded | This request’s worst case (the model, the prompt and the full output limit) is over the per-request cap. | Lower max_tokens, shorten the prompt, or raise the per-request cap. |
| 403 | account_suspended | The organisation or user is suspended. | Contact support. |
| 403 | wallet_frozen | Staff have put the organisation’s wallet on hold. | Contact support. |
| 403 | key_paused | The key is paused, usually by the runaway-spend detector after its spend jumped far past its usual rate. | Check the key’s recent runs, then resume it in the Console under Spend caps. |
| 403 | missing_scope | The key lacks the scope this endpoint needs. | Use a key with the scope, or edit the key’s scopes. |
| 403 | model_not_allowed | Your plan does not include the model. | Use auto or a model on your plan. |
| 403 | model_not_allowed_for_key | The key’s allowed models exclude this model. | Use an allowed model, or edit the key’s allowed models. |
| 404 | model_not_found | No active model has that id. | Use auto or an id from GET /v1/models. |
| 404 | unknown_url | No /v1 endpoint has that path. | Check the path against the endpoints on Introduction. |
| 405 | method_not_allowed | The path exists, with another method. | Use the method shown on the endpoint’s page. |
| 413 | request_too_large | The body is over 32 MiB, or the model rejected the request as too large. | Send a smaller request. |
| 429 | rate_limit_exceeded | A per-minute request or token limit, or the limit on calls at once, of the organisation, user, key or model. | Wait the seconds in Retry-After, then retry with backoff. |
| 429 | insufficient_quota | The monthly token quota cannot cover this call’s reservation. | Retry with a lower output limit, or wait for x-steerwise-quota-reset. |
| 429 | spend_cap_pending | Calls still in flight could reach a spend cap. | Retry after Retry-After seconds. |
| 500 | internal_error | Something failed on our side. Details are logged under the request id, never returned. | Retry. If it repeats, send support the x-request-id. |
| 502 | upstream_error | The model failed after retries and fallback. | Retry. |
| 503 | upstream_overloaded | The model was overloaded or unavailable after retries and fallback, or Steerwise is holding back calls to it. | Retry after Retry-After seconds. |
| 503 | wallet_unavailable | The balance check could not run, so the request was not started. | Retry shortly. |
| 503 | limits_unavailable | The rate-limit check could not run, so the request was not started. | Retry shortly. |
| 503 | server_overloaded | The server is at its limit of requests at once. | Retry after Retry-After seconds. |
| 503 | service_unavailable | The key could not be checked in time. With x-should-retry: false and no Retry-After: no model that could serve the call is available right now. | Retry after Retry-After; without it, try another model or later. |
| 503 | service_restarting | The server is restarting and cancelled the request. | Retry. |
| 504 | upstream_timeout | The model did not start, or went quiet for too long, after retries and fallback. | Retry. |
insufficient_balance, spend_cap_reached and request_cost_cap_exceeded are final: the same request fails until you top up, the cap resets or you raise it. If your agent framework retries every error, exclude 402.Rate limits
Requests and tokens per minute, tokens per calendar month (UTC), calls at once and prompt size are checked before a call starts, for the organisation, the user, the key and the model. Your plan sets them, and a key can have tighter ones; the Console shows them under Limits. Nothing refused here is started or billed.
- Tokens counted are input, cache writes and output; cache reads are not counted.
- A call reserves its prompt estimate plus its full output limit, and returns what it did not use when it ends. A lower output limit leaves more room.
- Chat completions, responses and messages report the tightest limit that applies, on success and on 429. The headers are absent when no per-minute limit applies.
| Header | What it says |
|---|---|
x-ratelimit-limit-requests | Requests per minute allowed by the tightest request limit that applies |
x-ratelimit-remaining-requests | Requests left under that limit now |
x-ratelimit-reset-requests | Time until that limit is full again, such as 6s or 1m0s |
x-ratelimit-limit-tokens | Tokens per minute allowed by the tightest token limit that applies |
x-ratelimit-remaining-tokens | Tokens left under that limit now, after this call’s reservation |
x-ratelimit-reset-tokens | Time until that limit is full again |
x-steerwise-ratelimit-scope | On a 429: which limit refused the call: org, user, key or model |
x-steerwise-quota-reset | On insufficient_quota: when the monthly token quota resets (00:00 UTC on the 1st) |
Retry-After | On 429 and 503: seconds to wait before retrying |
A refused request looks like this. Wait the seconds in Retry-After, then send it again:
HTTP/1.1 429 Too Many Requests
Retry-After: <seconds>
x-steerwise-ratelimit-scope: key
x-ratelimit-limit-requests: <n>
x-ratelimit-remaining-requests: 0
x-ratelimit-reset-requests: <duration>
{
"error": {
"message": "Rate limit reached for this API key on requests per minute: limit <n>. Retry after <seconds>s.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limit_exceeded"
}
}Size limits
- Request bodies: at most 32 MiB (413
request_too_large). - At most 128 tools per request.
- Client JSON Schemas (tool
parametersandjson_schemaformats): at most 64 KiB per schema, 256 KiB across a request, and 64 regex patterns per request.$refmay not load external documents. - The models endpoints: 60 calls per minute per key by default. Token counting: 120 calls per minute per key.
Spend cap headers
A spend_cap_reached, request_cost_cap_exceeded or spend_cap_pending response says which cap stopped it and, for a daily or monthly cap, when it resets, in x-steerwise-spend-cap-scope, x-steerwise-spend-cap-window and x-steerwise-spend-cap-reset. See Spend caps.