9Router is a local proxy that sits between AI coding tools and model providers. A CLI or IDE agent such as Claude Code, Codex, Cursor, Cline, OpenCode, or OpenClaw points at an OpenAI-compatible endpoint on localhost, and 9Router translates the request into each provider's native format, tracks quota, refreshes OAuth tokens, and routes to the next configured provider when one hits its limit or returns an error.
Providers are grouped into tiers. Subscription providers (Claude Code, Codex, GitHub Copilot, Cursor) connect over OAuth and expose their quota windows; API-key providers cover OpenRouter, GLM, Kimi, MiniMax, OpenAI, Anthropic, Gemini, DeepSeek, Groq, xAI, Mistral, and around 30 more, plus custom OpenAI- or Anthropic-compatible endpoints; free-tier providers include Kiro AI, OpenCode Free, and Vertex AI credits. A combo is a named, ordered list of models across tiers, and requests fall through the list as quotas run out. Self-hosted speech-to-text, text-to-speech, and embedding servers (whisper.cpp, Kokoro-FastAPI, llama-server, vLLM, and others that speak the OpenAI shape) can be added by base URL.
Several token-saving layers run before format translation. RTK detects tool outputs such as git diff, grep, ls, and tree inside tool_result blocks and applies lossless filters, keeping the original text when a filter fails or grows the output. Headroom is an optional external /v1/compress proxy that 9Router calls and fails open around. Caveman and Ponytail inject system prompts that bias the model toward terse replies and minimal, YAGNI-first code. A per-request header, X-9Router-Token-Saver: off, bypasses all of them.
The dashboard shows token consumption per provider, reset countdowns (5-hour, daily, weekly), and an estimated cost figure that is a comparison against list API prices rather than a bill; 9Router itself does not charge, and payment goes directly to each provider. Configuration can be synced across devices, and the server runs on localhost, a VPS, Docker, or Cloudflare Workers.
Features
- OpenAI-compatible endpoint: any tool that accepts a custom base URL sends requests to http://localhost:20128/v1
- Format translation: OpenAI, Claude, Gemini, Cursor, Kiro, Vertex, Antigravity, Ollama, and OpenAI Responses formats are converted to the target provider's native shape
- Tiered fallback combos: ordered model lists that move from subscription to cheap to free providers when quota runs out or errors occur
- Quota tracking: live token counts, reset countdowns, and per-provider spending limits
- Multi-account routing: several accounts per provider with round-robin or priority routing and per-account fallback
- OAuth token refresh: subscription-provider tokens refresh before expiry without re-login
- RTK token saver: auto-detected, lossless compression of tool outputs before the request reaches the model
- Prompt-side savers: optional Headroom compression proxy, Caveman terse-reply mode, and Ponytail Lite/Full/Ultra minimal-code prompts
- Self-hosted speech and embeddings: STT, TTS, and embedding connections that point at your own OpenAI-shaped servers, with no cloud fallback for embeddings
- Request logging: debug mode records full request and response payloads for troubleshooting
- Cloud sync: providers, combos, and settings shared across devices
- Deployment options: localhost via npm or source, Docker and GHCR images, a VPS, or Cloudflare Workers
Integrates with
Caveman
Skill for Claude Code and 30+ agents that compresses replies into terse caveman-speak to cut output tokens
Claude Code
Terminal-based agentic coding tool that reads your codebase and runs tasks through natural-language commands
Cline
Open-source coding agent with one engine behind VS Code, JetBrains, a headless CLI, an SDK, and a parallel Kanban board
Codex
Lightweight coding agent that runs in your terminal
