Skip to content

Errors

WRouter responses follow a unified error envelope:

json
{
  "error": {
    "message": "Invalid API key provided",
    "type": "invalid_request_error",
    "code": "invalid_api_key",
    "param": null
  }
}

HTTP status codes mirror OpenAI.

HTTP status

StatusMeaningTypical cause
400Bad requestMissing/invalid params, unsupported field
401UnauthenticatedMissing/bad/disabled token
403ForbiddenIP not allowed; token lacks model permission
404Not foundWrong model ID, missing file ID
409ConflictDuplicate resource
413Payload too largeFile/prompt/batch over limit
422UnprocessableJSON Schema validation failed
429Too many requestsRPM exceeded, quota exhausted, balance low
499Client closed request
500Internal errorWRouter-side fault; safe to retry
502 / 503 / 504Upstream failureUpstream model unavailable/timeout — retry or fall back

Error codes

codeMeaning
invalid_api_keyToken invalid
expired_api_keyToken expired
disabled_api_keyToken disabled
ip_not_allowedIP not in allowlist
model_not_foundUnknown model ID
model_not_authorizedToken/group cannot use this model
insufficient_quotaToken quota exhausted
insufficient_balanceAccount balance too low
rate_limit_exceededRate limit hit
content_policy_violationPolicy block
context_length_exceededInput exceeds context window
upstream_errorUpstream returned an error (see message)
upstream_timeoutUpstream timed out
internal_errorWRouter internal fault

Retry guidance

ErrorRetry?Notes
429yesExponential back-off, starting at 1 s, capped at 60 s
500 / 502 / 503 / 504yesSame
upstream_timeoutyesLower max_tokens or switch model
Other 4xxnoFix the request

Both the OpenAI and Anthropic SDKs include retry logic out of the box.

Debugging

Console → Call logs → click a row:

  • Redacted request/response bodies
  • Upstream endpoint, latency, status
  • Cost breakdown
  • Full trace ID

Submit the trace ID to support to accelerate triage.