9router: Instructions file for Claude Code

CLAUDE.md

9router CLAUDE.md is an instructions file for Claude Code from decolua/9router. It costs 2,036 tokens per session, scanned A, original, MIT.

Repository instructions for working on 9Router, a local gateway and dashboard that sends AI requests to multiple providers. They describe its parts, commands, and request flow.

In plain words
What is it for?
Use them when developing, testing, or troubleshooting the 9Router repository. They cover setup commands and the main project areas.
Why use it?
They give an AI coding agent the background needed to navigate the repository and understand how the dashboard, gateway, command-line launcher, and routing code fit together.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

This is decolua/9router's own configuration. It tells Claude Code how to work on 9router itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything 9router configures →

About the project

9Router routes requests from coding tools such as Claude Code, Codex, Cursor, and Cline to AI models from many providers. Developers use it to reduce token usage, track subscription capacity, and switch automatically between subscription, cheap, and free models. The catalogue includes nine skills and one instruction for 9Router.

decolua/9router · 31,474 stars · on GitHub · 9router.com

Reuse

Borrowing it

Nothing to install: this file belongs to decolua/9router. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/decolua/9router/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/decolua/9router

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 9router CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/decolua/9router/claude-md/github.svg)](https://agentmods.dev/instructions/decolua/9router/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/decolua/9router/claude-md"><img src="https://agentmods.dev/badge/instructions/decolua/9router/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 9router CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/decolua/9router/claude-md"><img src="https://agentmods.dev/badge/instructions/decolua/9router/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,036 This file is loaded in full into every session.
When invoked 2,036 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02036 $0.02036
Opus 5.5 $0.00814 $0.00814
Sonnet 5.5 $0.00407 $0.00407
Haiku 4.5 $0.00204 $0.00204

Measured 1mo ago against content hash 09940b9bce20, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

9router CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 as 9router) — a separate package that installs/starts the server and manages the tray. It has its own package.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 . (config eslint.config.mjs, extends eslint-config-next).

CLI package (cli/):

npm run cli:pack       # build + npm pack from root
cd cli && npm run dev  # nodemon watch

Tests (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.json test script hardcodes Unix paths (NODE_PATH=/tmp/node_modules …) — a shared-install workaround from upstream. On Windows (or anywhere), ignore it and use the npx vitest form above; vitest.config.js resolves the open-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.js imports cloud/src/handlers/embeddings.js — the cloud/ worker dir is not in this repo, so it always fails here.
  • unit/xai-oauth-service.test.js times out (5s) when the xAI endpoint-discovery fetch isn't reachable/mocked.
  • real/*.real.test.js make live provider calls — need credentials, skip otherwise.
  • *.real.test.js under tests/translator/real/ make live provider calls — skip unless credentials are set.
  • Regression baselines: tests/__baseline__/verify-*.mjs compare against committed snapshots (providers, aliases, OAuth URLs). Run these after touching provider registry / alias logic.

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +1 lines · +66 tokens per session 09940b9bce20
  2. 1mo ago First seen · 92 lines · 1,970 tokens per session scan A 18e534304130

Subscribe to this mod's changes

9router CLAUDE.md is an instructions file published in the GitHub repository decolua/9router (31,474 stars, last pushed yesterday), licensed MIT. It adds 2,036 tokens to every session, about $0.0081 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,786 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deno copilot-instructions.md

Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.

denoland/deno · 3,077 tokens