Back to Model List

9Router – Free Open-Source AI Router: Smart Fallback for Claude Code, Cursor & Codex

AI Tech Editorial
RSS Feed
9Router – Free Open-Source AI Router: Smart Fallback for Claude Code, Cursor & Codex official screenshot
(Image source: official screenshot)

Executive Summary:

9Router is a free open-source AI router that connects Claude Code, Cursor, Codex, Cline & Copilot to 40+ providers with 3-tier auto-fallback (subscription → cheap → free), proxy pools and RTK token savings of 20-40%. Install via npm, never hit rate limits again.

What Is 9Router

9Router is an open-source routing proxy built to optimize AI-assisted coding workflows. A local proxy layer unifies Claude Code, Codex, Cursor, Cline, and similar tools while intelligently scheduling 100+ models from 40+ providers. Three-tier fallback routing plus a Rust-based RTK token compression engine automatically switches to cheaper or free channels when subscription quotas run out, saving an average of 20–40% on input tokens. A visual dashboard tracks quota usage, cost estimates, and call status so coding stays uninterrupted.

9router-ai official website screenshot
(Image source: official screenshot)

Technical positioning and domain: 9Router is AI infrastructure for developer toolchains—“AI coding router proxy.” It does not host models; it middleware-schedules requests across providers, optimizes cost, and handles format compatibility for AI coding scenarios.

Development background: Created and maintained by open-source developer decolua on GitHub. Motivation: fragmented AI coding subscriptions (Claude Pro, Codex Plus, Cursor, etc.) with separate quotas, incompatible formats, and no smart degradation. One local proxy was meant to unify integration and scheduling and cut cost and ops overhead.

Core value: Turns “cost optimization” and “zero-downtime coding” into practice. Automated three-tier fallback means no manual tool switches or waiting for quota resets when paid tiers exhaust—hand off to cheaper or free models seamlessly. RTK compression and “Caveman Mode” can drive monthly AI coding spend near zero—meaningful for indie devs and small teams.

Technical characteristics: Local proxy core with three-tier fallback, RTK pre-filter engine, and format translation middleware. Routing and compression are coupled—lossless compression before format conversion lowers cost while preserving response quality. OAuth auto-renewal keeps subscription channels alive with less manual maintenance.

Key Features

  • Three-tier smart routing: Core scheduler follows subscription quota → low-cost API → free tier. When tier one hits limits, the engine reads error codes and quota state and transparently fails over—no user intervention.

  • RTK token compression: Rust engine optimized for coding tool output. Before format conversion, RTK scans the first 1KB of tool_result, matches patterns from git-diff, grep, tree, etc., and losslessly compresses. Tests show 20–40% input token savings.

  • Caveman Mode: Injects concise-style prompts so models reply shorter. Up to ~65% lower output tokens vs standard mode while staying usable—great for high-frequency short interactions.

  • Unified multi-provider management: OAuth or API keys for 60+ providers (Claude, OpenAI, GLM, MiniMax, Kiro, etc.). One dashboard for config, quota, and health—no platform hopping.

  • Live quota tracking: Dashboard shows token use, remaining quota, reset countdown, and estimated cost—important for budget-sensitive users.

  • Automatic format translation: Converts among OpenAI, Claude, Gemini, Cursor, Kiro APIs so any OpenAI-compatible CLI can talk to non-OpenAI backends—foundation of broad compatibility.

  • Multi-account rotation: Multiple accounts per provider with round-robin and failover when one account limits out or errors.

  • Request logs and cloud sync: Detailed debug logs for failures and routing anomalies; optional cloud sync of config/logs across devices.

How to Use

  1. Install: Node.js v18+ recommended. npm install -g 9router, then 9router to start the local proxy. Dashboard opens at http://localhost:20128 by default. Use pm2 or screen for background runs.

  2. Connect providers: In the dashboard Providers page, OAuth (Claude, OpenAI, etc.) or paste API keys. Zero-cost users can start with Kiro AI or OpenCode Free. Add 2–3 tiers to maximize fallback.

  3. Create combos: On Combos, stack models by priority—e.g., tier 1 cc/claude-opus-4-7, tier 2 glm/glm-5.1, tier 3 kr/claude-sonnet-4.5. Each combo gets an API key for CLI config.

  4. Configure CLIs: For Claude Code, set API base to http://localhost:20128/v1 and use the combo API key. Same pattern for Codex, Cursor, etc.

  5. Code and verify: Use tools normally; when subscription quota dies, traffic falls through automatically. Watch dashboard logs and quota pages; optionally simulate exhaustion once to validate fallback.

Pros and Cons

Pros
Zero-downtime coding: Three-tier auto fallback avoids manual switches and quota wait—strong dev continuity.
Meaningful token savings: Rust RTK engine saves ~20–40% input tokens on heavy coding loops.
One dashboard for 60+ providers: Central config, quota, and status—less ops toil.
Open source with active community: Transparent code, frequent updates, responsive issues.

Comparison with Similar Tools

