Why you’d love 9router AI Models Gateway

I got tired of juggling five different providers just to keep my coding agents working. So I found 9router that literally became my daily companion on Arch, pointed OpenCode, Kilo Code and Claude Code at one localhost address, and gave all of them the same pool of providers, free models and token-saving tricks. This is exactly how I did it — and what I would change next time.

My machine is Arch Linux, and 9router is now a small background process with a web dashboard. It is not another AI service you sign up for. It is a router you run yourself: one OpenAI-compatible endpoint that your tools talk to, and a control panel where you decide which provider answers each request.

One laptop, one local endpoint, every coding agent pointed at the same place.

What 9router actually is

Think of it as a switchboard. Your agent sends a request to http://127.0.0.1:20128/v1. 9router translates the format if needed, checks which providers and models you have connected, watches their quotas, and forwards the request. If that model is rate-limited or fails, it can fall back to the next model in your list without the agent noticing.

Upstream lists 60-plus providers and more than a hundred models, including OpenRouter, NVIDIA NIM, TokenRouter, Gemini, Cloudflare AI, DeepSeek, GLM, Kimi and MiniMax, alongside subscription logins such as Claude Code, Codex and Copilot. The dashboard groups them by tier: subscriptions first, cheap APIs second, free tiers last.

One process. One local address. Every agent. The providers stay behind the router, where you can swap them without touching your tools.

Installing it on Arch

I went with the upstream npm install rather than a distribution package, because it gives the newest release and matches the project’s own documentation. You need Node and npm first:

sudo pacman -S nodejs npm
npm install -g 9router
9router

That last command starts the server and opens the dashboard. The useful flags are -p for a different port (20128 by default), -H for the bind address, -n to skip opening a browser, -l to show logs, and -t for tray mode. I run it with --tray --skip-update so it stays quietly in the background.

There is also an AUR route if you prefer pacman-managed packages: 9router-bin tracks the current release (0.5.119-1), while 9router and 9router-webui-bin are older community builds. As always with the AUR, read the PKGBUILD before running makepkg -si.

To make it survive a reboot, I dropped a desktop entry into ~/.config/autostart/9router.desktop:

[Desktop Entry]
Type=Application
Name=9Router
Comment=9Router API Proxy
Exec=/usr/bin/node /usr/lib/node_modules/9router/cli.js --tray --skip-update
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=trueCode language: JavaScript (javascript)

Arch’s autostart generator turns that into a user systemd unit, app-9router@autostart.service, which you can check with systemctl --user status app-9router@autostart.service. All state lives in ~/.9router: the database, auth material, logs and a large model catalog that gets refreshed from the providers.

One thing to note: the default host is 0.0.0.0, so the dashboard listens on every interface. On a laptop on public Wi-Fi I would start it with 9router -H 127.0.0.1 instead. Mine is on a trusted local network, so it is left as-is.

The dashboard and the local key

Open http://127.0.0.1:20128. The dashboard gives you a local API key and that key is what every agent uses as its credential. It is not a key for a paid service; it identifies your requests to your own router. Treat it like a password anyway and never paste the real one into a forum post or an article.

The tabs that matter are Providers (where you connect accounts and keys), Combos (your fallback chains), Endpoint (token savers) and the usage view with quota and cost estimates. Once a provider is connected, the model list is pulled in automatically, so the prefixes you type into agents come from the dashboard rather than from memory.

OpenRouter, TokenRouter, NVIDIA and the free tiers

This is where the setup starts paying off. Each provider is added once in the dashboard, and then every connected agent can use it.

  • OpenRouter — one API key opens a very large catalog. Its free models carry a :free suffix; my local list included openrouter/cohere/north-mini-code:free, openrouter/nvidia/nemotron-3.5-lightning:free and openrouter/liquid/lfm-3-1.7b:free.
  • TokenRouter — a separate gateway with a free tier and an OpenAI-compatible key. After signup and email verification you can add it as a provider; my catalog showed the ready-made tokenrouter-deepseek-free model alongside paid DeepSeek and Qwen entries.
  • NVIDIA NIM — an NVIDIA API key exposes models under the nvidia/ prefix, for example nvidia/meta/llama-3.3-70b-instruct, nvidia/deepseek-ai/deepseek-v4-flash and several Nemotron variants.
  • OpenCode Free — needs no authentication at all in the dashboard and shows up as the oc/ prefix. My list had oc/beam-free, oc/deepseek-v4.1-flash-free, oc/glm-5.3-flash-free and oc/mimo-v2.6-flash-free.
  • Kiro AI and Gemini / Vertex — small free credit allocations that are useful as an emergency tier rather than a daily driver.

The exact model IDs drift as providers add and remove models, so treat those names as examples. Refresh the catalog in the dashboard and copy the current IDs from there.

“Free” means free under that provider’s current terms, with its current limits. It does not mean unlimited, permanent, or guaranteed.

Combos: the part that actually saves money

