RTK Token Saver
Compresses tool_result content (git diff, grep, ls, tree) inline before sending. Saves 20–40% input tokens per request.
One endpoint. Build everything.
The AI infrastructure layer beneath your favourite IDE. Route Claude Code, Cursor, and 95+ providers through a single OpenAI-compatible endpoint on your machine.
How it works
kRouter runs on your machine and exposes a single OpenAI-compatible endpoint at localhost:20128. Point any IDE at it. Behind the scenes it routes to your subscription first, falls back to free tiers, and only touches paid keys when nothing else works.
Your IDE
kRouter
:20128
95+ providers
one OpenAI-compatible API · subscription → free → paid fallback · RTK compression · format translation
Pick NPM if you just want it to work. Docker if you self-host. Git if you want to hack on the code.
npm install -g @sifxprime/krouterkrouter -tDashboard: http://localhost:20128/dashboard
Every feature ships with audited unit tests, end-to-end verification, and visible-in-the-dashboard observability.
Compresses tool_result content (git diff, grep, ls, tree) inline before sending. Saves 20–40% input tokens per request.
Optional terse-response prompt injection (Lite / Full / Wenyan) to cut output tokens up to 65% without losing technical substance.
Subscription → cheap → free. Combos auto-rotate when one quota hits zero. No more rate-limit interruptions.
Per-provider account selection: fill-first, round-robin (sticky), p2c, or random. Atomic backoff keeps concurrency safe.
In-memory cache for repeated non-streaming requests. Warmup probes and title generation skip redundant upstream calls.
Live token counts, reset countdowns, and per-model spend. Quota tracker matches Google's own backend numbers.
Intercept Antigravity, Kiro, Copilot, and Cursor IDE traffic locally. Bounds-checked frames, NGHTTP2 stream recovery.
Expose the dashboard over a public tunnel or Tailscale. Configurable access controls so it stays safe when shared.
OAuth, free credits, API key, and browser-cookie providers. Stack them into combos that auto-fall-through.
OpenAI ↔ Claude ↔ Gemini ↔ Cursor ↔ Kiro. Use any tool with any model. The translation layer handles the rest.
OAuth tokens refresh before expiration. Concurrent-safe — no stale-401 cascades when traffic spikes.
MIT licensed, self-hosted, never charges. The dashboard 'cost' is a savings tracker — you only pay providers directly.
OAuth subscription providers, genuinely-free tiers, and pay-per-token APIs. Stack them into combos so requests auto-fall-through.
All three projects share a common ancestor (CLIProxyAPI in Go). Each takes the idea in a different direction. Pick by fit, not loyalty.
FAQ
Yes. kRouter is MIT-licensed, open-source and self-hosted, and it never charges you anything. You pay only the AI providers you connect, and several have free tiers or free accounts (Kiro, OpenCode Free, OpenRouter, NVIDIA NIM and the Gemini API among them). Each provider sets its own limits.
kRouter is a self-hosted multimodal AI gateway. It exposes one local OpenAI-compatible endpoint (http://localhost:20128/v1) that routes chat, text-to-speech, speech-to-text, image generation, embeddings, web search and web fetch across 95+ providers, plus video through xAI. A plain "LLM router" only switches between chat models; kRouter puts every modality behind a single base URL.
Point Claude Code at kRouter's local endpoint, then connect a backend that serves Claude models, such as Kiro or a GitHub Copilot subscription you already have. A fallback combo tries your models in order, so you can put a free tier first, a cheap pay-per-token model next, and a paid key last.
20–40% fewer input tokens per request out of the box, from RTK, the only token saver that is on by default. The others are optional and off until you enable them: Caveman and Ponytail shorten replies, Headroom compresses repeated context through a separate Python proxy, and PXPIPE renders very large Claude context as images. What the optional savers save depends heavily on the workload.
kRouter is not a hosted service: it runs on your own machine or server, and requests go from there to the providers you connect. Each provider still sees what you send it. If you want less to reach them, turn on PII redaction (a Presidio sidecar, off by default), which removes names, emails, phone numbers and API keys from chat requests before they leave.
Any OpenAI-compatible client. The dashboard sets up Claude Code, Codex, OpenCode, Cline, Kilo Code, Factory Droid, OpenClaw and others for you, and has guides for Cursor (which needs a tunnel or cloud endpoint, not localhost), Roo, Continue and Amp. Antigravity, GitHub Copilot, Kiro and Claude Desktop have no endpoint setting, so kRouter routes them through local MITM interception. Requests are translated between the OpenAI, Anthropic and Gemini formats automatically.
Yes. Run kRouter on a VPS behind Nginx or Caddy, or expose it with Cloudflare Tunnel or Tailscale, and give each teammate a kRouter API key: callers on other machines always need one. Kiro can also connect with a long-lived API key (ksk_) instead of a browser login, which suits a headless server.
Run "npm install -g @sifxprime/krouter" and then "krouter -t" (Node.js 20.9 or newer), open the dashboard at http://localhost:20128/dashboard, connect a provider, and point your tool at http://localhost:20128/v1. Docker and source installs are also supported.
The new floor for AI coding
kRouter is the layer beneath your favourite IDE — Claude Code, Cursor, Antigravity, Copilot, Codex, Kiro. Connect any model. Switch providers on quota. Run it on your own machine.
MIT licensed · v0.5.194 · Built in the open.
What you actually get