9Router is a local router for AI coding tools. It lets Claude Code, Codex, Cursor, Cline, Copilot, OpenCode, OpenClaw, and similar tools connect to one OpenAI-compatible endpoint, then routes requests to different models and providers.
It is not trying to be another chat client. It sits between your AI coding tools and model providers, solving a few practical problems: incompatible API formats, manual provider switching, fast token burn from tool output, interrupted work when quotas run out, and messy multi-account configuration.
According to the project README, 9Router supports 40+ providers and 100+ models. It includes RTK Token Saver, automatic fallback, quota tracking, multi-account rotation, format translation, and request logging. The project is written in JavaScript and uses Node.js, Next.js, React, Tailwind CSS, and LowDB. It is licensed under MIT.
What It Is Good For
9Router is most useful when you use multiple AI coding tools and multiple model sources at the same time.
Examples:
- Claude Code uses a subscription account.
- Codex or Cursor needs a custom OpenAI endpoint.
- Cline, Continue, or RooCode needs an OpenAI-compatible API.
- Free providers are used for experiments.
- GLM, MiniMax, or Kimi is used as a cheaper backup.
- High-quality models are reserved for difficult tasks.
Without 9Router, these settings are scattered across many tools. Each tool needs its own endpoint, API key, model name, and fallback plan. 9Router centralizes that into one local routing layer.
Default local API:
|
|
Dashboard:
|
|
Quick Install
For local use, npm is the simplest path:
|
|
The dashboard opens locally, and the README uses 20128 as the default port.
Run from source:
|
|
Production mode:
|
|
The npm package requires Node.js >=18.0.0. For VPS or Docker deployment, configure JWT_SECRET, INITIAL_PASSWORD, DATA_DIR, and API_KEY_SECRET instead of exposing defaults.
Connect Coding Tools
9Router exposes an OpenAI-compatible API, so most tools that support custom OpenAI endpoints can connect to it.
Typical configuration:
|
|
For Codex CLI:
|
|
For Cline, Continue, or RooCode, choose OpenAI Compatible and set:
|
|
Model names depend on connected providers. The README shows prefixes such as cc/, cx/, gh/, glm/, minimax/, kr/, and vertex/.
RTK Token Saver
AI coding tools often burn tokens fastest on tool outputs:
git diffgit statusgrepfindlstree- logs
- long file lists
9Router includes RTK Token Saver, which compresses these outputs before they are sent to the model. The project says this can save 20%-40% input tokens in many requests.
The value is that you do not need to change tools or models. The routing layer removes waste before the request reaches the provider. Still, for critical logs or complete file content, test the behavior first and make sure answer quality does not drop.
Automatic Fallback
9Router can arrange models in priority order:
|
|
When the first tier is rate-limited, out of quota, or failing, it can switch to the next one. This reduces manual switching and keeps coding sessions from stopping suddenly.
Example:
|
|
Fallback changes output consistency. Different models have different style and reasoning quality. For large refactors, protocols, migrations, or other consistency-sensitive work, prefer a fixed model and switch manually only when needed.
Be Careful with Free Providers
The README highlights Kiro, OpenCode Free, Vertex, and also notes that some old free tiers have changed or are no longer recommended.
Always confirm provider policy at the time of use:
- Is it really free?
- Is it region-limited?
- Is third-party tool access allowed?
- Can it trigger bans or rate limits?
- Does the free quota expire?
9Router manages routing, not upstream terms. Be especially careful when using personal subscriptions, OAuth tokens, or free quotas with automated tools.
Local Deployment Advice
For personal use, bind to localhost. Local tools can reach it, but the internet cannot.
For VPS or LAN deployment:
- Change the default login password.
- Set a strong
JWT_SECRET. - Set
API_KEY_SECRET. - Put authentication in front of the dashboard.
- Do not expose the dashboard directly to the public internet.
- Require Bearer API keys for
/v1/*. - Back up
DATA_DIR.
Docker example:
|
|
Start locally first, verify providers, combos, logs, and model names, then decide whether server deployment is worth it.
Who Should Use It
9Router is a good fit if you use multiple AI coding tools, multiple providers, subscription plus free or cheap tiers, and want a central fallback policy. It is less useful if you only use one model and one tool.
Its real value is turning scattered model access into a configurable local routing layer.
Summary
9Router is a local gateway for AI coding tools. It lets Claude Code, Codex, Cursor, Cline, and similar tools talk to http://localhost:20128/v1, while it handles model selection, format translation, token compression, quota tracking, and fallback.
It is best for heavy AI coding users who already switch between providers. Start with one tool and one provider, then add accounts and combos gradually.