Docs pages

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).

json, 402
{
  "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
Error codes
StatusCodeMeaningWhat to do
400invalid_requestThe 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.
400unsupported_parameterA 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.
400unsupported_valueA 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.
400context_length_exceededThe prompt is over your plan’s or key’s context limit.Shorten the messages or summarise earlier turns.
401missing_api_keyNo key was sent.Send Authorization: Bearer <your key>.
401invalid_api_keyThe key is malformed, unknown, revoked or expired.Copy the whole key again, or create a new one in the Console under API keys.
402insufficient_balanceThe wallet balance is too low for this request.Top up in the Console under Wallet, then send it again.
402spend_cap_reachedSpend 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.
402request_cost_cap_exceededThis 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.
403account_suspendedThe organisation or user is suspended.Contact support.
403wallet_frozenStaff have put the organisation’s wallet on hold.Contact support.
403key_pausedThe 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.
403missing_scopeThe key lacks the scope this endpoint needs.Use a key with the scope, or edit the key’s scopes.
403model_not_allowedYour plan does not include the model.Use auto or a model on your plan.
403model_not_allowed_for_keyThe key’s allowed models exclude this model.Use an allowed model, or edit the key’s allowed models.
404model_not_foundNo active model has that id.Use auto or an id from GET /v1/models.
404unknown_urlNo /v1 endpoint has that path.Check the path against the endpoints on Introduction.
405method_not_allowedThe path exists, with another method.Use the method shown on the endpoint’s page.
413request_too_largeThe body is over 32 MiB, or the model rejected the request as too large.Send a smaller request.
429rate_limit_exceededA 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.
429insufficient_quotaThe monthly token quota cannot cover this call’s reservation.Retry with a lower output limit, or wait for x-steerwise-quota-reset.
429spend_cap_pendingCalls still in flight could reach a spend cap.Retry after Retry-After seconds.
500internal_errorSomething failed on our side. Details are logged under the request id, never returned.Retry. If it repeats, send support the x-request-id.
502upstream_errorThe model failed after retries and fallback.Retry.
503upstream_overloadedThe model was overloaded or unavailable after retries and fallback, or Steerwise is holding back calls to it.Retry after Retry-After seconds.
503wallet_unavailableThe balance check could not run, so the request was not started.Retry shortly.
503limits_unavailableThe rate-limit check could not run, so the request was not started.Retry shortly.
503server_overloadedThe server is at its limit of requests at once.Retry after Retry-After seconds.
503service_unavailableThe 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.
503service_restartingThe server is restarting and cancelled the request.Retry.
504upstream_timeoutThe model did not start, or went quiet for too long, after retries and fallback.Retry.
Do not retry a 402 in a loopinsufficient_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.
Rate limit headers
HeaderWhat it says
x-ratelimit-limit-requestsRequests per minute allowed by the tightest request limit that applies
x-ratelimit-remaining-requestsRequests left under that limit now
x-ratelimit-reset-requestsTime until that limit is full again, such as 6s or 1m0s
x-ratelimit-limit-tokensTokens per minute allowed by the tightest token limit that applies
x-ratelimit-remaining-tokensTokens left under that limit now, after this call’s reservation
x-ratelimit-reset-tokensTime until that limit is full again
x-steerwise-ratelimit-scopeOn a 429: which limit refused the call: org, user, key or model
x-steerwise-quota-resetOn insufficient_quota: when the monthly token quota resets (00:00 UTC on the 1st)
Retry-AfterOn 429 and 503: seconds to wait before retrying

A refused request looks like this. Wait the seconds in Retry-After, then send it again:

Example (http, 429)
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 parameters and json_schema formats): at most 64 KiB per schema, 256 KiB across a request, and 64 regex patterns per request. $ref may 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.