decolua /
9router
Local proxy that routes AI coding tools to subscription, cheap, or free models
- 31.2k stars
- 1.1k stars since 3 Oct
- JavaScript
- Updated 7 days ago
- Some experience
- Token & cost savings
AI coding tools like Claude Code, Codex, Cursor and Cline hit rate limits, burn through paid quota, and tie you to one provider. 9Router is a local server you point those tools at instead. It exposes an OpenAI-compatible endpoint at localhost:20128/v1 and forwards each request to a provider you have connected.
Behind that endpoint it translates between API formats (OpenAI and Claude), tracks quota, and refreshes tokens. You use tiers: subscription providers first, then cheap ones such as GLM or MiniMax, then free ones such as Kiro or OpenCode Free. When one tier runs dry, requests move to the next.
It also has a feature called RTK that compresses tool_result content, such as git diff, grep or ls output, before sending it on. The README claims 20-40% token savings. That is the author's figure, so test it on your own work. Free tiers have credit caps, so expect limits, not truly unlimited use.
What it does
Automatic fallback tiers
Moves from subscription to cheap to free providers when quota is exhausted, so a coding session keeps going.
RTK token saver
Compresses tool_result content like git diff and grep output before it reaches the model, to reduce tokens per request.
One endpoint for many tools
Gives Claude Code, Codex, Cursor, Cline, OpenClaw and others a single OpenAI-compatible URL and an API key from the dashboard.
Format translation
Converts between OpenAI and Claude request formats so tools can use models from different vendors.
Multi-account and quota tracking
Round-robins between several accounts per provider and tracks quota so you can use what you pay for before it resets.
What you could build
- Point Claude Code or Codex at a local endpoint that falls back to free models when your quota runs out.
- Spread requests across several accounts of one provider to avoid rate limits.
- Cut token use on tool-heavy agent sessions by compressing command output.
- Try different providers and models from one tool without reconfiguring each time.
- Run a shared gateway on a server or in Docker for a small team.
Get started
Install it globally with npm and run it, then open the dashboard at http://localhost:20128. Connect a free provider such as Kiro AI or OpenCode Free, then set your coding tool's endpoint to http://localhost:20128/v1 with the API key from the dashboard.
npm install -g 9router9routerCommands are copied from the project's README. Read it on GitHub for the full setup.
More in Token & cost savings
caveman
Makes coding agents answer tersely and shrinks the logs and output they read
billion-context
A proxy that compresses long coding-agent chats so one session can run for weeks