9Router: Free AI Router & Token Saver
Connect Claude Code, Codex, Cursor, Cline and more to 40+ AI providers with free tiers, auto-fallback, and RTK's 20-40% token savings—never hit limits again.
- Source repo
- decolua/9router
- Stars
- ★ 31k
- Last updated
- 3d ago
- License
- MIT
- Primary language
- JavaScript
- FA score
- 40/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformChatGPT · Codex · Claude Code
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- A developer with a Claude Pro subscription wants to maximize it; they configure a combo that falls back to GLM and Kiro free models when quota runs out, avoiding interruptions and extra costs.
- Not a fit if
- Non-technical users unwilling to run a local server or VPS deployment
- Users relying on iFlow, Qwen Code, or Gemini CLI free tiers, discontinued in 2026
- Source review
- 40/100 · Major gaps 2 safety controls not found
What does this agent do, and when should you use it?
9Router is a local AI gateway that unifies all major AI coding CLIs—Claude Code, Codex, Cursor, Cline, Copilot, Antigravity, and others—under one OpenAI-compatible endpoint, routing them to 40+ providers including subscription tiers (Claude Code, Codex, GitHub Copilot, Cursor), cheap APIs (GLM, MiniMax, Kimi), and free tiers (Kiro AI, OpenCode Free, Vertex AI). It provides smart 3-tier fallback (Subscription → Cheap → Free) for zero downtime, and reduces token usage via the built-in RTK Token Saver (compressing tool outputs, saving 20-40% input tokens), plus optional Caveman and Ponytail prompt injections to cut output tokens. The dashboard offers real-time quota tracking, request logging, usage analytics, multi-account round-robin, and cloud sync. Installation is via npm global install or from source, with deployment options for localhost, VPS, or Docker. The software is free and open-source (MIT), with costs only from the providers you use directly.
9Router runs locally, listens on port 20128, and serves a dashboard at /dashboard and an OpenAI-compatible API at /v1. It receives standard OpenAI-format requests from CLI tools, translates them to provider-native formats (Claude, Gemini, Cursor, etc.) via its format translator, routes them to the configured provider based on a combo, and intelligently falls back across tiers (subscription → cheap → free). The RTK Token Saver compresses tool outputs (like git diff, grep) before the request, Caveman mode injects a caveman-speak prompt to reduce output tokens by up to 65%, and Ponytail injects a 'lazy senior dev' prompt to bias toward minimal code. It tracks quota and token usage per provider, auto-refreshes OAuth tokens, supports multi-account round-robin, and logs full request/response for debugging. Authentication is via API keys using the Authorization Bearer header.
- A developer with a Claude Pro subscription wants to maximize it; they configure a combo that falls back to GLM and Kiro free models when quota runs out, avoiding interruptions and extra costs.
- A budget-conscious coder wants zero-cost AI coding; they set up a 'free-forever' combo using Kiro and OpenCode Free, achieving $0/month with production-ready models.
- A user wants to integrate AI into messaging apps like WhatsApp or Telegram via OpenClaw; they configure a free combo and access it through their messaging client without any subscription.
- A team needs predictable costs; they choose Kimi's flat $9/month plan or MiniMax's $0.20/1M tokens as a cheap backup to a paid subscription, with automatic fallback.
- An always-on coding setup for deadlines; a combo chains multiple subscriptions, cheap APIs, and free tiers to guarantee zero downtime during heavy coding sessions.
How do you install or deploy this agent?
To install, globally install the npm package with 'npm install -g 9router', then run '9router' to start the dashboard at http://localhost:20128. Alternatively, run from source: clone the repo, copy .env.example to .env, run 'npm install', then start the dev server with 'PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run dev'; for production, run 'npm run build' followed by 'npm run start'. Requires Node.js 20+. For Docker, run 'docker run -d --name 9router -p 20128:20128 -v "$HOME/.9router:/app/data" -e DATA_DIR=/app/data decolua/9router:latest'.
How do you use this agent?
After installation, open the dashboard and connect providers: sign up for Kiro or OpenCode Free (no signup needed), or add API keys for others. Copy the API key from the dashboard. Configure your CLI tool: for Claude Code, edit ~/.claude/config.json with '{"anthropic_api_base": "http://localhost:20128/v1", "anthropic_api_key": "your-9router-api-key"}'. For Codex, set environment variables 'OPENAI_BASE_URL="http://localhost:20128"' and 'OPENAI_API_KEY="your-9router-api-key"'. In the CLI, specify a model like 'cc/claude-opus-4-7' or a combo name like 'free-forever'. Send a test request: 'curl -X POST http://localhost:20128/v1/chat/completions -H "Authorization: Bearer your-key" -H "Content-Type: application/json" -d '{"model": "kr/claude-sonnet-4.5", "messages": [{"role": "user", "content": "Hello"}]}'. The dashboard allows you to create combos and monitor usage.
What are this agent's strengths and limitations?
- Built-in RTK Token Saver compresses tool outputs, saving 20-40% input tokens per request, with safe fallback if compression fails.
- Smart 3-tier fallback (Subscription → Cheap → Free) ensures zero downtime for 24/7 coding workflows.
- Supports 40+ providers including free tiers (Kiro, OpenCode Free, Vertex) enabling $0-cost AI coding.
- OpenAI-compatible endpoint works with all major CLI tools; format translation supports OpenAI, Claude, Gemini, Cursor, and more.
- Robust dashboard with real-time quota tracking, request logging, usage analytics, and cloud sync for multi-device setups.
- Documentation for free tiers is partially outdated, referencing discontinued iFlow, Qwen Code, and Gemini CLI as of 2026, which could mislead users.
- Kiro AI's free tier is capped (~50 credits/month) and OpenCode Free's model list fluctuates; availability must be verified.
- Self-hosted providers (TTS/STT/embeddings) require extra configuration, and the embeddings endpoint must be an OpenAI-compatible base URL.
- Requires a local or VPS deployment, which may not be turnkey for less technical users.
- The pricing disclaimer and cost display may confuse users into thinking 9Router charges fees, though it is entirely free.
How does this agent compare with similar options?
The README acknowledges the original Go implementation CLIProxyAPI as inspiration, and integrates token-saving techniques from RTK, Caveman, and Ponytail. It also mentions OmniRoute, a feature-rich TypeScript fork with 36+ providers and advanced features, as an alternative. No other direct comparisons are provided.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| 9Router: Free AI Router & Token Saver This agent | 40 · Major gaps | CLIFree + model costs | ★ 31k | 3d ago | JavaScript | ChatGPT · Codex · Claude Code |
| Puppetmaster | 68 · Some gaps | CLIFree + model costs | ★ 468 | today | Python | Codex · Claude Code |
| Claude Code Skills & Plugins | 64 · Some gaps | Agent plugin / skillFree | ★ 28k | 1mo ago | Python | Codex · Claude Code |
| OpenCodeReview | 53 · Major gaps | CLIFree + model costs | ★ 48k | today | Go | Codex · Claude Code |
How does FollowAgents rate this agent?
Why each dimension lost points
Evidence shows: OAuth and API keys are used, but no least-privilege design; user confirmation mechanism absent; data flow transparency limited, only request logging mentioned; sensitive data handling (e.g., API keys) basic but not detailed; dependency security not audited; external effects (e.g., auto-fallback) exist but user consent unclear; rollback not mentioned; source attribution via MIT license and copyright. Deductions: lack of least privilege, user confirmation, rollback, and other key security mechanisms.
Evidence shows: self-described features are consistent, but no test evidence; many dependencies, but availability not verified; failure messages handled in code (e.g., ping test returns errors), but overall reliability unverified. Deductions: static review cannot verify dependency availability and actual runtime reliability.
Evidence shows: target audience clear (AI coding tool users), scenarios diverse (free, cheap, subscription fallback); capability boundaries described in README but not detailed; trigger precision (e.g., auto-fallback conditions) not explicit; environment fit (e.g., Docker, local) documented. Deductions: capability boundaries and trigger conditions not precise enough.
Evidence shows: information architecture clear (README, docs, videos); install instructions detailed; naming stable (9router); examples and FAQ provided; known limitations partially mentioned (e.g., free tier changes); license MIT; versioning and changelog not explicit; maintenance responsibility not clear. Deductions: versioning/changelog and maintenance responsibility missing.
Evidence shows: output usability (e.g., API compatibility) described but unverified; marginal value (e.g., token savings) clearly claimed; cost-benefit (free, cost savings) attractive. Deductions: output usability unverified, marginal value claims lack data support.
Evidence shows: claims (e.g., 20-40% token savings) have sources (RTK etc.), but no independent verification; cross-source corroboration (e.g., video tutorials) exists but unofficial; facts and inferences not clearly separated. Deductions: lack of independent verification and fact-inference separation.
- Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- Unverified publisher identity: Publisher not verified, treat with caution.
- Auto-fallback and cloud sync may involve data egress, ensure user consent.
- Many dependencies without security audit, supply chain risk.
- Free tiers and model availability may change, stability of reliance uncertain.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
v0.5.35 feat: Grok Imagine video, Copilot Claude route, i18n th/fa version 0.5.35
Release notes excerpt
Features: - xAI: Grok Imagine video generation (/v1/videos) + CLI - CLI tools: Grok Build setup — writes [model.9router] to ~/.grok/config.toml - GitHub Copilot: route Claude models through Copilot native /v1/messages - Kiro: add GPT-5.6 model family (#2596) - RTK: X-9Router-Token-Saver header to bypass token savers per request - Providers: quota visibility settings - Translator: drop temperature for all Claude models - i18n: Thai (th) + Persian (fa) translations / README Fixes: - Providers: bulk-add API keys no longer overwrite existing keys (gap-fill Key N) …View on GitHub ↗ -
v0.5.20 feat: thinking level picker + suffix support across providers version 0.5.20
Release notes excerpt
Features: - Thinking: per-model thinking level picker on provider page, appends (level) suffix to copied model names for forced reasoning effort across all formats (openai, claude, gemini, deepseek, kimi, qwen, zai, minimax, hunyuan, step) - RTK: add JS-native git-log filter (#2423) - Caveman: add targeted upstream-aligned style rules (#2424) - i18n: add Farsi (fa) language support (#2385) Fixes: - Thinking: strip (level) suffix from upstream body.model so providers no longer reject requests - Translator: preserve developer instructions in openai-responses conversion (#2434) …View on GitHub ↗ -
v0.5.18 v0.5.18: cached token tracking, provider fixes version 0.5.18
Release notes excerpt
Features: - Usage: track cached tokens + correct input/output/cache cost (#2209) - Codex: show reset credit expiry details (#2290) - NVIDIA: add new models and capabilities - ClinePass: add provider support Fixes: - Usage: dedupe streaming request-details log entries - Claude: drop foreign thinking signatures in passthrough - Prevent non-SSE stream pipe crash and cross-IdP account overwrites (#2244) - Kiro: route IdC auth to regional CodeWhisperer surface (#2297) - Kiro: add Claude Sonnet 5 model support (#2264) - Xiaomi-tokenplan: region selector, key validation, multi-connection (#2251) …View on GitHub ↗
FAQ
What port does 9Router use?
http://localhost:20128/dashboard and the OpenAI-compatible API at http://localhost:20128/v1, which is the base URL to give your coding tools. When running from source, the README sets the port with the PORT environment variable.