~/tools/9router
9Router
tool

9Router

9Router is an open source AI routing proxy you self-host — an OpenRouter alternative that connects Claude Code, Cursor, and other coding tools to 40+ providers through one endpoint, with automatic fallbacks and token compression.

What is 9Router?

9Router is an open source AI routing proxy that sits between your AI coding tools and 40+ LLM providers, exposing them through a single OpenAI-compatible endpoint at localhost:20128/v1. It routes requests across providers, falls back automatically when one runs out of quota, and compresses tool output to cut token costs.

What is 9Router best for?

Developers who lean on AI coding tools — Claude Code, Cursor, Cline, Codex, Copilot — and keep hitting rate limits or quota caps mid-session. 9Router chains providers so coding never stalls, and because you run it yourself with your own keys, your requests stay on your infrastructure and you pay providers directly with no markup.

What can 9Router do?

  • Expose 40+ providers and 100+ models through one OpenAI-compatible endpoint
  • Cascade a 3-tier fallback chain: subscription providers → cheap APIs → free tiers
  • Compress git diff, grep, and log output with RTK token-saving to cut input tokens 20–40%
  • Translate message formats between OpenAI, Claude, and Gemini automatically
  • Load-balance across multiple accounts per provider with auto OAuth token refresh
  • Track live quota, token counts, and reset countdowns in a dashboard
  • Log full requests and responses for debugging

Where does 9Router fall short?

  • It targets AI coding CLIs and agents specifically — it is not a general-purpose gateway with the caching, guardrails, or team analytics that products like Cloudflare AI Gateway build in.
  • The dashboard’s cost figures are estimates for comparison, not real billing — actual spend still lives with each upstream provider, so you reconcile costs across several accounts rather than one invoice.
  • Free-tier routing depends on third-party offers that change often; the project’s own docs note several free providers (Gemini CLI, Qwen Code, iFlow) were discontinued in 2026, so a zero-cost setup can break without warning.

Is 9Router free?

Yes — 9Router is fully free and open source under the MIT license, with commercial use permitted. You bring your own provider API keys and subscriptions and pay those providers directly; 9Router itself adds no fee or markup. Your only cost is the machine you run it on.

What does 9Router replace?

9Router is a self-hosted alternative to OpenRouter and Cloudflare AI Gateway. It does the same route-across-providers job through one endpoint, but you keep your own keys, your requests never leave your infrastructure, and there is no per-token platform fee.

FAQ

Is 9Router open source? Yes. It is released under the MIT license — fully open source, with commercial use allowed.

Can I self-host 9Router for free? Yes. It is self-hosted only and free to run — install it with npm install -g 9router or deploy the Docker image; you pay only for your server and the upstream providers you use.

Is 9Router a good OpenRouter alternative? For developers who want to keep their own provider keys and avoid a per-token markup, yes. Unlike OpenRouter’s hosted marketplace, 9Router runs on your own infrastructure and adds no platform fee — the tradeoff is that you manage the setup and provider accounts yourself.

What do I need to run 9Router? Node.js 20+ or a Docker environment, roughly 100MB of disk for its SQLite database, and network access to the provider APIs. It stores all configuration and usage data in SQLite, so there is no separate database to run.