AI coding tools have become an essential part of every developer's workflow. But there's a growing problem: the cost adds up fast. Between subscriptions for Claude Code, Codex, Cursor, and other AI assistants, you can easily spend hundreds of dollars a monthβand that's before hitting usage limits that leave you staring at a "quota exceeded" screen mid-flow.
Enter 9Router, an open-source smart proxy that intelligently routes your AI coding requests across 40+ backend providers, ensuring you never stop coding while keeping costs to a minimum.
What is 9Router?
9Router is a smart API router and reverse proxy created by decolua. It sits between your AI coding toolsβClaude Code, Codex, Cursor, Cline, Copilotβand the LLM providers that power them.
Instead of being locked into a single expensive subscription, 9Router acts as a traffic controller for your AI requests. It compresses tokens, translates between different API formats (OpenAI β Claude β Gemini), and automatically falls back to alternative providers when your primary one hits its limit.
Think of it as a load balancer for your AI coding workflowβone that's smart enough to always find the cheapest, fastest path for your requests.
Key Features
RTK Token Saver π°
9Router includes built-in lossless compression for common tool outputs like git diff, grep, ls, and tree. This alone saves 20β40% on token usage per request without losing any meaningful information. Less tokens = less cost = more coding.
Smart 3-Tier Fallback π
This is where 9Router truly shines. When your primary provider runs out of quota, 9Router automatically routes requests to the next available tierβzero downtime, zero manual switching:
- Tier 1 β Subscription: Your existing Claude Code, Codex, or Copilot subscriptions.
- Tier 2 β Cheap: Budget-friendly API providers like GLM-5.1 ($0.6/1M tokens) or MiniMax M2.7 ($0.2/1M tokens).
- Tier 3 β Free: Free-tier providers like Kiro AI, OpenCode Free, or Vertex AI ($300 GCP credits).
Format Translation π
Different AI tools speak different API languages. 9Router translates between formats seamlessly:
- OpenAI β Claude β Gemini β Cursor β Kiro β Vertex
You point your tool at 9Router, and it handles the rest.
Real-Time Quota Tracking π
9Router provides live token counting with reset countdowns, so you always know exactly how much quota you have left across all your providers. No more surprise "limit reached" errors.
Caveman & Ponytail Modes π¦΄
Two optional prompt injection modes that further reduce output tokens:
- Caveman Mode: Injects a terse prompt style that cuts output tokens by up to 65%.
- Ponytail Mode: Injects a "lazy senior dev" prompt for minimal, YAGNI-first code generation.
Multi-Account & Cloud Sync βοΈ
Set up round-robin load balancing across multiple accounts per provider, and sync your configuration across devices with built-in cloud sync.
How It Works
The architecture is straightforward but powerful:
1ββββββββββββββββββββββββββββββββββββββββββββ
2β Your AI Coding Tools β
3β Claude Code Β· Codex Β· Cursor Β· Cline β
4ββββββββββββββββββ¬ββββββββββββββββββββββββββ
5 β http://localhost:20128/v1
6 βΌ
7ββββββββββββββββββββββββββββββββββββββββββββ
8β 9Router (Smart Router) β
9β β’ RTK Token Saver (compress outputs) β
10β β’ Format Translation (OpenAI β Claude) β
11β β’ Quota Tracking & Auto Token Refresh β
12ββββββββββ¬βββββββββββββ¬ββββββββββββ¬βββββββββ
13 β β β
14 ββββββΌβββββ ββββββΌβββββ ββββΌββββββ
15 β Tier 1 β β Tier 2 β β Tier 3 β
16 β Sub β β Cheap β β Free β
17 β Claude β β GLM β β Kiro β
18 β Codex β β MiniMax β βVertex β
19 β Copilot β β Kimi β βOpenCodeβ
20 βββββββββββ βββββββββββ ββββββββββWhen Tier 1 quota is exhausted, 9Router automatically cascades to Tier 2, then Tier 3βkeeping your coding session alive without any interruption.
Getting Started
Setting up 9Router takes just a few minutes. Choose the method that works best for you:
Method 1: npm (Recommended)
1npm install -g 9router
29routerThe dashboard opens at http://localhost:20128.
Method 2: Docker
1docker run -d \
2 --name 9router \
3 -p 20128:20128 \
4 -v "$HOME/.9router:/app/data" \
5 -e DATA_DIR=/app/data \
6 decolua/9router:latestMethod 3: From Source
1git clone https://github.com/decolua/9router.git
2cd 9router
3cp .env.example .env
4npm install
5PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run devPost-Installation
- Open the dashboard at
http://localhost:20128. - Connect a provider (Kiro AI is recommended to startβit's free and requires no signup).
- Configure your CLI tool's API endpoint to
http://localhost:20128/v1. - Set the API key from the dashboard.
- Select a model (e.g.,
kr/claude-sonnet-4.5).
That's itβyour AI coding tools are now routing through 9Router.
Supported Providers
9Router supports 40+ backend providers across multiple categories:
- OAuth/Subscription: Claude Code (Pro/Max), Codex (Plus/Pro), GitHub Copilot, Cursor, Antigravity
- Free Tier: Kiro AI (Claude 4.5, GLM-5, MiniMax β unlimited), OpenCode Free (no auth required), Vertex AI ($300 GCP credits)
- Cheap API: GLM-5.1 ($0.6/1M tokens), MiniMax M2.7 ($0.2/1M tokens), Kimi K2.5 ($9/month flat)
- API Key Providers: OpenAI, Anthropic, Gemini, DeepSeek, Groq, xAI, Mistral, Perplexity, Together AI, Fireworks, Cerebras, Cohere, NVIDIA, SiliconFlow, Nebius, Hyperbolic, and custom OpenAI/Anthropic-compatible endpoints
Why It Matters
The AI coding tool landscape is fragmented and expensive. Developers often juggle multiple subscriptions, hit arbitrary usage limits, and get locked into specific vendors. 9Router addresses all of these pain points:
- Cost Reduction: By compressing tokens and routing to free/cheap providers, 9Router can dramatically cut your AI coding expenses.
- Vendor Flexibility: No more being locked into a single provider. Switch, mix, and match providers freely.
- Zero Downtime: The automatic fallback system means your coding flow is never interrupted by quota limits.
- Open Source: MIT licensed, community-driven, and fully auditable. You own your routing layer.
With 18.8k stars on GitHub and active development, 9Router has quickly become one of the most popular tools in the AI-assisted development ecosystem. It's the missing infrastructure layer that makes AI coding tools sustainable for individual developers and teams alike.
If you're spending too much on AI coding tools or constantly hitting usage limits, check out the 9Router GitHub repository and start routing smarter today.