- Published on
9Router: one local endpoint in front of every AI coding account I have

- Authors

- Name
- Nadim Tuhin
- @nadimtuhin
On this page
This is one piece of my AI coding agent setup. It's about the gateway every agent talks to.
The problem
At some point I had more AI coding accounts than I could keep straight. Each agent CLI had its own idea of which key to use. When one account hit its limit, the agent just stopped and waited for me. Switching meant editing config in three places.
What I wanted was one URL. Every tool points at it. Accounts, keys, limits and failover all live behind it, in one place.
That's 9Router. It's an open source gateway that runs locally, speaks the OpenAI style API, and routes to the real providers behind it.

What sits behind it
| Provider | How many | What I use it for |
|---|---|---|
| Antigravity | 6 accounts | Bulk work and long agent loops |
| Codex Pro | 2 subscriptions | A second opinion with different blind spots |
| Claude Max | 1 subscription | The hard calls and final review |
| OpenCode Go | 1 subscription | Open models: GLM, Kimi, Qwen, DeepSeek, MiniMax |
| LongCat | 1 | Judge in fusion combos, cheap fallback |
All of it is reachable at http://localhost:20128/v1. Today that endpoint lists a couple of hundred models, and the gateway adds only ~15ms of overhead.
Combos: the part that actually matters
An agent never asks for an account. It asks for a model name. In 9Router that name is often a combo: a named group of models with a strategy for picking between them. I have about twenty.
- Fallback. Try the first model. If it errors or is rate limited, try the next. This is my default for anything I want to just work.
- Round robin. Spread requests evenly across accounts, so six Antigravity accounts wear down together instead of one at a time.
- Fusion. Send the same prompt to a small panel, then let a judge model pick or merge the best answer.

When an account hits its limit, the next request goes to the next account. The agent never notices. Six Antigravity accounts means six chances before anything falls through to a paid fallback.

Fusion combos
Fusion is the strategy I like most, and the one I use most carefully.

- claude-fusion: Opus, Sonnet, Gemini Flash and LongCat answer, and the answers get merged.
- gemini-fusion: LongCat, Gemini Flash and Sonnet, with Gemini Flash as judge.
- longcat-fusion: Gemini Flash, GPT Luna and GLM Flash, with LongCat as judge.
- sonnet-fusion: Gemini Flash, Sonnet and LongCat, with Sonnet as judge.
Different model families fail in different ways. A panel catches the confident wrong answer that one model alone would have handed me.
The trade-off is speed and quota, so fusion is never the default. I reach for it on architecture questions, on bugs that already fooled one model, and on reviews.
How agents reach it
Most agent CLIs can point at a custom base URL. Claude Code needs a few environment variables, and Pi and Hermes read it from their config.
I wrote 9agent so I never set those by hand. It reads the model list from 9Router, I pick one, and it launches the agent pointed at the gateway.
My favorite trick: Claude Code's Opus, Sonnet and Haiku slots can each map to a different 9Router model. The heavy slot gets a fusion combo, the everyday slot gets a fast model, and the background slot gets a cheap one.
Keeping the model list fresh
New free models show up constantly, and I don't track them by hand. Hermes runs a few scheduled jobs every morning that check for newly available models and add them to the right combos. By the time I sit down, the list is current.
What I'd tell someone setting this up
- Put the gateway in early. Once you have more than one tool and more than one account, configuring each tool separately turns into a mess fast.
- Name combos by intent, not by provider. Agents ask for "the fusion one" or "the fast one". The accounts behind that can change without touching any agent config.
- Keep a cheap fallback at the end of every chain. A slow answer beats an agent sitting idle on a rate limit.
- Treat it as infrastructure. It runs on the always-on Windows PC, next to the agents, not on the laptop that sleeps.
Frequently asked questions
- What is 9Router?
- 9Router is an open source local gateway that speaks the OpenAI style API and routes to real providers behind one URL. I point every coding agent at http://localhost:20128/v1 and keep accounts, keys, limits and failover in one place.
- How do I switch AI accounts automatically when one hits its rate limit?
- Use a fallback or round robin combo in 9Router. Fallback tries the next model when one errors or is rate limited, and round robin spreads requests evenly across accounts. The agent never notices the switch.
- What is a fusion combo?
- A fusion combo sends the same prompt to a small panel of models, then a judge model picks or merges the best answer. Different model families fail differently, so a panel catches confident wrong answers. It costs speed and quota, so I use it for architecture questions, stubborn bugs and reviews.
- How do I point Claude Code at a custom endpoint?
- Set a few environment variables for the base URL and model. Claude Code Opus, Sonnet and Haiku slots can each map to a different 9Router model, so the heavy slot can use a fusion combo and the background slot a cheap model. I wrote 9agent to do this without setting variables by hand.
Related posts
- My AI coding agent setup: a MacBook controls, a home Windows PC runs
Control coding agents from a MacBook Pro while they run on a Windows PC at home: Herdr over Tailscale, Cloudflare Tunnel for browsers, 9Router for every model.
- Go berserk: one night with Grok Bot, Orca and every gate still on
My Grok Bot usage reset, so I told my AI teammates to go berserk overnight. They set up Orca, fixed a Windows PC and refreshed my blog, and every order kept the review gates on.
- Hermes Agent: nightly cron jobs and skills learned from corrections
Hermes runs nightly CLI updates, a security PR scan every 6 hours and a 30-minute autoheal job. Every correction I make becomes a skill file. Hermes drafts, I send.