9Router: One Endpoint, 60+ AI Providers, Zero Downtime
If you use multiple AI coding tools like Claude Code, OpenAI Codex, or Cursor, you have probably hit the same wall. Your Claude subscription runs out mid-task. You switch to Codex. That runs out too. You spend more time managing API keys than actually building.
9Router solves this entirely. It is a free, open-source smart gateway that sits between your tools and 60+ AI providers. It automatically switches between them when a quota runs out. This happens with zero interruption to your workflow.
What is 9Router?
9Router is a local proxy server you install once on your machine. It exposes a single OpenAI-compatible endpoint at localhost:20128. Every AI tool you use points to this one address. This includes Claude Code, Codex CLI, Cursor, Cline, and Continue.
Behind the scenes, 9Router routes your requests through a smart 3-tier fallback system:
- Tier 1 (Subscription): Your premium subscriptions go first. Examples are Claude Code, Codex, GitHub Copilot, Gemini CLI, and Cursor IDE.
- Tier 2 (Cheap API): If Tier 1 is exhausted, it falls back to affordable pay-per-use providers. Examples are GLM Coding at $0.60, MiniMax at $0.20, and Kimi at $9/month.
- Tier 3 (FREE): When Tier 2 is also out, it falls back to completely free providers. These include iFlow, Qwen, Kiro AI, OpenCode Free, OpenRouter free tier, NVIDIA NIM, Gemini free, and Cloudflare AI.
The result is you never stop coding. The switch happens automatically in milliseconds. You do not need to intervene manually.
1. Installation
9Router requires Node.js. If you already have it, the install is a single command:
npm install -g 9router
After installation, run the router with this command:
9router
Your browser will open a local dashboard automatically at localhost:20128. This is where you connect your AI providers. Depending on the provider, you authenticate via OAuth (for subscriptions like Claude Code or Copilot) or by pasting an API key.
2. Connecting Your Tools
Once 9Router is running, you need to point each of your AI tools to http://localhost:20128. Here is how to do it for the most common tools:
Claude Code CLI: Set the ANTHROPIC_BASE_URL environment variable.
ANTHROPIC_BASE_URL=http://localhost:20128 claude
OpenAI Codex CLI: Set the base URL in your Codex config or environment.
OPENAI_BASE_URL=http://localhost:20128 codex
Cursor IDE: Go to Settings, then Models, and add a custom model with base URL http://localhost:20128.
Cline, Continue, Roo, or Kilo Code: In the extension settings, change the OpenAI base URL to http://localhost:20128. Each of these VS Code extensions has a dedicated field for custom base URLs.
The 9Router dashboard includes step-by-step setup guides for all supported tools. You do not need to memorize any of this.
3. Using the Dashboard
The dashboard is where all the power lives. It gives you several features:
- Live quota tracking: See how many tokens remain per provider. It includes a reset countdown timer and cost estimation.
- Smart Combos: Chain multiple providers into one virtual provider. It uses sticky round-robin and automatic fallback between them.
- Multi-account support: Add multiple accounts for the same provider. 9Router will load-balance between them to effectively multiply your monthly quota.
- Format Translator: Convert between OpenAI, Anthropic, and Gemini API formats on the fly. Any tool will work with any provider regardless of their native format.
- Cloud Sync and Tunnel: Sync your router config to Cloudflare's edge network. This makes your 9Router accessible from anywhere across 300+ global locations.
4. Built-in Token Savings
9Router ships with two features that quietly save you tokens on every request. This happens without changing the quality of the AI output:
RTK Token Saver (Input, save 20 to 40%): It automatically compresses tool result content like git diffs, grep output, file trees, and directory listings before they reach the AI model. The compression is lossless. The AI sees all the same information in a more compact form. This is enabled by default and requires no configuration.
Caveman Mode (Output, save 65%): It injects a terse-style system prompt that tells the AI to reply in a compact and telegraphic style. The technical accuracy is the same, but the response is stripped of unnecessary verbosity. There are five intensity levels you can tune from the dashboard.
Combined with free-tier providers, these two features mean you can route most of your AI coding workflow for exactly $0 per month.
Tips & Tricks
- Build a free fallback chain first. Before adding paid providers, connect all the free ones like iFlow, Qwen, Kiro AI, OpenCode Free, and Cloudflare AI. This gives you a solid floor that costs nothing.
- Use Combos for long coding sessions. Create a Combo that chains all your providers in priority order. 9Router burns through each tier automatically as you code, so there is no manual switching.
- Leave RTK on, tune Caveman per-task. RTK compression is always safe to leave enabled. For Caveman Mode, use a lower intensity for exploratory conversations and a higher intensity for quick code edits.
- Add multiple accounts for Claude. If you have both a personal and a work Claude subscription, add both under Multi-Account. 9Router round-robins between them to double your available monthly quota.
- Keep the router running in the background. Run 9Router as a background process or add it to your system startup. All your tools will always find
localhost:20128without you needing to start it manually each session.
9Router is one of those tools that changes how you think about AI tool costs. Instead of worrying about which subscription to use or rationing your Claude quota for important tasks, you just code. The router handles everything. For a tool that is completely free and open-source, the value it delivers is remarkable. You can find it at 9router.com.