9router
CLAUDE.md30k starsChanged 2 months agoMITView on GitHub
9Router (9router-app) — a local AI routing gateway + Next.js dashboard. It exposes one OpenAI-compatible endpoint (/v1/*) and routes traffic across 40+ upstream providers with format translation, model-combo fallback, multi-account fallback, OAuth/API-key credential management, token refresh, quota/usage tracking, and optional cloud sync. Two published artifacts live in this one repo: - The dashboard + gateway (root package.json, 9router-app) — the Next.js server that does the actual routing. - The CLI launcher (cli/, published to npm as 9router) — a separate…
- Reads credentials
- Installs packages
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about decolua/9router
- cheaper-inference/OmniRoute“docs(readme): restore 9router acknowledgment”GitHub · May 19, 2026 · 4 reactions
- cheaper-inference/OmniRoute“[Feature] Add support for CommandCode”GitHub · May 8, 2026 · 4 reactions
- @github-trending-js.bsky.social“📦 decolua / 9router ⭐ 1,342 (+31) 🗒 JavaScript Connect All AI Code Tools (Claude Code, Cursor, …”Bluesky · Mar 28, 2026 · 4 likes
- @github-trending-js.bsky.social“📦 decolua / 9router ⭐ 982 (+37) 🗒 JavaScript Connect All AI Code Tools (Claude Code, Cursor, Antigravity, …”Bluesky · Mar 16, 2026 · 3 likes
- cheaper-inference/OmniRoute“fix(opencode): send canonical free-tier identity headers”GitHub · Sep 17, 2026 · 2 reactions
The biggest 5 of 72 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 72
Talked about on GitHub and Bluesky (72 times).
On GitHub · 50
- May 19, 2026docs(readme): restore 9router acknowledgment — cheaper-inference/OmniRoute4 reactions · 1 comment
- May 8, 2026[Feature] Add support for CommandCode — cheaper-inference/OmniRoute4 reactions · 1 comment
- Sep 17, 2026fix(opencode): send canonical free-tier identity headers — cheaper-inference/OmniRoute2 reactions · 4 comments
- Jul 9, 2026Feature Request: Integrate 9router as an API Gateway for seamless multi-provider management and failover support. — praveen-ks-2001/hermes-agent-template2 reactions · 12 comments
- Oct 6, 2026fix(codex): gate models on the Codex CLI floor before the ChatGPT backend rejects them — paperclipai/paperclip1 reaction · 4 comments
45 more on GitHub
- Sep 17, 2026fix(opencode): resolve 403 FreeTierError (cherry-pick decolua#4105) — lehuygiang28/9router1 reaction · 1 comment
- Sep 1, 2026port(upstream): #3665 - normalize OpenRouter tool schemas — bloodf/durindoor1 reaction · 2 comments
- Jul 16, 2026port(upstream): #2558 - add reorder connections by availability button — bloodf/durindoor1 reaction
- Jul 16, 2026port(upstream): #2291 - verify fltmc Windows elevation probe via injectable isAdmin test — bloodf/durindoor1 reaction
- Jul 8, 2026port(upstream): #2454 — feat(keys): add daily token limits — bloodf/durindoor1 reaction · 3 comments
- Jul 8, 2026port(upstream): #2422 — fix: keep usage api key groups distinct — bloodf/durindoor1 reaction · 5 comments
- Jul 8, 2026port(upstream): #2443 — fix: prevent duplicate system prompt injection in multi-turn conversations — bloodf/durindoor1 reaction · 4 comments
- Jul 8, 2026port(upstream): #2452 — fix(codex): handle fast tier and capacity SSE — bloodf/durindoor1 reaction · 4 comments
- Jul 8, 2026port(upstream): #2453 — fix(usage): preserve provider-reported cost — bloodf/durindoor1 reaction · 4 comments
- Jul 8, 2026port(upstream): #2459 — perf(v1/models): resolve provider catalogs concurrently instead of serially — bloodf/durindoor1 reaction · 5 comments
- Jul 8, 2026port(upstream): #2463 — fix(minimax): resolve runtimeTransport/modelTargetFormat conflict and extract <think> for M3 — bloodf/durindoor1 reaction · 5 comments
- Jul 8, 2026port(upstream): #2470 — fix(kiro): preserve Claude session conversation id — bloodf/durindoor1 reaction · 2 comments
- Jul 8, 2026port(upstream): #2466 — fix(translator): clamp thinking effort max->xhigh for OpenAI provider (fixes 400 max effort not support) — bloodf/durindoor1 reaction
- Jul 6, 2026port(upstream): #2409 - feat(proxy-pools): auto-rotate strategy for no-auth providers — bloodf/durindoor1 reaction · 2 comments
- Jul 6, 2026port(upstream): #2402 - fix(build): isolate Windows HOME/AppData during next build — bloodf/durindoor1 reaction · 2 comments
- Jul 6, 2026port(upstream): #2345 - fix(codex): parse reset credit expiry details — bloodf/durindoor1 reaction · 2 comments
- Jul 6, 2026port(upstream): #2403 - feat(headroom): add extras detection and install UI — bloodf/durindoor1 reaction · 2 comments
- Jul 6, 2026port(upstream): #2392 - fix(stream): decloak tool names in claude to claude streaming passthrough — bloodf/durindoor1 reaction · 2 comments
- Jul 6, 2026port(upstream): #2389 - fix: align Antigravity with IDE request shape — bloodf/durindoor1 reaction · 2 comments
- Jul 6, 2026port(upstream): #2396 - fix(translator): make commandcode ensureState idempotent regardless of pre-s — bloodf/durindoor1 reaction · 3 comments
- Jul 6, 2026port(upstream): #2350 - feat(cli): add auto-ping toggle to TUI — bloodf/durindoor1 reaction · 2 comments
- Jul 6, 2026port(upstream): #2408 - fix(deps): remove fs placeholder package — bloodf/durindoor1 reaction · 2 comments
- Jun 24, 2026fix(translator): provider thinking compatibility (DeepSeek/Gemini) — cheaper-inference/OmniRoute1 reaction · 1 comment
- Jun 24, 2026feat(combo): task-aware routing strategy — cheaper-inference/OmniRoute1 reaction · 1 comment
- Jun 24, 2026fix(usage): dedupe request-usage logging and debounce stats — cheaper-inference/OmniRoute1 reaction · 3 comments
- Jun 22, 2026fix(combo): flatten Anthropic tool messages + tool history to prevent upstream 503 — cheaper-inference/OmniRoute1 reaction · 1 comment
- Jun 22, 2026feat(proxy-pool): Deno Deploy relays + group action buttons — cheaper-inference/OmniRoute1 reaction · 1 comment
- Jun 22, 2026fix(copilot,antigravity): cap maxOutputTokens at 16384 to stop "Invalid Argument" 400 — cheaper-inference/OmniRoute1 reaction · 2 comments
- Jun 22, 2026fix(opencode): preserve DeepSeek reasoning content in streamed responses — cheaper-inference/OmniRoute1 reaction · 1 comment
- Jun 22, 2026fix(cli): harden the systray2 tray runtime — cheaper-inference/OmniRoute1 reaction · 1 comment
- Jun 22, 2026fix(copilot): never route Gemini/Claude variants to /responses — cheaper-inference/OmniRoute1 reaction · 1 comment
- Jun 21, 2026fix(usage): clear auth-expired message for Kiro social-auth (Google/GitHub) accounts — cheaper-inference/OmniRoute1 reaction · 1 comment
- Feb 23, 2026iflow throws 406 error with OmniRoute — cheaper-inference/OmniRoute1 reaction · 3 comments
- Nov 18, 2026Live conformance tests pass, not skip, when no model is available — vx-daniel/pi-switchboard0 reactions
- Nov 18, 2026Responses API: accept freeform `custom` tools — vx-daniel/pi-switchboard0 reactions
- Nov 18, 2026Routing: a failed upstream credential (401/403) is retried on every request — vx-daniel/pi-switchboard0 reactions
- Nov 18, 2026Upstream 402 (billing, credit exhausted) has no class and answers 502 — vx-daniel/pi-switchboard0 reactions
- Nov 18, 2026Upstream 404 answers 502 upstream_error, not 404 model_not_found — vx-daniel/pi-switchboard0 reactions
- Nov 18, 2026Cooldowns: should a provider's stated wait be capped? — vx-daniel/pi-switchboard0 reactions
- Nov 18, 2026Deck: central per-operation model config, route non-harness calls through 9Router — simon-inkie/inkie-deck0 reactions
- Nov 13, 2026fix(thinking): nest reasoning effort for OpenAI-compatible /responses nodes — luqman-v1/9router-go0 reactions · 1 comment
- Nov 13, 2026fix(translator): extract in-body system messages to top-level system for Claude Messages — luqman-v1/9router-go0 reactions · 1 comment
- Nov 13, 2026feat(providers): add DeepSeek V4 Pro effort aliases (-max and -none) — luqman-v1/9router-go0 reactions
- Nov 13, 2026feat(claude): advertise Claude Code 2.1.322 and live model list via OAuth — luqman-v1/9router-go0 reactions
- Nov 13, 2026chore(providers): advertise Codex CLI 0.167.1 — luqman-v1/9router-go0 reactions
On Bluesky · 22
- Mar 28, 2026📦 decolua / 9router ⭐ 1,342 (+31) 🗒 JavaScript Connect All AI Code Tools (Claude Code, Cursor, Antigravity, Copilot, Codex, Gemini,… — @github-trending-js.bsky.social4 likes and reposts
- Mar 16, 2026📦 decolua / 9router ⭐ 982 (+37) 🗒 JavaScript Connect All AI Code Tools (Claude Code, Cursor, Antigravity, Copilot, Codex, Gemini,… — @github-trending-js.bsky.social3 likes and reposts
- Aug 3, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 decolua / 9router ⭐ 24,415 (+157) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code, Codex,… — @github-trending-js.bsky.social2 likes and reposts · 1 reply
- Jul 24, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 decolua / 9router ⭐ 23,371 (+169) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code, Codex,… — @github-trending-js.bsky.social2 likes and reposts
- May 12, 20269router looks useful https://github.com/decolua/9router #opensource #github #trending — @adityamitra.bsky.social2 likes and reposts
17 more on Bluesky
- Oct 1, 2026📦 decolua / 9router ⭐ 30,078 (+71) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code, Codex, Cursor, Cline, Copilot, Antigravity… — @github-trending-js.bsky.social1 likes and repost
- Aug 22, 2026📦 decolua / 9router ⭐ 26,048 (+69) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code, Codex, Cursor, Cline, Copilot, Antigravity… — @github-trending-js.bsky.social1 likes and repost
- Jul 11, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 decolua / 9router ⭐ 21,587 (+287) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code,… — @github-trending-js.bsky.social1 likes and repost · 1 reply
- May 8, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 decolua / 9router ⭐ 4,112 (+130) 🗒 JavaScript 🆓 Unlimited FREE AI coding. Connect Claude Code, Codex,… — @github-trending.bsky.social1 likes and repost
- May 6, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 decolua / 9router ⭐ 3,961 (+133) 🗒 JavaScript 🆓 Unlimited FREE AI coding. Connect Claude Code, Codex,… — @github-trending-js.bsky.social1 likes and repost
- Apr 22, 2026📦 decolua / 9router ⭐ 2,886 (+77) 🗒 JavaScript Connect All AI Code Tools (Claude Code, Cursor, Antigravity, Copilot, Codex, Gemini,… — @github-trending-js.bsky.social1 likes and repost
- Apr 9, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 decolua / 9router ⭐ 2,135 (+155) 🗒 JavaScript Connect All AI Code Tools (Claude Code, Cursor,… — @github-trending-js.bsky.social1 likes and repost
- Apr 1, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 decolua / 9router ⭐ 1,583 (+116) 🗒 JavaScript Connect All AI Code Tools (Claude Code, Cursor,… — @github-trending-js.bsky.social1 likes and repost
- Mar 10, 2026📦 decolua / 9router ⭐ 786 (+52) 🗒 JavaScript Universal AI Proxy for Claude Code, Codex, Cursor | OpenAI, Claude, Gemini, Copilot — @github-trending-js.bsky.social1 likes and repost · 1 reply
- Sep 8, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 decolua / 9router ⭐ 27,896 (+565) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code,… — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- Jul 7, 2026しかも README は Kiro を『free Claude unlimited』と書く一方、公式ガイドでは『~50 credits/mo』。ここ、かなり気になります。『無制限』というより、“無料枠が尽きたら次へ回す設計”と読む方が筋がいいです。無料側の持続性まで一息で読まない… — @mint-echosphere.bsky.social0 likes and reposts · 1 reply
- Jul 7, 2026一次ソースで見えた実体は、無限の新能力じゃなくて“購読枠→安価API→無料枠”の 3-tier fallback を 1 endpoint に束ねるローカル gateway です。9Router 自体は MIT で無料。でもコストは消えず、払う先が外部 provider… — @mint-echosphere.bsky.social0 likes and reposts · 1 reply
- Jul 6, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 decolua / 9router ⭐ 20,164 (+305) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code,… — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- Jun 20, 2026📦 decolua / 9router ⭐ 18,048 (+81) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code, Codex, Cursor, Cline, Copilot, Antigravity… — @github-trending-js.bsky.social0 likes and reposts · 2 replies
- Jun 2, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 decolua / 9router ⭐ 15,892 (+287) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code,… — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- May 12, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 decolua / 9router ⭐ 7,938 (+942) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code, Codex,… — @github-trending.bsky.social0 likes and reposts · 1 reply
- May 10, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 decolua / 9router ⭐ 6,978 (+806) 🗒 JavaScript Unlimited FREE AI coding. Connect Claude Code, Codex,… — @github-trending-js.bsky.social0 likes and reposts · 1 reply
In this repository10 other files it gives its agents.
- open-sse/AGENTS.mdAGENTS.md
- 9router-chatSkill
- 9router-embeddingsSkill
- 9router-imageSkill
- 9routerSkill
- 9router-sttSkill
- 9router-ttsSkill
- 9router-videoSkill
- 9router-web-fetchSkill
- 9router-web-searchSkill
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Default runtime port is 20128 (dashboard at /dashboard, API at /v1).
- Very specific: line 70
Never hardcode role/block/model strings — use open-sse/translator/schema/ and open-sse/config/ constants.
- Very specific: line 74
Add a provider: copy providers/REGISTRY_TEMPLATE.js, add models to config/providerModels.js.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What this is
9Router (9router-app) — a local AI routing gateway + Next.js dashboard. It exposes one OpenAI-compatible endpoint (/v1/*) and routes traffic across 40+ upstream providers with format translation, model-combo fallback, multi-account fallback, OAuth/API-key credential management, token refresh, quota/usage tracking, and optional cloud sync.
Two published artifacts live in this one repo:
- The dashboard + gateway (root
package.json,9router-app) — the Next.js server that does the actual routing. - The CLI launcher (
cli/, published to npm as9router) — a separate package that installs/starts the server and manages the tray. It has its ownpackage.json, version, and build.
The code lives in src/ (Next.js app + dashboard/compat APIs), open-sse/ (the provider-agnostic routing/translation engine), cli/ (the launcher package), and tests/.
Commands
Dashboard/gateway (run from repo root):
cp .env.example .env
npm install
PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run dev # dev (webpack, port 20127 by default via next dev)
npm run build && PORT=20128 HOSTNAME=0.0.0.0 npm run start # production- Bun variants:
npm run dev:bun/build:bun/start:bun. - Default runtime port is 20128 (dashboard at
/dashboard, API at/v1). - Lint:
npx eslint .(configeslint.config.mjs, extendseslint-config-next).
CLI package (cli/):
npm run cli:pack # build + npm pack from root
cd cli && npm run dev # nodemon watchTests (vitest, in tests/, an independent ESM package — not wired into root npm test):
npm install # ROOT deps first — tests import from src/ which needs `open`, `undici`, etc.
cd tests && npm install # then tests' own deps (vitest) → tests/node_modules (allowed by tests/.gitignore)
npx vitest run # all tests; auto-discovers tests/vitest.config.js
npx vitest run unit/capabilities.test.js # single file (path relative to tests/)The committed
tests/package.jsontestscript hardcodes Unix paths (NODE_PATH=/tmp/node_modules …) — a shared-install workaround from upstream. On Windows (or anywhere), ignore it and use thenpx vitestform above;vitest.config.jsresolves theopen-sse/@/aliases from the repo root regardless of where vitest lives.The suite is NOT expected to be all-green on a plain checkout. ~938 pass, ~64 fail. Judge regressions with
tests/__baseline__/verify-no-regression.mjs, not a raw run. Expected red:
- 26 catalogued in
tests/__baseline__/known-fails.txt(rtk, oauth-cursor-auto-import, translator-request-normalization, …).unit/embeddings.cloud.test.jsimportscloud/src/handlers/embeddings.js— thecloud/worker dir is not in this repo, so it always fails here.unit/xai-oauth-service.test.jstimes out (5s) when the xAI endpoint-discovery fetch isn't reachable/mocked.real/*.real.test.jsmake live provider calls — need credentials, skip otherwise.
*.real.test.jsundertests/translator/real/make live provider calls — skip unless credentials are set.- Regression baselines:
tests/__baseline__/verify-*.mjscompare against committed snapshots (providers, aliases, OAuth URLs). Run these after touching provider registry / alias logic.
Architecture
Two authoritative docs already exist — read them before working in these areas rather than re-deriving:
docs/ARCHITECTURE.md— full system: request lifecycle, combo/account fallback, OAuth + token refresh, cloud sync, data model.open-sse/AGENTS.md— the routing/translation engine's own conventions and "how to add a provider/executor/translator". Read this before editing anything underopen-sse/.
Request flow (the thing to understand first)
src/app/api/v1/* route (Next rewrite maps /v1/* → /api/v1/* in next.config.mjs)
→ src/sse/handlers/chat.js (parse, combo expansion, account-selection loop)
→ open-sse/handlers/chatCore.js (detect source format, translate request, dispatch to executor, retry/refresh, stream setup)
→ open-sse/executors/* (per-provider upstream call; default.js handles any OpenAI-compatible provider)
→ open-sse/translator/* (client format ↔ provider format)
→ SSE back to client.
src/sse/ is the app-side entry glue; open-sse/ is the provider-agnostic engine (also usable standalone). Cross that boundary consciously.
Translator engine (open-sse/translator/)
- Pivots through OpenAI as the intermediate format. A translator registered on an exact
source:targetpair (e.g.claude:kiro) runs as a direct route, skipping the lossy double-hop. Prefer a direct route for fragile pairs (thinking blocks, tool ids, non-base64 images,is_error). - Translators self-register via
register(from, to, reqFn, resFn)as an import side effect — a new translator file MUST be imported inopen-sse/translator/index.jsor it never runs. - Never hardcode role/block/model strings — use
open-sse/translator/schema/andopen-sse/config/constants. Config-driven and DRY is enforced by convention here.
Provider registry (open-sse/providers/registry/*)
- One file per provider.
providers/registry/index.jsis an auto-generated static import list — regenerate it withscripts/migrate-registry.mjs/injectDisplayToRegistry.mjs, don't hand-edit. - Add a provider: copy
providers/REGISTRY_TEMPLATE.js, add models toconfig/providerModels.js. Only add an executor for non-OpenAI-compatible upstreams.
Persistence — IMPORTANT (ARCHITECTURE.md is stale here)
State is no longer db.json. It's a SQLite layer under src/lib/db/ with an adapter fallback chain (driver.js): bun:sqlite → better-sqlite3 (optional native dep) → node:sqlite (Node ≥22.5) → sql.js (pure-JS fallback, always works). better-sqlite3 is deliberately in optionalDependencies so install never fails without build tools.
src/lib/localDb.jsis a backward-compat shim re-exportingsrc/lib/db/index.js. New code should import from@/lib/db/index.js; per-entity logic lives insrc/lib/db/repos/*. Schema/migrations insrc/lib/db/migrations/.- DB file location resolves via
src/lib/db/paths.js(DATA_DIR, else~/.9router/). - Usage/logs (
src/lib/usageDb.js,usage.json+log.txt) still live under~/.9routerand do not followDATA_DIR.
RTK token saver (open-sse/rtk/)
Pre-translate hooks that compress tool_result content in-place to cut tokens. Fail-open: any error returns null and leaves the body untouched — never throw out of them. Skips is_error/status:"error" results to preserve traces.
Conventions & gotchas
- Plain JavaScript (ESM), no TypeScript.
@/*path alias →src/*(jsconfig.json). custom-server.jswraps the Next standalone server to derive client IP from the TCP socket and strip attacker-controlledX-Forwarded-For— trusting forwarding headers only from a loopback reverse proxy. Preserve this when touching request/IP/rate-limit code.- Security-sensitive env:
JWT_SECRET(session cookie),INITIAL_PASSWORD(default123456— must override),API_KEY_SECRET,MACHINE_ID_SALT. Full env contract in.env.exampleand ARCHITECTURE.md's env matrix. - Binary/protobuf upstreams (kiro EventStream, cursor protobuf, commandcode NDJSON) don't round-trip through OpenAI — they're handled inside their own executor, not the translator.
- Security-first on PRs: Security is the top priority when reviewing or creating PRs. Audit authentication, credential/token storage & leaks, header manipulation (
X-Forwarded-For), and SSRF risks before functional logic. Always include explicit security warnings/notes when reporting PR reviews or changes to the user. - Versioning: root and
cli/are versioned independently; changes are logged inCHANGELOG.md. Commit style is Conventional Commits (fix(translator): …,feat(...)).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

