LogoToRouter Docs
LogoToRouter Docs
HomepageWhat is ToRouter5-minute quickstartCore concepts
Full error code referencePrivacy & data handlingTerms of service
Reference

Full error code reference

Gateway error types with HTTP status, meaning, and what to do next.

ToRouter includes a type code in error responses (usually the JSON type field). The tables below cover codes the gateway emits itself. Errors that originate upstream (OpenAI / Anthropic / Gemini) keep the provider's original type and message — see their docs for those.

Authentication & key state

TypeStatusMeaningFix
API_KEY_REQUIRED401No API key in request headersSend Authorization: Bearer sk-***
INVALID_API_KEY401Key not recognisedCheck for typos; the key may have been revoked
API_KEY_DISABLED401Key was disabled in /keysRe-enable or create a new key
API_KEY_EXPIRED403Key is past its configured expiryExtend expiry or rotate
API_KEY_QUOTA_EXHAUSTED429Key hit its configured spending capRaise the cap or rotate
USER_NOT_FOUND401Key's owning user is missingContact support
USER_INACTIVE401Owning user is suspended / unverifiedVerify email; check account status

Authorization

TypeStatusMeaningFix
ACCESS_DENIED403Client IP not in the key's allowlist (or in its blocklist), or model not in the key's whitelistUpdate the key's IP / model restrictions
SUBSCRIPTION_NOT_FOUND403This key needs an active subscription but none is on fileComplete subscription in /subscriptions
INSUFFICIENT_BALANCE403Account balance ≤ 0 for pay-per-tokenTop up in /billing/topup

Quotas & rate limits

TypeStatusMeaningFix
rate limit exceeded (top-level error)429Per-IP / per-key request rate limitBack off; raise limit
USAGE_LIMIT_EXCEEDED429Subscription daily / weekly / monthly window capWait for window roll-over or move to a higher-usage plan tier
SUBSCRIPTION_INVALID403Subscription is paused, cancelled, or otherwise invalidRenew in /subscriptions

Request validation

TypeStatusMeaningFix
api_key_in_query_deprecated400API key passed in ?key= or ?api_key= (no longer supported)Move the key to the Authorization header
invalid_request_error (passthrough from upstream)400Body fails upstream validationFix request shape

Gateway & failover

TypeStatusMeaningFix
upstream_unavailable502 / 503Every candidate channel failedRetry with backoff; check the usage dashboard or usage details
upstream_timeout504Upstream didn't respond in timeRetry; try a smaller model or shorter prompt
INTERNAL_ERROR500Unexpected gateway errorRetry; report with x-request-id if persistent

Response shape differs slightly by protocol (OpenAI, Anthropic, Gemini), but the same type always means the same thing.

Reading an error response

{
  "error": {
    "type": "API_KEY_EXPIRED",
    "code": "API_KEY_EXPIRED",
    "message": "API key 已过期"
  }
}
  • type / code: match against the tables above.
  • message: human-readable detail; may be in Chinese for legacy codes.
  • Response header x-request-id: include when reporting an issue.

Next steps

Common HTTP errors

Quick reference by status code.

Key blocked or revoked

Recovery flow for auth-class errors.

Upstream errors & failover

What 502 / 503 / 504 really mean.

Production best practices

Eight habits that keep a ToRouter integration boring in production.

Privacy & data handling

What ToRouter logs, what it forwards upstream, and how to delete your data.

Table of Contents

Authentication & key stateAuthorizationQuotas & rate limitsRequest validationGateway & failoverReading an error responseNext steps