LogoToRouter Docs
LogoToRouter Docs
HomepageWhat is ToRouter5-minute quickstartCore concepts
Common HTTP errorsRate-limited — what to doKey blocked or revokedUpstream provider errors & failoverProduction best practices
Troubleshooting

Common HTTP errors

Quick reference for 400 / 401 / 403 / 404 / 429 / 5xx responses from ToRouter and how to fix them.

ToRouter follows standard HTTP semantics. The status code tells you whether the problem is in your request, your key, your quota, or the upstream provider.

StatusMeaning at ToRouterLikely fix
400Malformed body, invalid model name, unsupported parameter for the chosen modelValidate JSON; check the model slug in /models; drop unsupported fields
401Missing, malformed, or unknown API key (API_KEY_REQUIRED, INVALID_API_KEY, API_KEY_DISABLED, USER_INACTIVE)Re-check the Authorization: Bearer sk-*** header; confirm the key is enabled
402Account balance insufficient (pay-as-you-go)Top up in Billing → Top up
403Access denied (ACCESS_DENIED for IP allowlist), API_KEY_EXPIRED, SUBSCRIPTION_NOT_FOUND, INSUFFICIENT_BALANCE, model not in the key's whitelistAdjust the key's IP allowlist / model whitelist; renew; subscribe to the group
404Model not present in your subscribed group's catalog, or unknown endpoint pathOpen /models to see what your group exposes; verify the path matches the protocol (OpenAI vs Anthropic vs Gemini)
429Rate limit hit (rate limit exceeded) or API_KEY_QUOTA_EXHAUSTED or daily/weekly/monthly subscription window limitSee Rate-limited
500ToRouter internal error — retry with backoffRetry; if it persists, report with the x-request-id response header
502Every upstream candidate failed after failover attemptsSee Upstream errors & failover
503Service temporarily unavailable — no eligible channel right nowRetry; check /dashboard for channel health
504Upstream timeoutRetry; consider a smaller model or shorter prompt

Response shape

ToRouter returns errors as JSON with at least an error field. The exact shape mirrors the protocol you called (OpenAI / Anthropic / Gemini), with ToRouter-specific codes inside.

{
  "error": {
    "message": "API key 已过期",
    "type": "API_KEY_EXPIRED",
    "code": "API_KEY_EXPIRED"
  }
}

Always log the x-request-id response header. It lets support trace the exact gateway path your request took.

Most common causes

Next steps

Rate-limited

Diagnose 429s and choose a fix.

Upstream errors

How failover works and when it can't help.

Full error code reference

Every error.type ToRouter returns.

Dify & n8n (no-code)

Wire Dify workflows and n8n automations to ToRouter via their OpenAI-compatible provider slots.

Rate-limited — what to do

Three different things produce a 429 from ToRouter. Here is how to tell them apart and fix each one.

Table of Contents

Response shapeMost common causesNext steps