9Router Claude Code: The Wiring Walkthrough

Julian Goldie — founder, AI Profit Boardroom
By Julian Goldie · 7 min read
Get The AI Profit Stack Join AIPB →
🎯 1,000+ done-for-you AI agent workflows 📅 5 live coaching calls / week with me 🛡️ 7-day refund + 30-day ROI guarantee 👥 3,000+ AI operators inside

Routing 9router claude code traffic takes one setting: open the claude config file in your home folder's .claude directory (config.json), point anthropic_api_base at http://localhost:20128/v1, and every request Claude Code makes now travels through 9Router's fallback chain across 40-plus providers. That is the entire documented wiring — no wrapper scripts, no hosted middleman. The router runs on localhost, plugs into the OAuth sessions you already hold (your existing Claude sign-in included), and quietly hands Claude Code a far deeper pool of models than any single subscription ever gives it.

📺 Watch: 9Router: New FREE Unlimited AI Coder!

🔥 Get the Agent OS as a free bonus: AI Profit Boardroom members get the full Agent OS zip, prompt libraries, daily tutorials and weekly live coaching calls. → Get inside

I have already covered the router itself in my 9Router review, but Claude Code deserves its own page because it is the client this project plainly cares about most. The repo names Claude Code first in its connect list and counts it among the five named subscription providers it manages. Here is why I route it, exactly how the documented wiring works, and what happens to a request once it starts flowing.

Why route Claude Code through 9Router at all?

Claude Code on its own has one failure mode that wrecks momentum: hard limits. You hit a quota mid-session and the tool simply stops until your window resets. Put 9Router in front and that cliff becomes a slope — the router's Smart 3-Tier Fallback moves a rate-limited or failing request down the chain automatically, from subscription models to cheap ones to free ones, without you touching a thing.

Three documented reasons made this permanent in my setup:

And because 9Router wires into access you already own rather than reselling someone else's keys, Claude Code keeps working through your existing sign-in. This is routing, not replacement.

Want my exact fallback chains, the config I run under Claude Code, and the full agent stack wrapped around it? Grab my 9Router and Claude Code routing playbook inside AI Profit Boardroom — or book a free SEO strategy session and I will map the whole setup to your workflow personally.

The documented 9Router Claude Code wiring

The order matters slightly: router first, token second, config edit last. Get 9Router installed and running locally — my how to use 9Router walkthrough covers the folder install — then open the dashboard, because that is where your Bearer token is issued. Claude Code authenticates to the router with that token, and the same dashboard is where you will later watch estimated costs tick past per request.

The Claude Code edit itself is one line of intent. Open the claude config file in your home folder's .claude directory (config.json) and set anthropic_api_base to the endpoint http://localhost:20128/v1. Save, restart Claude Code, and the tool now talks to the router on localhost instead of reaching out directly — while 9Router decides what actually answers behind that endpoint.

The same port serves the other documented clients too. Codex wiring is documented as setting the OPENAI_BASE_URL environment variable to the localhost endpoint, and Cursor takes it as its OpenAI API base URL paired with a routed model name. One router, one port, several tools. Config formats do drift between releases, so treat decolua/9router on GitHub as the source of truth before you edit anything.

📺 Watch: DeepSeek Harness VS Claude Code

What happens when Claude Code sends a request

Once wired, every prompt follows the same documented story. The request lands on the router, which tries Tier 1 first — your subscription providers, with Claude Code itself one of the five named ones. If the model answers, you would never know 9Router was in the middle. If the provider errors out or your quota is exhausted, the router drops to Tier 2, the cheap API models, and if those stumble too it falls to Tier 3, the free ones.

The practical effect is zero-downtime coding. A limit that used to end my session now shows up as nothing more than a different model finishing the task, and the 9router claude code pairing turns "come back in three hours" into "carry on". I unpack the request mechanics in my 9Router proxy explainer, and on client work that cannot afford any stall I run the two-router redundancy pattern from my review — a second router standing behind the first.

RTK is the quiet win for coding sessions

