
# 9Router - Free AI Router
**Never stop coding. Auto-route to FREE & cheap AI models with smart fallback.**
**Free AI Provider for OpenClaw.**
[](https://www.npmjs.com/package/9router)
[](https://www.npmjs.com/package/9router)
[](https://github.com/decolua/9router/blob/main/LICENSE)
[π Quick Start](#-quick-start) β’ [π‘ Features](#-key-features) β’ [π Setup](#-setup-guide) β’ [π Website](https://9router.com)
---
## π€ Why 9Router?
**Stop wasting money and hitting limits:**
- β Subscription quota expires unused every month
- β Rate limits stop you mid-coding
- β Expensive APIs ($20-50/month per provider)
- β Manual switching between providers
**9Router solves this:**
- β
**Maximize subscriptions** - Track quota, use every bit before reset
- β
**Auto fallback** - Subscription β Cheap β Free, zero downtime
- β
**Multi-account** - Round-robin between accounts per provider
- β
**Universal** - Works with Claude Code, Codex, Gemini CLI, Cursor, Cline, any CLI tool
---
## π How It Works
```
βββββββββββββββ
β Your CLI β (Claude Code, Codex, Gemini CLI, OpenClaw, Cursor, Cline...)
β 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)
Result: Never stop coding, minimal cost
```
---
## β‘ Quick Start
**1. Install globally:**
```bash
npm install -g 9router
9router
```
π Dashboard opens at `http://localhost:20128`
**2. Connect a FREE provider (no signup needed):**
Dashboard β Providers β Connect **Claude Code** or **Antigravity** β OAuth login β Done!
**3. Use in your CLI tool:**
```
Claude Code/Codex/Gemini CLI/OpenClaw/Cursor/Cline Settings:
Endpoint: http://localhost:20128/v1
API Key: [copy from dashboard]
Model: if/kimi-k2-thinking
```
**That's it!** Start coding with FREE AI models.
**Alternative: run from source (this repository):**
This repository package is private (`9router-app`), so source/Docker execution is the expected local development path.
```bash
cp .env.example .env
npm install
PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run dev
```
Production mode:
```bash
npm run build
PORT=20128 HOSTNAME=0.0.0.0 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run start
```
Default URLs:
- Dashboard: `http://localhost:20128/dashboard`
- OpenAI-compatible API: `http://localhost:20128/v1`
---
## π‘ 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 |