A combo is a virtual provider made from several models in a chosen order. The router tries the first one, then moves down the list when the quota runs out, a rate limit appears, or the provider errors. Multi-account rotation sits behind the same idea: add two or three accounts at one provider and the router cycles through them.

My sensible default looks like this:

  • 1 — Subscription: your paid Claude Code or Codex model, for the work that needs the best answer.
  • 2 — Cheap API: a low-cost model such as GLM or MiniMax for ordinary edits.
  • 3 — Free: oc/glm-5.3-flash-free or tokenrouter-deepseek-free so the agent keeps working after the quota is gone.

Give each agent a combo name instead of a model name and the fallback happens in the router. Your editor or CLI never has to be reconfigured when a provider changes its limits.

Saving tokens without changing how you work

The token savers live under the endpoint settings and are the reason I kept the router running after the first week.

  • RTK compresses large tool outputs before they reach the model — git diffs, grep results, trees and log dumps. It recognises the content type, applies the relevant filter, and keeps the original text if compression would make it bigger. The project’s own example goes from 47K tokens to 28K, roughly 40% saved.
  • Caveman trims the verbosity of model replies.
  • Ponytail keeps the guardrails intact: no cutting input validation, error handling, security or anything you explicitly asked for. It stacks with Caveman and RTK.
  • Headroom is optional and runs separately. Install it locally with pip install "headroom-ai[proxy]", start headroom proxy --port 8787, then enable it in the dashboard’s token saver section.

Combined, the project advertises 20–65% fewer tokens. Your mileage depends on how much of your session is tool output versus conversation, but for agentic work that repeatedly inspects a repository, RTK alone is hard to ignore.

Wiring up the coding agents

Every agent needs the same three things: the local base URL with a /v1 suffix, the local key, and a model name. The rest is per-tool config.

OpenCode

In ~/.config/opencode/opencode.json I added a provider using the OpenAI-compatible adapter:

"provider": {
  "9router": {
    "npm": "@ai-sdk/openai-compatible",
    "options": {
      "baseURL": "http://127.0.0.1:20128/v1",
      "apiKey": "sk-YOUR-LOCAL-KEY"
    },
    "models": {
      "oc/beam-free": { "name": "oc/beam-free" },
      "oc/big-pickle": { "name": "oc/big-pickle" }
    }
  }
}Code language: JavaScript (javascript)

Then you select models as 9router/oc/beam-free. I keep a fast free model for exploration and a stronger one for the main agent.

Claude Code

Claude Code does not need a provider block. In ~/.claude/settings.json set the Anthropic base URL and auth token to the local values, then map the built-in model aliases:

"env": {
  "ANTHROPIC_BASE_URL": "http://127.0.0.1:20128/v1",
  "ANTHROPIC_AUTH_TOKEN": "sk-YOUR-LOCAL-KEY",
  "ANTHROPIC_DEFAULT_FABLE_MODEL": "oc/deepseek-v4.1-flash-free",
  "ANTHROPIC_DEFAULT_OPUS_MODEL": "oc/big-pickle",
  "ANTHROPIC_DEFAULT_SONNET_MODEL": "oc/mimo-v2.6-flash-free",
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "oc/muse-spark-1.2-contributor-free"
}Code language: JavaScript (javascript)

After that, /model inside Claude Code shows the routed model, and /status confirms the endpoint.

Kilo Code and the rest

Kilo Code is configured through its auth settings in ~/.local/share/kilo/auth.json: same base URL, same key, then pick a model from the catalog. Cline, Roo, Continue, Cursor, Droid, Codex, OpenClaw and others follow the same pattern — find the custom OpenAI-compatible endpoint in that tool’s settings and paste the two values. For a remote 9router server, the CLI has 9router connect http://host:20128.

The quickest sanity check is the built-in reporter:

9router show
9router show claude opencode kilo

On my machine it lists Claude Code, OpenCode and Kilo Code as connected, shows the base URL and masked key for each, and prints the models currently assigned. Codex, Cline, Pi and Droid show as not configured, which is a useful to-do list.

What I would warn you about

  • Free tiers change. A model that is free this month may be paid or gone next month, so keep a combo with more than one fallback.
  • Bind to 127.0.0.1 unless you genuinely need remote access, and keep the dashboard key out of screenshots and git commits.
  • Read the provider terms. Routing through a gateway does not change who receives your prompts; some services promise zero retention, others do not.
  • The tray process is always listening, and auto-update is only disabled here because I want to control when the router changes.
  • Do not paste real keys into documentation — including tutorials like this one.

Verdict

Installing 9router on Arch took minutes, but the useful part came afterwards: one key, one endpoint, and the freedom to move an agent from an expensive model to a cheap one to a free one without editing its config again. The token savers are a genuine bonus for agentic work. It is not magic free intelligence — the free models are only as reliable as the providers behind them — but as a way to stop paying three subscriptions for the same editor, it works.

Resources

Written on Arch Linux with 9router 0.5.119 in November 2026. Model IDs, free tiers and dashboard labels change quickly — always copy the current values from your own dashboard.

Similar Posts