9router/README.md

740 lines
17 KiB
Markdown
Raw Normal View History

2026-01-31 01:44:19 -05:00
<div align="center">
<img src="./images/9router.png" alt="9Router Dashboard" width="800"/>
2026-02-06 03:18:20 -05:00
# 9Router - Free AI Router
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
**Never stop coding. Auto-route to FREE & cheap AI models with smart fallback.**
2026-01-31 01:44:19 -05:00
2026-02-06 09:05:52 -05:00
**Free AI Provider for OpenClaw.**
<p align="center">
<img src="./public/providers/openclaw.png" alt="OpenClaw" width="80"/>
</p>
2026-01-31 01:44:19 -05:00
[![npm](https://img.shields.io/npm/v/9router.svg)](https://www.npmjs.com/package/9router)
[![Downloads](https://img.shields.io/npm/dm/9router.svg)](https://www.npmjs.com/package/9router)
[![License](https://img.shields.io/npm/l/9router.svg)](https://github.com/decolua/9router/blob/main/LICENSE)
2026-02-03 23:38:27 -05:00
[🚀 Quick Start](#-quick-start) • [💡 Features](#-key-features) • [📖 Setup](#-setup-guide) • [🌐 Website](https://9router.com)
2026-01-31 01:44:19 -05:00
</div>
---
2026-02-03 23:38:27 -05:00
## 🤔 Why 9Router?
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
**Stop wasting money and hitting limits:**
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- ❌ Subscription quota expires unused every month
- ❌ Rate limits stop you mid-coding
- ❌ Expensive APIs ($20-50/month per provider)
- ❌ Manual switching between providers
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
**9Router solves this:**
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- ✅ **Maximize subscriptions** - Track quota, use every bit before reset
- ✅ **Auto fallback** - Subscription → Cheap → Free, zero downtime
- ✅ **Multi-account** - Round-robin between accounts per provider
2026-02-06 03:18:20 -05:00
- ✅ **Universal** - Works with Claude Code, Codex, Gemini CLI, Cursor, Cline, any CLI tool
2026-01-31 01:44:19 -05:00
---
2026-02-03 23:38:27 -05:00
## 🔄 How It Works
```
2026-02-03 23:38:27 -05:00
┌─────────────┐
2026-02-06 09:05:52 -05:00
│ Your CLI │ (Claude Code, Codex, Gemini CLI, OpenClaw, Cursor, Cline...)
2026-02-03 23:38:27 -05:00
│ Tool │
└──────┬──────┘
│ http://localhost:20128/v1
↓
┌─────────────────────────────────────────┐
│ 9Router (Smart Router) │
│ • Format translation (OpenAI ↔ Claude) │
│ • Quota tracking │
│ • Auto token refresh │
└──────┬──────────────────────────────────┘
│
├─→ [Tier 1: SUBSCRIPTION] Claude Code, Codex, Gemini CLI
│ ↓ quota exhausted
├─→ [Tier 2: CHEAP] GLM ($0.6/1M), MiniMax ($0.2/1M)
│ ↓ budget limit
└─→ [Tier 3: FREE] iFlow, Qwen, Kiro (unlimited)
2026-02-03 23:38:27 -05:00
Result: Never stop coding, minimal cost
```
---
2026-01-31 01:44:19 -05:00
## ⚡ Quick Start
2026-02-03 23:38:27 -05:00
**1. Install globally:**
2026-01-04 21:58:59 -05:00
```bash
npm install -g 9router
9router
2026-01-31 01:44:19 -05:00
```
2026-02-03 23:38:27 -05:00
🎉 Dashboard opens at `http://localhost:20128`
**2. Connect a FREE provider (no signup needed):**
2026-02-06 09:05:52 -05:00
Dashboard → Providers → Connect **Claude Code** or **Antigravity** → OAuth login → Done!
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
**3. Use in your CLI tool:**
2026-01-31 01:44:19 -05:00
```
2026-02-06 09:05:52 -05:00
Claude Code/Codex/Gemini CLI/OpenClaw/Cursor/Cline Settings:
2026-02-03 23:38:27 -05:00
Endpoint: http://localhost:20128/v1
API Key: [copy from dashboard]
Model: if/kimi-k2-thinking
2026-01-31 01:44:19 -05:00
```
2026-02-03 23:38:27 -05:00
**That's it!** Start coding with FREE AI models.
2026-01-31 01:44:19 -05:00
---
2026-02-03 23:38:27 -05:00
## 💡 Key Features
| Feature | What It Does | Why It Matters |
|---------|--------------|----------------|
| 🎯 **Smart 3-Tier Fallback** | Auto-route: Subscription → Cheap → Free | Never stop coding, zero downtime |
| 📊 **Real-Time Quota Tracking** | Live token count + reset countdown | Maximize subscription value |
| 🔄 **Format Translation** | OpenAI ↔ Claude ↔ Gemini seamless | Works with any CLI tool |
| 👥 **Multi-Account Support** | Multiple accounts per provider | Load balancing + redundancy |
| 🔄 **Auto Token Refresh** | OAuth tokens refresh automatically | No manual re-login needed |
| 🎨 **Custom Combos** | Create unlimited model combinations | Tailor fallback to your needs |
| 📝 **Request Logging** | Debug mode with full request/response logs | Troubleshoot issues easily |
| 💾 **Cloud Sync** | Sync config across devices | Same setup everywhere |
| 📊 **Usage Analytics** | Track tokens, cost, trends over time | Optimize spending |
| 🌐 **Deploy Anywhere** | Localhost, VPS, Docker, Cloudflare Workers | Flexible deployment options |
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
<details>
<summary><b>📖 Feature Details</b></summary>
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 🎯 Smart 3-Tier Fallback
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
Create combos with automatic fallback:
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
```
Combo: "my-coding-stack"
2026-02-06 03:18:20 -05:00
1. cc/claude-opus-4-6 (your subscription)
2026-02-03 23:38:27 -05:00
2. glm/glm-4.7 (cheap backup, $0.6/1M)
3. if/kimi-k2-thinking (free fallback)
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
→ Auto switches when quota runs out or errors occur
```
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 📊 Real-Time Quota Tracking
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- Token consumption per provider
- Reset countdown (5-hour, daily, weekly)
- Cost estimation for paid tiers
- Monthly spending reports
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 🔄 Format Translation
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
Seamless translation between formats:
- **OpenAI** ↔ **Claude** ↔ **Gemini** ↔ **OpenAI Responses**
- Your CLI tool sends OpenAI format → 9Router translates → Provider receives native format
- Works with any tool that supports custom OpenAI endpoints
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 👥 Multi-Account Support
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- Add multiple accounts per provider
- Auto round-robin or priority-based routing
- Fallback to next account when one hits quota
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 🔄 Auto Token Refresh
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- OAuth tokens automatically refresh before expiration
- No manual re-authentication needed
- Seamless experience across all providers
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 🎨 Custom Combos
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- Create unlimited model combinations
- Mix subscription, cheap, and free tiers
- Name your combos for easy access
- Share combos across devices with Cloud Sync
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 📝 Request Logging
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- Enable debug mode for full request/response logs
- Track API calls, headers, and payloads
- Troubleshoot integration issues
- Export logs for analysis
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 💾 Cloud Sync
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- Sync providers, combos, and settings across devices
- Automatic background sync
- Secure encrypted storage
- Access your setup from anywhere
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 📊 Usage Analytics
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- Track token usage per provider and model
- Cost estimation and spending trends
- Monthly reports and insights
- Optimize your AI spending
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
### 🌐 Deploy Anywhere
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
- 💻 **Localhost** - Default, works offline
- ☁️ **VPS/Cloud** - Share across devices
- 🐳 **Docker** - One-command deployment
- 🚀 **Cloudflare Workers** - Global edge network
2026-01-31 01:44:19 -05:00
2026-02-03 23:38:27 -05:00
</details>
2026-01-31 01:44:19 -05:00
---
2026-02-03 23:38:27 -05:00
## 💰 Pricing at a Glance
2026-02-03 23:38:27 -05:00
| Tier | Provider | Cost | Quota Reset | Best For |
|------|----------|------|-------------|----------|
| **💳 SUBSCRIPTION** | Claude Code (Pro) | $20/mo | 5h + weekly | Already subscribed |
| | Codex (Plus/Pro) | $20-200/mo | 5h + weekly | OpenAI users |
| | Gemini CLI | **FREE** | 180K/mo + 1K/day | Everyone! |
| | GitHub Copilot | $10-19/mo | Monthly | GitHub users |
| **💰 CHEAP** | GLM-4.7 | $0.6/1M | Daily 10AM | Budget backup |
| | MiniMax M2.1 | $0.2/1M | 5-hour rolling | Cheapest option |
| | Kimi K2 | $9/mo flat | 10M tokens/mo | Predictable cost |
| **🆓 FREE** | iFlow | $0 | Unlimited | 8 models free |
| | Qwen | $0 | Unlimited | 3 models free |
| | Kiro | $0 | Unlimited | Claude free |
**💡 Pro Tip:** Start with Gemini CLI (180K free/month) + iFlow (unlimited free) combo = $0 cost!
---
2026-02-03 23:38:27 -05:00
## 🎯 Use Cases
2026-02-03 23:38:27 -05:00
### Case 1: "I have Claude Pro subscription"
**Problem:** Quota expires unused, rate limits during heavy coding
**Solution:**
```
Combo: "maximize-claude"
2026-02-06 03:18:20 -05:00
1. cc/claude-opus-4-6 (use subscription fully)
2026-02-03 23:38:27 -05:00
2. glm/glm-4.7 (cheap backup when quota out)
2026-02-06 03:18:20 -05:00
3. if/kimi-k2-thinking (free emergency fallback)
2026-02-03 23:38:27 -05:00
Monthly cost: $20 (subscription) + ~$5 (backup) = $25 total
vs. $20 + hitting limits = frustration
```
### Case 2: "I want zero cost"
**Problem:** Can't afford subscriptions, need reliable AI coding
**Solution:**
```
Combo: "free-forever"
1. gc/gemini-3-flash (180K free/month)
2. if/kimi-k2-thinking (unlimited free)
3. qw/qwen3-coder-plus (unlimited free)
Monthly cost: $0
Quality: Production-ready models
```
### Case 3: "I need 24/7 coding, no interruptions"
**Problem:** Deadlines, can't afford downtime
**Solution:**
```
Combo: "always-on"
2026-02-06 03:18:20 -05:00
1. cc/claude-opus-4-6 (best quality)
2026-02-03 23:38:27 -05:00
2. cx/gpt-5.2-codex (second subscription)
3. glm/glm-4.7 (cheap, resets daily)
4. minimax/MiniMax-M2.1 (cheapest, 5h reset)
5. if/kimi-k2-thinking (free unlimited)
Result: 5 layers of fallback = zero downtime
Monthly cost: $20-200 (subscriptions) + $10-20 (backup)
```
2026-02-06 09:05:52 -05:00
### Case 4: "I want FREE AI in OpenClaw"
**Problem:** Need AI assistant in messaging apps (WhatsApp, Telegram, Slack...), completely free
**Solution:**
```
Combo: "openclaw-free"
1. if/glm-4.7 (unlimited free)
2. if/minimax-m2.1 (unlimited free)
3. if/kimi-k2-thinking (unlimited free)
Monthly cost: $0
Access via: WhatsApp, Telegram, Slack, Discord, iMessage, Signal...
```
---
2026-01-31 01:44:19 -05:00
## 📖 Setup Guide
2026-01-31 01:44:19 -05:00
<details>
2026-02-03 23:38:27 -05:00
<summary><b>🔐 Subscription Providers (Maximize Value)</b></summary>
2026-01-31 01:44:19 -05:00
### Claude Code (Pro/Max)
```bash
Dashboard → Providers → Connect Claude Code
→ OAuth login → Auto token refresh
→ 5-hour + weekly quota tracking
2026-02-03 23:38:27 -05:00
Models:
2026-02-06 03:18:20 -05:00
cc/claude-opus-4-6
2026-02-03 23:38:27 -05:00
cc/claude-sonnet-4-5-20250929
cc/claude-haiku-4-5-20251001
2026-01-31 01:44:19 -05:00
```
**Pro Tip:** Use Opus for complex tasks, Sonnet for speed. 9Router tracks quota per model!
### OpenAI Codex (Plus/Pro)
```bash
Dashboard → Providers → Connect Codex
→ OAuth login (port 1455)
→ 5-hour + weekly reset
2026-02-03 23:38:27 -05:00
Models:
cx/gpt-5.2-codex
cx/gpt-5.1-codex-max
2026-01-04 21:58:59 -05:00
```
2026-01-31 01:44:19 -05:00
### Gemini CLI (FREE 180K/month!)
2026-01-04 21:58:59 -05:00
```bash
2026-01-31 01:44:19 -05:00
Dashboard → Providers → Connect Gemini CLI
→ Google OAuth
→ 180K completions/month + 1K/day
2026-02-03 23:38:27 -05:00
Models:
gc/gemini-3-flash-preview
gc/gemini-2.5-pro
2026-01-04 21:58:59 -05:00
```
2026-01-31 01:44:19 -05:00
**Best Value:** Huge free tier! Use this before paid tiers.
2026-01-04 21:58:59 -05:00
2026-01-31 01:44:19 -05:00
### GitHub Copilot
2026-01-31 01:44:19 -05:00
```bash
Dashboard → Providers → Connect GitHub
→ OAuth via GitHub
→ Monthly reset (1st of month)
2026-02-03 23:38:27 -05:00
Models:
gh/gpt-5
gh/claude-4.5-sonnet
gh/gemini-3-pro
2026-01-31 01:44:19 -05:00
```
</details>
<details>
2026-02-03 23:38:27 -05:00
<summary><b>💰 Cheap Providers (Backup)</b></summary>
2026-01-31 01:44:19 -05:00
### GLM-4.7 (Daily reset, $0.6/1M)
1. Sign up: [Zhipu AI](https://open.bigmodel.cn/)
2. Get API key from Coding Plan
3. Dashboard → Add API Key:
- Provider: `glm`
- API Key: `your-key`
**Use:** `glm/glm-4.7`
**Pro Tip:** Coding Plan offers 3× quota at 1/7 cost! Reset daily 10:00 AM.
### MiniMax M2.1 (5h reset, $0.20/1M)
1. Sign up: [MiniMax](https://www.minimax.io/)
2. Get API key
2026-02-03 23:38:27 -05:00
3. Dashboard → Add API Key
2026-01-31 01:44:19 -05:00
**Use:** `minimax/MiniMax-M2.1`
2026-02-03 23:38:27 -05:00
**Pro Tip:** Cheapest option for long context (1M tokens)!
2026-01-31 01:44:19 -05:00
### Kimi K2 ($9/month flat)
2026-01-31 01:44:19 -05:00
1. Subscribe: [Moonshot AI](https://platform.moonshot.ai/)
2. Get API key
2026-02-03 23:38:27 -05:00
3. Dashboard → Add API Key
2026-01-31 01:44:19 -05:00
**Use:** `kimi/kimi-latest`
**Pro Tip:** Fixed $9/month for 10M tokens = $0.90/1M effective cost!
</details>
<details>
2026-02-03 23:38:27 -05:00
<summary><b>🆓 FREE Providers (Emergency Backup)</b></summary>
2026-01-31 01:44:19 -05:00
### iFlow (8 FREE models)
```bash
Dashboard → Connect iFlow
→ iFlow OAuth login
→ Unlimited usage
2026-02-03 23:38:27 -05:00
Models:
if/kimi-k2-thinking
if/qwen3-coder-plus
if/glm-4.7
if/minimax-m2
if/deepseek-r1
```
2026-01-31 01:44:19 -05:00
### Qwen (3 FREE models)
2026-01-31 01:44:19 -05:00
```bash
Dashboard → Connect Qwen
→ Device code authorization
→ Unlimited usage
2026-02-03 23:38:27 -05:00
Models:
qw/qwen3-coder-plus
qw/qwen3-coder-flash
2026-01-31 01:44:19 -05:00
```
### Kiro (Claude FREE)
```bash
2026-01-31 01:44:19 -05:00
Dashboard → Connect Kiro
→ AWS Builder ID or Google/GitHub
→ Unlimited usage
2026-02-03 23:38:27 -05:00
Models:
kr/claude-sonnet-4.5
kr/claude-haiku-4.5
2026-01-31 01:44:19 -05:00
```
2026-01-31 01:44:19 -05:00
</details>
2026-01-31 01:44:19 -05:00
<details>
2026-02-03 23:38:27 -05:00
<summary><b>🎨 Create Combos</b></summary>
2026-01-31 01:44:19 -05:00
### Example 1: Maximize Subscription → Cheap Backup
```
Dashboard → Combos → Create New
Name: premium-coding
Models:
2026-02-06 03:18:20 -05:00
1. cc/claude-opus-4-6 (Subscription primary)
2026-01-31 01:44:19 -05:00
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
```
2026-02-03 23:38:27 -05:00
### Example 2: Free-Only (Zero Cost)
```
2026-01-31 01:44:19 -05:00
Name: free-combo
Models:
2026-02-03 23:38:27 -05:00
1. gc/gemini-3-flash-preview (180K free/month)
2. if/kimi-k2-thinking (unlimited)
3. qw/qwen3-coder-plus (unlimited)
2026-01-31 01:44:19 -05:00
Cost: $0 forever!
```
2026-01-31 01:44:19 -05:00
</details>
2026-01-31 01:44:19 -05:00
<details>
2026-02-03 23:38:27 -05:00
<summary><b>🔧 CLI Integration</b></summary>
2026-01-31 01:44:19 -05:00
### Cursor IDE
2026-01-31 01:44:19 -05:00
```
Settings → Models → Advanced:
OpenAI API Base URL: http://localhost:20128/v1
OpenAI API Key: [from 9router dashboard]
2026-02-06 03:18:20 -05:00
Model: cc/claude-opus-4-6
2026-01-31 01:44:19 -05:00
```
2026-01-31 01:44:19 -05:00
Or use combo: `premium-coding`
2026-02-06 09:05:52 -05:00
### Claude Code
2026-01-31 01:44:19 -05:00
Edit `~/.claude/config.json`:
2026-01-31 01:44:19 -05:00
```json
{
"anthropic_api_base": "http://localhost:20128/v1",
"anthropic_api_key": "your-9router-api-key"
}
```
2026-01-31 01:44:19 -05:00
### Codex CLI
```bash
export OPENAI_BASE_URL="http://localhost:20128"
export OPENAI_API_KEY="your-9router-api-key"
codex "your prompt"
```
2026-02-06 09:05:52 -05:00
### OpenClaw
Edit `~/.openclaw/openclaw.json`:
```json
{
"agents": {
"defaults": {
"model": {
"primary": "9router/if/glm-4.7"
}
}
},
"models": {
"providers": {
"9router": {
"baseUrl": "http://localhost:20128/v1",
"apiKey": "your-9router-api-key",
"api": "openai-completions",
"models": [
{
"id": "if/glm-4.7",
"name": "glm-4.7"
}
]
}
}
}
}
```
**Or use Dashboard:** CLI Tools → OpenClaw → Auto-config
2026-01-31 01:44:19 -05:00
### Cline / Continue / RooCode
```
Provider: OpenAI Compatible
Base URL: http://localhost:20128/v1
API Key: [from dashboard]
2026-02-06 03:18:20 -05:00
Model: cc/claude-opus-4-6
2026-01-31 01:44:19 -05:00
```
</details>
<details>
2026-02-03 23:38:27 -05:00
<summary><b>🚀 Deployment</b></summary>
2026-01-31 01:44:19 -05:00
### VPS Deployment
```bash
# 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 startup
```
### Docker
```bash
docker 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
```
2026-01-31 01:44:19 -05:00
### Environment Variables
| 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 |
2026-01-31 01:44:19 -05:00
</details>
2026-01-31 01:44:19 -05:00
---
## 📊 Available Models
2026-01-31 01:44:19 -05:00
<details>
2026-02-03 23:38:27 -05:00
<summary><b>View all available models</b></summary>
2026-01-31 01:44:19 -05:00
**Claude Code (`cc/`)** - Pro/Max:
2026-02-06 03:18:20 -05:00
- `cc/claude-opus-4-6`
2026-02-03 23:38:27 -05:00
- `cc/claude-sonnet-4-5-20250929`
- `cc/claude-haiku-4-5-20251001`
2026-01-31 01:44:19 -05:00
**Codex (`cx/`)** - Plus/Pro:
2026-02-03 23:38:27 -05:00
- `cx/gpt-5.2-codex`
- `cx/gpt-5.1-codex-max`
2026-02-03 23:38:27 -05:00
**Gemini CLI (`gc/`)** - FREE:
- `gc/gemini-3-flash-preview`
- `gc/gemini-2.5-pro`
2026-02-03 23:38:27 -05:00
**GitHub Copilot (`gh/`)**:
- `gh/gpt-5`
- `gh/claude-4.5-sonnet`
2026-02-03 23:38:27 -05:00
**GLM (`glm/`)** - $0.6/1M:
- `glm/glm-4.7`
2026-01-04 21:58:59 -05:00
2026-02-03 23:38:27 -05:00
**MiniMax (`minimax/`)** - $0.2/1M:
- `minimax/MiniMax-M2.1`
2026-01-04 21:58:59 -05:00
2026-02-03 23:38:27 -05:00
**iFlow (`if/`)** - FREE:
- `if/kimi-k2-thinking`
- `if/qwen3-coder-plus`
- `if/deepseek-r1`
2026-01-04 21:58:59 -05:00
2026-02-03 23:38:27 -05:00
**Qwen (`qw/`)** - FREE:
- `qw/qwen3-coder-plus`
- `qw/qwen3-coder-flash`
2026-01-04 21:58:59 -05:00
2026-02-03 23:38:27 -05:00
**Kiro (`kr/`)** - FREE:
- `kr/claude-sonnet-4.5`
- `kr/claude-haiku-4.5`
2026-01-31 01:44:19 -05:00
</details>
---
## 🐛 Troubleshooting
**"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
2026-02-06 03:18:20 -05:00
- Add combo: `cc/claude-opus-4-6 → glm/glm-4.7 → if/kimi-k2-thinking`
2026-01-31 01:44:19 -05:00
**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
---
## 🛠️ Tech Stack
- **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
---
## 📝 API Reference
### Chat Completions
```bash
POST http://localhost:20128/v1/chat/completions
Authorization: Bearer your-api-key
Content-Type: application/json
{
2026-02-06 03:18:20 -05:00
"model": "cc/claude-opus-4-6",
2026-01-31 01:44:19 -05:00
"messages": [
{"role": "user", "content": "Write a function to..."}
],
"stream": true
}
2026-01-04 21:58:59 -05:00
```
2026-01-31 01:44:19 -05:00
### List Models
2026-01-04 21:58:59 -05:00
2026-01-31 01:44:19 -05:00
```bash
GET http://localhost:20128/v1/models
Authorization: Bearer your-api-key
2026-01-04 21:58:59 -05:00
2026-01-31 01:44:19 -05:00
→ Returns all models + combos in OpenAI format
```
2026-02-03 23:38:27 -05:00
---
2026-02-03 23:38:27 -05:00
## 📧 Support
- **Website**: [9router.com](https://9router.com)
- **GitHub**: [github.com/decolua/9router](https://github.com/decolua/9router)
- **Issues**: [github.com/decolua/9router/issues](https://github.com/decolua/9router/issues)
2026-01-31 01:44:19 -05:00
---
2026-02-06 03:18:20 -05:00
## 👥 Contributors
2026-02-06 03:18:20 -05:00
Thanks to all contributors who helped make 9Router better!
2026-02-06 03:18:20 -05:00
[![Contributors](https://contrib.rocks/image?repo=decolua/9router&max=100&columns=20&anon=1)](https://github.com/decolua/9router/graphs/contributors)
2026-02-06 03:18:20 -05:00
---
2026-02-06 03:18:20 -05:00
## 📊 Star Chart
2026-02-03 23:38:27 -05:00
2026-02-06 03:18:20 -05:00
[![Star Chart](https://starchart.cc/decolua/9router.svg?variant=adaptive)](https://starchart.cc/decolua/9router)
2026-02-03 23:38:27 -05:00
### How to Contribute
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
2026-01-31 01:44:19 -05:00
---
2026-01-04 21:58:59 -05:00
2026-01-31 01:44:19 -05:00
## 🙏 Acknowledgments
2026-01-04 21:58:59 -05:00
2026-01-31 01:44:19 -05:00
Special thanks to **CLIProxyAPI** - the original Go implementation that inspired this JavaScript port.
2026-01-04 21:58:59 -05:00
2026-01-31 01:44:19 -05:00
---
2026-01-04 21:58:59 -05:00
2026-01-31 01:44:19 -05:00
## 📄 License
2026-01-04 21:58:59 -05:00
MIT License - see [LICENSE](LICENSE) for details.
2026-01-31 01:44:19 -05:00
---
<div align="center">
2026-02-03 23:38:27 -05:00
<sub>Built with ❤️ for developers who code 24/7</sub>
2026-01-31 01:44:19 -05:00
</div>