Use Claude, Codex, Gemini for FREE β’ Ultra-cheap alternatives from $0.20/1M tokens
π Quick Start β’ π° Pricing β’ π Setup β’ π Website
Stop wasting your AI subscriptions and paying full price:
- β Subscription quota expires unused every month
- β Rate limits stop you mid-coding
- β Expensive APIs ($20-50/month per provider)
- β Manual switching between providers
9Router maximizes value:
- β Maximize Subscriptions - Claude Code, Codex, Gemini, Copilot quota tracking
- β FREE Available - iFlow, Qwen, Kiro when needed, via CLI
- β Ultra-Cheap Backup - GLM ($0.6/1M), MiniMax M2.1 ($0.20/1M)
- β Smart Fallback - Subscription β Cheap β Free, automatic switching
Install globally:
npm install -g 9router
9routerπ Dashboard opens β Connect Claude Code β Start coding!
Use in Cursor/Cline:
Endpoint: http://localhost:20128/v1
API Key: [from dashboard]
Model: cc/claude-opus-4-5-20251101
Already paying? Get full value with quota tracking:
| Provider | What You Get | Quota Reset | Monthly Cost |
|---|---|---|---|
| Claude Code (Pro/Max) | Claude 4.5 Opus/Sonnet/Haiku | 5-hour + Weekly | $20-100 |
| OpenAI Codex (Plus/Pro) | GPT 5.2 Codex, GPT 5.1 Codex Max | 5-hour + Weekly | $20-200 |
| Gemini CLI (FREE tier!) | 180K completions/month, 1K/day | Daily/Monthly | $0 |
| GitHub Copilot | GPT-5, Claude 4.5, Gemini 3 | Monthly (1st) | $10-19 |
| Antigravity (Google) | Gemini 3 Pro, Claude Sonnet 4.5 | Similar to Gemini | $0 |
Value: Use every bit of your subscription quota before it resets!
When subscription quota runs out, pay pennies:
| Provider | Pricing (per 1M tokens) | Quota Reset | Cost for 10M |
|---|---|---|---|
| GLM-4.7 | $0.60 input / $2.20 output | Daily 10:00 AM | ~$6-22 |
| MiniMax M2.1 | $0.20 input / $1.00 output | 5-hour rolling | ~$2-10 |
| Kimi K2 | $9/month (10M tokens) | Monthly | $9 flat |
Value: ~90% cheaper than ChatGPT API ($20/1M)!
No API key needed, unlimited:
| Provider | Top Models | Notes |
|---|---|---|
| iFlow | Kimi K2, Qwen3 Coder Plus, GLM 4.7, MiniMax M2 | 8 models via OAuth |
| Qwen | Qwen3 Coder Plus/Flash, Vision | 3 models via OAuth |
| Kiro | Claude Sonnet 4.5, Haiku 4.5 | AWS Builder ID |
Value: Emergency backup when everything else is quota-limited!
Setup once, never stop coding:
Tier 1 (SUBSCRIPTION): Claude Code β Codex β Gemini
β quota exhausted
Tier 2 (CHEAP): GLM-4.7 β MiniMax M2.1 β Kimi
β budget limit
Tier 3 (FREE): iFlow β Qwen β Kiro
β Automatic switching, zero downtime!
- Real-time token consumption
- Reset countdown per provider
- Cost estimation (paid tiers)
- Monthly spending reports
β Cursor β’ Cline β’ Claude Desktop β’ Codex β’ RooCode β’ Continue β’ Any tool with custom OpenAI endpoint
π» Localhost β’ βοΈ VPS/Cloud β’ π³ Docker β’ π Cloudflare Workers
Subscription Providers (Maximize Value)
Dashboard β Providers β Connect Claude Code
β OAuth login β Auto token refresh
β 5-hour + weekly quota tracking
Use: cc/claude-opus-4-5-20251101
cc/claude-sonnet-4-5-20250929Pro Tip: Use Opus for complex tasks, Sonnet for speed. 9Router tracks quota per model!
Dashboard β Providers β Connect Codex
β OAuth login (port 1455)
β 5-hour + weekly reset
Use: cx/gpt-5.2-codex
cx/gpt-5.1-codex-maxDashboard β Providers β Connect Gemini CLI
β Google OAuth
β 180K completions/month + 1K/day
Use: gc/gemini-3-flash-preview
gc/gemini-2.5-proBest Value: Huge free tier! Use this before paid tiers.
Dashboard β Providers β Connect GitHub
β OAuth via GitHub
β Monthly reset (1st of month)
Use: gh/gpt-5
gh/claude-4.5-sonnetCheap Providers (Backup)
- Sign up: Zhipu AI
- Get API key from Coding Plan
- Dashboard β Add API Key:
- Provider:
glm - API Key:
your-key
- Provider:
Use: glm/glm-4.7
Pro Tip: Coding Plan offers 3Γ quota at 1/7 cost! Reset daily 10:00 AM.
- Sign up: MiniMax
- Get API key
- Dashboard β Add API Key:
- Provider:
minimax - API Key:
your-key
- Provider:
Use: minimax/MiniMax-M2.1
Pro Tip: 5-hour rolling window. Cheapest option for long context (1M tokens)!
- Subscribe: Moonshot AI
- Get API key
- Dashboard β Add API Key:
- Provider:
kimi - API Key:
your-key
- Provider:
Use: kimi/kimi-latest
Pro Tip: Fixed $9/month for 10M tokens = $0.90/1M effective cost!
FREE Providers (Emergency Backup)
Dashboard β Connect iFlow
β iFlow OAuth login
β Unlimited usage
Use: if/kimi-k2-thinking
if/qwen3-coder-plus
if/glm-4.7
if/minimax-m2Dashboard β Connect Qwen
β Device code authorization
β Unlimited usage
Use: qw/qwen3-coder-plus
qw/qwen3-coder-flashDashboard β Connect Kiro
β AWS Builder ID or Google/GitHub
β Unlimited usage
Use: kr/claude-sonnet-4.5
kr/claude-haiku-4.5Combo Examples
Dashboard β Combos β Create New
Name: premium-coding
Models:
1. cc/claude-opus-4-5-20251101 (Subscription primary)
2. glm/glm-4.7 (Cheap backup, $0.6/1M)
3. minimax/MiniMax-M2.1 (Cheapest fallback, $0.20/1M)
Use in CLI: premium-coding
Monthly cost example (100M tokens):
80M via Claude (subscription): $0 extra
15M via GLM: $9
5M via MiniMax: $1
Total: $10 + your subscription
Name: budget-combo
Models:
1. glm/glm-4.7 (Daily quota, cheap)
2. minimax/MiniMax-M2.1 (5h quota, cheapest)
3. if/kimi-k2-thinking (FREE unlimited)
Monthly cost (100M tokens):
70M via GLM: $42
20M via MiniMax: $4
10M via iFlow: $0
Total: ~$46 vs $2000 on ChatGPT API!
Name: free-combo
Models:
1. if/kimi-k2-thinking
2. qw/qwen3-coder-plus
3. kr/claude-sonnet-4.5
Cost: $0 forever!
CLI Integration
Settings β Models β Advanced:
OpenAI API Base URL: http://localhost:20128/v1
OpenAI API Key: [from 9router dashboard]
Model: cc/claude-opus-4-5-20251101
Or use combo: premium-coding
Edit ~/.claude/config.json:
{
"anthropic_api_base": "http://localhost:20128/v1",
"anthropic_api_key": "your-9router-api-key"
}Models: cc/claude-opus-4-5, glm/glm-4.7, or combo name
export OPENAI_BASE_URL="http://localhost:20128"
export OPENAI_API_KEY="your-9router-api-key"
codex "your prompt"Models: cx/gpt-5.2-codex, glm/glm-4.7, or combo
Provider: OpenAI Compatible
Base URL: http://localhost:20128/v1
API Key: [from dashboard]
Model: cc/claude-opus-4-5-20251101
Deployment
# Clone and install
git clone https://github.com/decolua/9router.git
cd 9router/app
npm install
npm run build
# Configure
export JWT_SECRET="your-secure-secret-change-this"
export INITIAL_PASSWORD="your-password"
export DATA_DIR="/var/lib/9router"
export NODE_ENV="production"
# Start
npm run start
# Or use PM2
npm install -g pm2
pm2 start npm --name 9router -- start
pm2 save
pm2 startupdocker build -t 9router .
docker run -d \
-p 3000:3000 \
-e JWT_SECRET="your-secure-secret" \
-e INITIAL_PASSWORD="your-password" \
-v 9router-data:/app/data \
9router| Variable | Default | Description |
|---|---|---|
JWT_SECRET |
Auto-generated | MUST change in production! |
DATA_DIR |
~/.9router |
Database storage path |
INITIAL_PASSWORD |
123456 |
Dashboard login password |
NODE_ENV |
development |
Set to production for deploy |
ENABLE_REQUEST_LOGS |
false |
Debug request/response logs |
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
# SSE support
proxy_buffering off;
proxy_read_timeout 86400;
}
}Strategy:
1. Use Gemini CLI free tier (180K/month) for quick tasks
2. Use Claude Code subscription quota fully (you already pay)
3. Fallback to GLM ($0.6/1M) when quota out
4. Emergency: MiniMax M2.1 ($0.20/1M) or iFlow (free)
Real example (100M tokens/month):
60M via Gemini CLI: $0 (free tier)
30M via Claude Code: $0 (subscription you already have)
8M via GLM: $4.80
2M via MiniMax: $0.40
Total: $5.20/month + existing subscriptions
Daily routine:
1. Morning: Fresh Claude Code quota (5h reset)
2. Afternoon: Switch to Gemini CLI (1K/day)
3. Evening: GLM daily quota (reset 10AM next day)
4. Late night: MiniMax (5h rolling) or iFlow (free)
β Code 24/7 with minimal extra cost!
| Task | Best Model | Cost | Why |
|---|---|---|---|
| Complex reasoning | cc/claude-opus-4-5 |
Subscription | Best quality |
| Fast coding | cx/gpt-5.2-codex |
Subscription | Fastest Codex |
| Budget coding | glm/glm-4.7 |
$0.6/1M | Daily quota |
| Long context | minimax/MiniMax-M2.1 |
$0.20/1M | 1M context cheap |
| Emergency backup | if/kimi-k2-thinking |
FREE | Unlimited |
Subscription Models (Maximize First)
Claude Code (cc/) - Pro/Max:
cc/claude-opus-4-5-20251101- Claude 4.5 Opuscc/claude-sonnet-4-5-20250929- Claude 4.5 Sonnetcc/claude-haiku-4-5-20251001- Claude 4.5 Haiku
Codex (cx/) - Plus/Pro:
cx/gpt-5.2-codex- GPT 5.2 Codexcx/gpt-5.2- GPT 5.2cx/gpt-5.1-codex-max- GPT 5.1 Codex Maxcx/gpt-5.1-codex- GPT 5.1 Codex
Gemini CLI (gc/) - FREE 180K/month:
gc/gemini-3-flash-preview- Gemini 3 Flash Previewgc/gemini-3-pro-preview- Gemini 3 Pro Previewgc/gemini-2.5-pro- Gemini 2.5 Progc/gemini-2.5-flash- Gemini 2.5 Flash
GitHub Copilot (gh/) - Subscription:
gh/gpt-5- GPT-5gh/gpt-5.1-codex-max- GPT-5.1 Codex Maxgh/claude-4.5-sonnet- Claude 4.5 Sonnetgh/gemini-3-pro- Gemini 3 Pro
Antigravity (ag/) - Google account:
ag/gemini-3-pro-high- Gemini 3 Pro Highag/claude-sonnet-4-5- Claude Sonnet 4.5ag/claude-opus-4-5-thinking- Claude Opus 4.5
Cheap Models (Backup)
GLM (glm/) - $0.6/$2.2 per 1M:
glm/glm-4.7- GLM 4.7 (daily reset 10AM)glm/glm-4.6v- GLM 4.6V Vision
MiniMax (minimax/) - $0.20/$1.00 per 1M:
minimax/MiniMax-M2.1- MiniMax M2.1 (5h reset)
Kimi (kimi/) - $9/month (10M tokens):
kimi/kimi-latest- Kimi Latest
OpenRouter (openrouter/) - Passthrough pricing:
openrouter/auto- Auto (Best Available)- Any OpenRouter model ID supported
FREE Models (Emergency)
iFlow (if/) - 8 models FREE:
if/kimi-k2-thinking- Kimi K2 Thinkingif/kimi-k2- Kimi K2if/qwen3-coder-plus- Qwen3 Coder Plusif/glm-4.7- GLM 4.7if/minimax-m2- MiniMax M2if/deepseek-r1- DeepSeek R1if/deepseek-v3.2-chat- DeepSeek V3.2 Chatif/deepseek-v3.2-reasoner- DeepSeek V3.2 Reasoner
Qwen (qw/) - 3 models FREE:
qw/qwen3-coder-plus- Qwen3 Coder Plusqw/qwen3-coder-flash- Qwen3 Coder Flashqw/vision-model- Qwen3 Vision
Kiro (kr/) - 2 models FREE:
kr/claude-sonnet-4.5- Claude Sonnet 4.5kr/claude-haiku-4.5- Claude Haiku 4.5
"Language model did not provide messages"
- Provider quota exhausted β Check dashboard quota tracker
- Solution: Use combo fallback or switch to cheaper tier
Rate limiting
- Subscription quota out β Fallback to GLM/MiniMax
- Add combo:
cc/claude-opus β glm/glm-4.7 β minimax/MiniMax-M2.1
OAuth token expired
- Auto-refreshed by 9Router
- If issues persist: Dashboard β Provider β Reconnect
High costs
- Check usage stats in Dashboard
- Switch primary model to GLM/MiniMax
- Use free tier (Gemini CLI, iFlow) for non-critical tasks
- Runtime: Node.js 20+
- Framework: Next.js 15
- UI: React 19 + Tailwind CSS 4
- Database: LowDB (JSON file-based)
- Streaming: Server-Sent Events (SSE)
- Auth: OAuth 2.0 (PKCE) + JWT + API Keys
POST http://localhost:20128/v1/chat/completions
Authorization: Bearer your-api-key
Content-Type: application/json
{
"model": "cc/claude-opus-4-5-20251101",
"messages": [
{"role": "user", "content": "Write a function to..."}
],
"stream": true
}GET http://localhost:20128/v1/models
Authorization: Bearer your-api-key
β Returns all models + combos in OpenAI formatPOST http://localhost:20128/v1/responses
POST http://localhost:20128/codex/responses- Fork β Branch β Commit β Push β PR
- See CONTRIBUTING.md
- Website: 9router.com
- GitHub: github.com/decolua/9router
- Issues: github.com/decolua/9router/issues
Special thanks to CLIProxyAPI - the original Go implementation that inspired this JavaScript port.
MIT License - see LICENSE for details.