RTK Token Saver
Compresses tool_result content (git diff, grep, ls, tree) inline before sending. Saves 20–40% input tokens per request.
The AI infrastructure layer beneath your favourite IDE. Route Claude Code, Cursor, and 98+ 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
98+ 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 — it never charges you anything. You only pay the underlying AI providers you connect, and many of them (Kiro, Antigravity credits, OpenCode, Gemini free tier, and more) have generous free tiers. The gateway itself is free forever.
kRouter is a self-hosted multimodal AI gateway. It exposes one local OpenAI-compatible endpoint (http://localhost:20128) that routes eight modalities — chat, text-to-speech, speech-to-text, image, video, embeddings, web search, and web fetch — across 98+ providers. A plain "LLM router" only switches between chat models; kRouter unifies every modality behind a single base URL and SDK.
Point Claude Code (or Cursor, Cline, Aider) at kRouter's local endpoint, then connect a free Claude backend like Kiro. kRouter's 3-tier fallback runs your free tier first, a cheap pay-per-token model as overflow, and only touches a paid key when nothing else is available — so most requests cost nothing.
Up to 92%. kRouter ships four token savers: RTK (lossless input compression, 20–40%), Caveman Mode (terse output, up to 65%), Headroom (context de-duplication, measured 92.4% on code-heavy requests), and PXPIPE (context-to-image compression). They stack — running RTK + Headroom + Caveman together on a long agentic session cuts token cost dramatically.
Yes. kRouter runs entirely on your own machine (or your own server). Your prompts, code, audio, and documents go straight from your machine to the provider you configured — there is no third-party proxy in the middle logging your data. It is self-hosted by design.
Any OpenAI-compatible client: Claude Code, Cursor, Cline, Aider, Continue, Roo, Windsurf, Kiro, OpenCode, Kimi, Gemini CLI, and more. kRouter also intercepts IDE traffic via MITM mode for clients that hardcode their endpoint, and translates between OpenAI, Claude, Gemini, Vertex, and Ollama request formats automatically.
Yes. Deploy kRouter on a $5/month VPS behind nginx or Tailscale and point every teammate's IDE at the shared endpoint so quota pools across the team. Headless providers like Kiro now support API-key (ksk_) auth, so you can connect them without a browser login on a server.
Run "npm install -g @sifxprime/krouter && krouter -t", then open the dashboard at http://localhost:20128/dashboard, connect a provider, and point your IDE at http://localhost:20128. Docker and source-build installs are also supported. It takes about 30 seconds.
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. Keep every prompt on your machine.
MIT licensed · v0.5.118 · Built in the open.
What you actually get