Toolsiftly

9Router: Install the Local AI Gateway (Claude Code, Cursor, Codex)

By the Toolsiftly editorial team · Updated

9Router is a free, open-source, self-hosted AI gateway (MIT) that runs on your machine and sits between coding tools (Claude Code, Cursor, Codex, Cline, Copilot and other OpenAI-compatible clients) and upstream AI providers. “Local” means the router is local — the models still run at the providers you connect. Install it, open the dashboard at http://localhost:20128, connect providers, then point your tool at http://localhost:20128/v1. It can track subscription quota, compress tool outputs with RTK (the project claims about 20–40% fewer input tokens on tool-heavy requests), and fall back across providers you configure when a quota runs out. Source: github.com/decolua/9router. Docs: 9router.github.io. This page does not run 9Router for you.

What 9Router is (and isn't)

9Router
What it is Local OpenAI-compatible proxy / router with a dashboard
Made by Open-source project decolua/9router
Official site / docs 9router.com · docs
Licence MIT
Default local endpoint http://localhost:20128/v1
Install npm install -g 9router then 9router

It is not OpenRouter, LiteLLM Cloud, or a hosted model marketplace you pay per token through 9Router itself. You bring your own provider accounts (Claude Code / Codex subscriptions, API keys, free CLI providers the project documents). 9Router routes and compresses; upstream providers still bill or enforce their own quotas and terms.

Why people install it

From the official README and docs:

  • One endpoint for tools that only speak OpenAI-style APIs.
  • Quota tracking so subscription capacity is used before it resets.
  • Auto fallback across a combo of providers when one returns rate-limit / quota errors.
  • RTK (Request Token Kompression) — compresses bulky tool results (git diff, grep, ls, …) before they are sent upstream.
  • Optional Caveman mode (terser system-prompt style) to cut output tokens — documented on the project; leave it off if you need verbose answers.

Quick install (official)

npm install -g 9router
9router
  1. The dashboard should open at http://localhost:20128.
  2. Connect at least one provider in the dashboard (the docs walk through free and paid options).
  3. In Claude Code / Cursor / Codex / Cline (or any OpenAI-compatible client), set:
    • Base URL / Endpoint: http://localhost:20128/v1
    • API key: the key shown in the 9Router dashboard
    • Model: a model id your connected providers expose (examples in the project README)

Prefer the npm package or a clone of github.com/decolua/9router. Ignore lookalike “9router download” mirrors.

9Router vs OpenRouter (short)

9Router OpenRouter
Where it runs Your machine (or your VPS) Hosted service
Who you pay Your connected upstream providers / subscriptions OpenRouter’s own billing for the models you call through it
Main job Local routing, fallback, token compression Unified hosted API across many models
Best when You want local control and to stretch existing subscriptions You want a single hosted key without running a proxy

They solve related problems; 9Router is the self-hosted router. Similar self-hosted stacks people compare it with include OmniRoute and LiteLLM — pick based on whether you need a local dashboard + RTK (9Router) or another stack you already run.

Safety and terms

  • Upstream provider Terms of Service still apply. Using a local router does not rewrite those terms.
  • Keep API keys and OAuth tokens only on machines you trust.
  • For team / VPS installs, put TLS and access control in front of port 20128; the default local bind is for a single developer machine. Fallback only works after you connect more than one provider (or a combo) in the dashboard — one provider alone cannot fall back.

Related on Toolsiftly

Claude Haiku 5.5 vs GPT-6 Luna · GPT-6 Astra access & API cost · Claude Mem

Changelog

  • October 30, 2026 (midday ~12:20 UTC+8): GitHub decolua/9router still MIT; npm latest 0.5.112; default port 20128; install npm install -g 9router. Docs at 9router.github.io/en/. ~31.7k GitHub stars.

Frequently asked questions

What is 9Router?

9Router is a free MIT-licensed local AI gateway. It exposes an OpenAI-compatible endpoint on your machine (default http://localhost:20128/v1), routes requests across providers you connect, tracks quotas, and can compress tool outputs (RTK) before they are sent upstream.

How do I install 9Router?

Run npm install -g 9router, then 9router. The dashboard opens at http://localhost:20128. Connect providers there, then point Claude Code, Cursor, Codex or Cline at http://localhost:20128/v1 with the dashboard API key. Official source: github.com/decolua/9router and 9router.github.io.

Is 9Router free?

The 9Router software is free and MIT-licensed. Upstream model usage still follows each provider’s pricing or subscription quotas.

Is 9Router the same as OpenRouter?

No. OpenRouter is a hosted multi-model API. 9Router is a self-hosted proxy you run locally (or on your own server) with routing, fallback and RTK compression.

What port does 9Router use?

Default dashboard and API port is 20128. The OpenAI-compatible base path is http://localhost:20128/v1.

Does 9Router save tokens?

The project’s RTK feature compresses tool_result content before it is sent to the model. The README describes about 20–40% input-token savings on tool-heavy coding requests; your results depend on how chatty your tools are.

Where should I download 9Router?

Only from npm (package 9router), github.com/decolua/9router, or the project’s own site/docs (9router.com / 9router.github.io). Avoid third-party mirrors.

Facts checked against official documentation on . Official: GitHub, 9Router documentation, 9Router official site, npm.