RTK feels built for Claude Code specifically. Coding agents burn most of their input tokens on tool outputs — long git diff dumps, grep results, ls and tree listings — which is exactly Claude Code's bread and butter. RTK compresses those outputs before they reach the model, for a documented 20 to 40 per cent input-token saving, and because it is on by default the saving starts the moment your wiring does.

On a metered tier that is a straight cost cut. On a subscription tier it is something subtler and arguably better: fewer tokens per request means your quota stretches further, which means the fallback chain fires later. The compression does not just save money — it delays the very event 9Router exists to rescue you from.

📺 Watch: How to Reduce Claude Code AI Tokens by 80% (FREE)

Honest notes before you rely on it

A few things worth saying plainly before you route production work through this. None of them killed the setup for me, but all three shaped how I use it with Claude Code:

Where this sits among my Claude Code routes

9Router is one lane on a wider map I keep for Claude Code. If the goal is simply not paying, start with my free Claude Code routes; if you want models running on your own machine, my Claude Code local setup covers that end. In my daily stack Claude Code splits the workload with Hermes — the division of labour lives in my Hermes agent and Claude Code piece — and the whole operation runs inside Agent OS, where the free-coder tab is precisely where routes like this one get filed. And before any routed model touches real client work, it goes through Goldie Bench, my own testing gauntlet, because a fallback tier you have never benchmarked is just a surprise waiting to happen.

9Router and Claude Code at a glance

Step or behaviourDocumented detail
Client supportClaude Code named first in the repo's connect list; one of five named subscription providers
Config editSet anthropic_api_base to http://localhost:20128/v1 in config.json inside your home folder's .claude directory
AuthenticationBearer token issued from the 9Router dashboard
Fallback orderSubscription, then Cheap, then Free — switching on quota exhaustion or errors
RTK compressiongit diff, grep, ls and tree outputs compressed; 20 to 40 per cent input-token saving; on by default
Cost displayDashboard shows estimated costs only; the router itself never charges
LicenceMIT — free to run locally

9router claude code FAQs

Can Claude Code use 9Router?

Yes, and it is documented rather than a hack. Claude Code is both a supported client and one of the router's five named subscription providers, and the repo's own pitch puts it first in the connect list. The wiring is the anthropic_api_base edit described above — one value in config.json pointing at the localhost endpoint.

Does routing break my normal Claude Code setup?

The documented change is a single value, which is the reassuring part. Point anthropic_api_base back to its previous state — or remove the override entirely — and Claude Code returns to talking to Anthropic directly. I would still check the current repo docs before and after any edit, because config behaviour is the project's to define, but in my experience the switch runs cleanly in both directions.

Is running Claude Code through 9Router free?

The router is — it carries an MIT licence, runs on your machine and never charges you. What flows through it is another matter: subscription tiers use plans you already pay for, cheap tiers bill through your provider accounts, and free tiers exist but fluctuate, as the README openly warns. Free router, variable providers is the honest summary.

What does cc mean in routed model names?

It is the router's model addressing at work. Cursor's documented example uses a routed model name like cc/claude-opus-4-7 — the prefix tells 9Router which route the request belongs to, per the docs, so one endpoint can carry many providers without the client needing to know the difference.

Verdict on the 9router claude code setup

One config value buys Claude Code a fallback chain across 40-plus providers, default-on token compression aimed squarely at coding output, and an exit from the hard-limit lottery — all through sign-ins you already own. For a five-minute edit that reverses just as fast, I struggle to name a better ratio of effort to resilience anywhere in my stack.

If you want this running today rather than someday, steal my full 9Router and Claude Code stack inside AI Profit Boardroom — configs, fallback chains and the agents I run on top. Prefer a shortcut tailored to your business? Book a free SEO strategy session and we will wire it together.

Real wins from inside the AI Profit Boardroom

See all 3,000+ members →
AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot AIPB member win screenshot

Ready To Join The #1 AI Community?

Join 3,600+ entrepreneurs inside the AI Profit Boardroom. Get 1,000+ plug-and-play AI agent workflows, daily coaching, and a community that holds you accountable.

Join The AI Community →

7-Day No-Questions Refund • Cancel Anytime

← Back to all posts