9Router is a self-hosted AI gateway built for developers who run coding assistants like Claude Code, Cursor, Codex, Cline, Copilot, or Antigravity and want to stop burning subscription quota or paying for API calls they don't need to. It sits between your CLI tool and the model provider, exposing an OpenAI-compatible endpoint at http://localhost:20128/v1 that any of these tools can point to. It's aimed at solo developers and teams who use multiple AI coding tools and want a single place to manage providers, track quota, and fall back to free or cheap models when a paid tier runs out.
The project is written in JavaScript (a Next.js app) and ships as an npm package, a Docker image, and a source checkout. It maintains a dashboard for connecting providers, viewing quota usage, and copying API keys for your CLI tools.
tool_result content (git diff, grep, ls output, etc.) before it reaches the model, cutting token usage by roughly 20-40% per request.9Router fits developers juggling several AI coding tools who don't want to manually swap API keys every time a subscription or free tier runs dry. It's a good match if you already have accounts with Claude Code, Codex, or GitHub Copilot and want to squeeze full value out of them before falling back to cheaper or free alternatives. Teams running high-volume tool calls (lots of git diffs, file listings, grep output) benefit from the token compression, since that overhead adds up quickly across a coding session.
It's not a fit if you need a guaranteed-uptime, provider-backed service for production inference, since free-tier providers can change terms or disappear without notice (the README itself notes several free tiers were discontinued or capped over time). It's also not the right tool if you just want a single provider's official CLI with no routing logic, or if you're uncomfortable running a local service (or Docker container) that proxies your API traffic.
The quickest path is via npm:
npm install -g 9router
9router
This opens the dashboard at http://localhost:20128. From there, connect a free provider like Kiro AI or OpenCode Free (no signup required for the latter), copy the generated API key, and point your CLI tool's settings at:
Endpoint: http://localhost:20128/v1
API Key: [from dashboard]
Model: kr/claude-sonnet-4.5
To run from source (the repository itself, since the npm package 9router-app is private):
cp .env.example .env
npm install
PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run dev
For a production build:
npm run build
PORT=20128 HOSTNAME=0.0.0.0 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run start
A Docker image is also published (decolua/9router on Docker Hub and GHCR) for containerized deployment. Default endpoints after setup are the dashboard at /dashboard and the OpenAI-compatible API at /v1.