Skip to content

Back to the catalog

luqman-v1/9router-go
github.comrepo

luqman-v1/9router-go

9router-go is a single-binary Go port of 9Router, an LLM gateway that sits between CLI coding tools (Claude Code, Cursor, Codex, Cline, OpenClaw, Gemini CLI, OpenCode) and 40+ AI providers/100+ models. It adds RTK token compression (claimed 20-40% token savings on tool_result content), tiered auto-fallback (subscription → cheap → free providers), multi-account round-robin, per-key proxy pools, and an embedded Svelte dashboard backed by SQLite, with database compatibility to share state with the original Next.js 9Router. It targets the practical problem of coding-agent subscription quota exhaustion and token cost, not a research contribution.

TL;DR Go-based LLM proxy/gateway with auto-fallback and token-saving compression for routing coding-agent traffic across many AI providers.
Document

What it claims

The repository presents one Go binary that serves the gateway APIs and the dashboard, with no Node.js runtime. The tiers it names are:

  • Subscription: Claude Code, Codex, GitHub Copilot.
  • Cheap: GLM at $0.6/1M, MiniMax at $0.2/1M.
  • Free: Kiro at about 50 credits/month, OpenCode Free with no auth, Vertex with $300 credits.

Beyond the summary, it adds per-combo routing strategies: fallback, round-robin, sticky, capacity, fusion, and capability-aware reordering. It also adds custom headers for compatible providers, arbitrary usage windows such as 14d or 12h, and a per-request payload inspector. It tracks upstream decolua/9router v0.5.85 at Go v1.9.9.

How to use it

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/luqman-v1/9router-go/main/install.sh | bash
# Windows (PowerShell, no admin needed)
irm https://raw.githubusercontent.com/luqman-v1/9router-go/main/install.ps1 | iex
docker run -d --name 9router-go --restart unless-stopped \
  -p 20130:20130 -v "$HOME/.9router:/data" \
  -e PORT=20130 -e DATA_DIR=/data \
  -e INITIAL_PASSWORD=your-secure-password \
  luqmenul/9router-go:latest

Defaults and configuration

  • It listens on port 20130 and stores data in ~/.9router.
  • Configuration is by environment variable only: PORT, DATA_DIR, DB_PATH, HOST, INITIAL_PASSWORD. There are no --port flags.
  • Daemon commands are start, status, restart, logs -n 100 and stop.
  • Point clients at http://localhost:20130/v1 with a dashboard-issued API key. For Claude clients, set ANTHROPIC_BASE_URL=http://localhost:20130/v1.
  • Models are namespaced by provider prefix, for example kr/claude-sonnet-4.5 and ag/gemini-3.8-flash-high.

API surface

  • Chat: /v1/chat/completions, /v1/messages, /v1/responses, and Ollama-style /api/chat.
  • Other generation endpoints: /v1/embeddings, image, video, TTS, STT and /v1/search.
  • Monitoring: SSE /api/usage/stream.
  • Proxy routes take Authorization: Bearer or X-API-Key.

Migrating from 9Router

  • Point 9router-go at the same DATA_DIR. There is no import step.
  • Both projects can run at once on different ports, for example 20128 and 20130. The supported setup is one active writer.
  • 9router-go adds lastUsedAt and consecutiveUseCount to providerConnections and adds an upstream_leases table. Upstream ignores both.
  • Back up first with cp -r ~/.9router/db ~/9router-db-backup, with the daemon stopped.

Building from source

  • Requires Go 1.27 and Bun 1.x.
  • Run make web-build, then make build.
  • Releases come with SHA256SUMS.txt.
  • Experimental builds are tagged exp. They are never latest, and 9router-go update won't install them.

The licence is MIT, with portions derived from 9Router (MIT).

Limits

Security

  • The default dashboard password is 123456.
  • The API server binds all interfaces by default.
  • Remote access blocks the default password, citing CVE-2026-56679. On a VPS, LAN or Docker host, set INITIAL_PASSWORD or use SSH port-forwarding.
  • Otherwise, bind HOST=127.0.0.1 or firewall the port.

Database

  • It will not import legacy 9Router JSON exports. Run upstream once to convert them first.
  • It does not interpret _meta.schemaVersion. A database written by a much newer 9Router should be checked before relying on it.
  • Running both projects against one database is safe only with a single writer at a time. Avoid editing the same combo or setting in both dashboards at once.

Windows

  • stop uses TerminateProcess, so in-flight streams aren't drained.
  • Use restart or the dashboard's Shutdown button for a graceful stop.

Unverified claims

  • The 20-40% RTK token saving comes with no benchmark, workload or baseline.
  • The free-tier credit figures and provider prices are the README's own and may change.

Organisations named here

  • Cursor
  • MiniMax
  • Cline
  • decolua

CVEs named here

  • CVE-2026-56679

Technologies named here

  • Go
  • OAuth
  • 9router-go
  • Claude Sonnet 4.5
  • 9Router
  • Gemini 3.8 Flash
  • GLM
  • Claude Code
  • Cursor
  • MiniMax
  • Antigravity
  • Codex
  • OpenCode
  • Cline
  • OpenClaw
  • GitHub Copilot
  • Kiro AI
  • OpenCode Free
  • Vertex
  • Docker
  • SQLite
  • Node.js
  • Bun
  • Google Antigravity
  • Gemini
  • Kiro

Techniques named here

  • RTK Token Saver
  • Auto fallback
  • Combo routing strategies
  • Multi-account round-robin
  • Proxy per API key
  • Additive schema bootstrap