Dimension 9Router OpenRouter LiteLLM
Focus Local router for AI coding CLIs Cloud unified API gateway Enterprise LLM proxy / LB
Deploy Local / Docker / VPS / Cloudflare Workers Cloud SaaS Local/cloud enterprise
Providers 60+ (OAuth subs + API keys + free tier) 200+ models 100+ models/providers
Coding CLI fit Deep fit for Claude Code, Codex, Cursor Generic API; manual CLI wiring Generic SDK/proxy
Token compression Built-in RTK (~20–40% savings) None built-in None built-in
Tiered fallback Sub → cheap → free, seamless Fallback without layered strategy Fallback + retry policies
Quota UI Live dashboard + reset timers Basic usage stats Enterprise monitoring
Cost angle Built for indie cost control Pay-as-you-go; no free-tier aggregation Enterprise budget/rate limits
License Open source Partially open MIT

Selection advice: Indie devs and small teams on Claude Code/Codex/Cursor benefit most from 9Router's tiered fallback and compression with local privacy. Need 200+ models and pure SaaS? OpenRouter—but no built-in compression or layered fallback. Enterprise teams may prefer LiteLLM for LB, rate limits, and alerts. Local-only models → LocalAI.

Editor's Review

9Router nails an under-served niche: multi-provider scheduling and cost control for AI coding. Technically, coupling three-tier routing with RTK compression in one proxy pipeline (“compress then route”) is sharper than treating them as separate modules; Rust keeps compression fast under load.

Practically, it kills “quota anxiety” and runaway spend—indies can save hundreds to thousands per year. The local proxy is also a SPOF—run under Docker/PM2 and backup configs.

Audience: indie devs, OSS contributors, small teams—not enterprises needing RBAC/audit yet. Future wins: custom rule engine, richer RTK filters, team features.

— Deduct for learning curve and docs; core innovation and utility earn the score. Worth trying if you want cheaper, uninterrupted AI coding.

Use Cases

  • Multi-subscription users: Auto-schedule Claude Pro, Codex Plus, Cursor, etc., without wasting quota or hitting hard stops.

  • Zero-cost developers: Route only through Kiro AI, OpenCode Free, Vertex free tiers with account rotation.

  • Deadline sprints: 24/7 coding with fallback to free tiers when paid quotas die.

  • Token-sensitive repos: RTK shrinks git diff/grep/tree dumps 20–40% during refactors and reviews.

  • Team / multi-device: Cloud-synced provider config; VPS/Docker for shared team routing policy.

Free Providers & iFlow Integration

9Router's free tier is what makes it genuinely $0/month coding possible. Through the built-in iFlow provider, you get free access to 8 models including Kimi K2, Qwen3 Coder Plus, GLM 4.7 and MiniMax M2 — no API key cost, no credit card. Combined with Qwen's free CLI tier (3 models) and Kiro (Claude Sonnet 4.5 / Haiku 4.5 via AWS Builder ID), Tier-3 fallback means your coding session never dies even when every paid quota is exhausted. Many users route 90%+ of daily requests to these free tiers and only touch subscriptions for the hardest tasks.

Proxy Pools & Multi-Account

The Proxy Pool feature manages multiple accounts per provider with round-robin load balancing and automatic failover — if one account hits its 5-hour window, the next key picks up mid-session. Pool configuration (providers, keys, combos, usage) is handled in a clean local dashboard UI at http://localhost:20128/dashboard. For teams, Cloudflare edge tunnel support exposes your router from anywhere with 300+ global locations.

Pricing: What Does 9Router Cost?

9Router itself is free and open-source (MIT). Your only costs are the upstream providers you connect:

Tier Example Providers
Tier 1 — Subscription Claude Code, Codex, Gemini, Copilot
Tier 2 — Cheap API GLM ($0.60/1M), MiniMax ($0.20/1M), Kimi (~$9/mo)
Tier 3 — Free iFlow, Qwen CLI, Kiro

A realistic heavy-use pattern (100M tokens/month) routes most volume through free and cheap tiers for a total of roughly $5/month vs $2,000+ on raw API pricing. RTK token compression (20-40% savings) stacks on top of that.

FAQ

Q: Does 9Router support Windows?
A: Yes—Node.js v18+ on Windows, macOS, Linux. Use admin terminal if permissions bite.

Q: How do I know RTK compression is working?
A: Logs show RTK compressed: X% with before/after token counts; Stats page shows aggregate savings.

Q: How is fallback priority set?
A: By model order in Combos—typically subscription → cheap API → free. On 429/quota errors, it steps down.

Q: Does 9Router store my code?
A: No—it forwards requests/responses without caching code bodies. Logs hold metadata (tokens, latency, route). Disable logging in settings if desired.

Q: OAuth auto-renewal failed—what now?
A: Re-login in the dashboard; check GitHub Issues for provider changes; temporarily use API keys.

Q: Custom routing rules?
A: Combo ordering only today; conditional routing (latency, cost thresholds) is on the roadmap.

Q: Is 9Router really free?
A: Yes—the router itself is MIT-licensed open source. Free models via iFlow/Qwen/Kiro make $0/month coding realistic; you only pay for optional premium providers.

Q: How do I install 9Router?
A: npm install -g 9router, then run 9router. The dashboard opens at localhost:20128; point your tool's OpenAI-compatible endpoint to http://localhost:20128/v1.

Q: What is the difference between 9Router and OpenRouter?
A: OpenRouter is a hosted paid API aggregator. 9Router runs locally on your machine, reuses subscriptions you already pay for, adds free-tier providers and token compression — no middleman margin.

Project Links

© All Rights Reserved. Some content on this site is partially generated by AI with human review.