
switchXprovider
Local multi-provider proxy for Claude Code — automatic failover, priority routing, auto-recovery, usage analytics, and a provider catalog
Install with your AI
Paste into Claude Code, Cursor, or any agent — it reads the repo and wires the tool into your project.
Install and set up switchXprovider (claude-plugin project) into my current project. Found on https://claudeers.com/switchxprovider Repo: https://github.com/shaheer-00/switchXprovider Homepage/docs: — Detected install method: claude-plugin → /plugin install switchxprovider@shaheer-00/switchXprovider Category: plugins. Platforms: cli, api, web. Read the repo's README for exact setup and env vars, then install it and wire it into my project. Claudeers Health Verdict: active; community-verified: false. Confirm the source before running anything.
/plugin marketplace add shaheer-00/switchXprovider /plugin install switchxprovider@shaheer-00/switchXprovider
git clone https://github.com/shaheer-00/switchXprovider
// compatibility
| Platforms | cli, api, web |
|---|---|
| Operating systems | — |
| AI compatibility | claude |
| License | MIT |
| Pricing | open-source |
| Language | HTML |
switchXprovider
Never stop coding when a provider dies.
A zero-dependency Claude Code plugin that routes your API traffic through a local proxy with automatic failover, auto-recovery, live usage analytics — and every provider free out of the box (free models, credits, or daily-login rewards), with more on the way.
Works with any Anthropic- or OpenAI-compatible endpoint — GLM, DeepSeek, Kimi, Gemini, OpenRouter, gateways, or your own server — so you can use any LLM (or free models) in Claude Code without forking it or routing through a middleman.
An alternative to OmniRouter — your keys, your machine, no middleman. An alternative to OpenClaude — no fork, keep the real Claude Code.

📷 More screenshots
| Providers — priority & failover state | Discover — curated catalog |
|---|---|
![]() | ![]() |
| Usage — per provider & model, estimated cost | Events — failovers, recoveries |
|---|---|
![]() | ![]() |
| Share — build a stats card, export as PNG | The card itself — 4 themes, 5 time periods |
|---|---|
![]() | ![]() |
| Pricing — per-model rates, aliases, recalculation | Settings |
|---|---|
![]() | ![]() |
| Help — common issues and fixes | Chaptions — per-project analytics |
|---|---|
![]() | ![]() |
✨ Highlights
| 🆓 Free providers included | Every provider in the shipped catalog has a free tier (free models, credits, or daily-login rewards) — and the catalog keeps growing |
| 🔀 Automatic failover | Provider dies mid-request? Retried on the next one before you notice |
| ✂️ Token saver | Oversized tool outputs (git diff, grep, error dumps) are compressed before they reach the provider — blank-line collapsing plus head/tail elision with a marker. Never touches prompts, user text, or images; never grows a request. On quota-metered free tiers, saved input tokens are free work |
| 🔁 Auto-recovery | Down providers are re-probed every 30s and return to rotation on their own |
| 🔑 Your keys, your machine | Traffic goes straight to the provider — no third party in the path |
| 🚀 Zero dependencies | One Node process, ~12 files, under 6,000 lines — readable in an afternoon |
| 📊 Usage & cost analytics | Tokens, latency, success rate, and estimated cost per provider / model / day |
| 💰 Pricing editor | Real market rates built in; set prices per model or per provider, alias same models under different names, and recalculate history when prices change |
| 🆘 Built-in Help | Troubleshooting view in the dashboard — claude-mem capture sync, stale proxy after updates, env-var conflicts, cooldowns, and more |
| 📤 Shareable stats card | Build a pretty usage card in the dashboard — pick period, stats, and theme — export or share it as a PNG |
| 🧭 Provider discovery | Curated catalog with one-click setup, plus community-maintained remote catalogs |
| ⟳ Model auto-fetch | Enter a base URL + API key and the dashboard pulls the provider's model list for you — no copy-pasting model IDs |
| 🏆 Chaptions | Per-project token & cost analytics with period filters (today / 7d / 30d / all-time), a stacked daily-usage chart, share donut, leaderboard with drill-down trends, and AI-generated analysis reports that run through your own providers |
How it differs from OmniRoute
Both projects solve "never stop coding when a provider dies" — but with opposite trust models. OmniRoute pools free community tokens and routes your traffic through their infrastructure. switchXprovider routes your traffic directly to providers you control.
| switchXprovider | OmniRoute | |
|---|---|---|
| Traffic path | Claude Code → your machine → your provider, directly | Claude Code → OmniRoute's gateway → pooled providers |
| Keys | Yours only — never leaves your ~/.claude | Pooled community keys handled by their service |
| Free tokens | Freemium providers built in + your providers' free tiers | ~1.5B/month pooled across 352+ providers |
| Footprint | One Node process, 0 dependencies, ~12 files | Full gateway infrastructure |
| Auditability | under 6,000 lines you can read in an afternoon | Centralized service |
| Provider choice | Any Anthropic-compatible endpoint you have a key for | Their supported provider pool |
| Usage analytics | Token/latency/success tracking of your traffic, locally | Gateway-side stats |
| Cost | Free (your provider usage) | Free tier + premium |
Pick switchXprovider if: you have provider keys or subscriptions (Anthropic, Z.AI GLM coding plan, DeepSeek, OpenRouter, gateways), want your API traffic to go straight to the provider with no middleman, and want a tiny auditable proxy instead of a service.
Pick OmniRoute if: you have no keys at all and want free pooled community tokens, accepting a third party in the path.
They also compose — run OmniRouter as one provider entry in switchXprovider, and its outage fails over to your backup key automatically.
How it differs from OpenClaude
OpenClaude (the open-source Claude Code fork) and switchXprovider both free Claude Code from a single provider — but one replaces the tool, the other keeps it. switchXprovider routes the real, official Claude Code to any LLM provider through a local proxy. Your plugins, skills, MCP servers, keybindings, and settings all keep working untouched.
| switchXprovider | OpenClaude | |
|---|---|---|
| Approach | Proxy plugin inside official Claude Code | Standalone fork — separate CLI, separate config (~/.openclaude) |
| Your setup | Keeps every plugin, skill, MCP server, and setting you already have | Fresh tool, fresh config — Claude Code plugins and config don't carry over |
| Failover | Automatic, mid-request, with auto-recovery and learning cooldowns | Manual /provider profile switching |
| Free providers | Catalog of free-tier gateways (free models, credits, daily rewards) built in | Bring your own endpoints |
| Usage analytics | Tokens, latency, success rate, estimated cost — per provider / model / day, with shareable PNG cards | — |
| Footprint | 0 dependencies, ~12 files, one Node process | Full CLI + gRPC server + VS Code extension |
Pick switchXprovider if: you like Claude Code itself and just want to run it on GLM, DeepSeek, Kimi, Gemini, OpenRouter free models, or any Anthropic/OpenAI-compatible gateway — with automatic failover when one dies.
Pick OpenClaude if: you want a fully separate, modified agent CLI and don't mind leaving the official tool and its plugin ecosystem behind.
They solve different problems honestly — but if your search was "use another provider in Claude Code without forking it", you're home.
🆓 Free providers, built in
The plugin ships with a curated catalog in which every provider has a free tier — free models, free credits, or daily-login rewards you can route through right away:
| Provider | Free offering |
|---|---|
| AgentRouter | Free GLM & DeepSeek models behind one endpoint |
| Bynara | Generous free tier — MiMo, DeepSeek, MiniMax free models; solid last-resort fallback |
| SeekAi | Free models at sign-up |
| GoRouter | Free tier + per-token Claude-family models, incl. thinking variants |
| TabiToken | Free tier — token-based, model IDs from your dashboard |
| BlueSminds | Free tier — Anthropic-compatible (new-api based) |
| B.AI | Free tier — invite-based |
| APInex | Free tier — "one API for every model" |
| OrcaRouter | 200+ models behind one API — free Claude Opus/Sonnet slots + free auto-router model |
| KiraAI | Free daily quota — GLM-5.3, MiMo, Qwen, Kira free models |
| TokenRouter | ⚠ Limited-time free GLM-5.3 — promo may end without notice |
| VyceAI | Free tier — Claude/GPT/DeepSeek/Gemini proxy, one key |
| OpenRouter | Rotating pool of :free models (Nemotron Ultra, Ling, …) — the big aggregator |
| OpenCode Zen | Free Nemotron/DeepSeek/MiMo tiers — Claude, GPT, Gemini behind one key |
| Google AI Studio | Free daily Gemini quota (rate-limited) — OpenAI protocol, auto-translated |
| NVIDIA NIM | Free starter credits — Nemotron + partners, OpenAI protocol, auto-translated |
Combine them with daily-login rewards (most gateways hand out free credits or tokens for a daily check-in — sign out and back in every day to claim) and failover, and you have a zero-cost coding pipeline with redundancy. More free providers are being added to the catalog continually — and you can plug in any community-maintained catalog via Settings → Remote catalog.
Affiliate disclosure: sign-up links in the Discover catalog are affiliate/referral links — signing up through them supports switchXprovider development at no extra cost to you.
Install
Via plugin marketplace (recommended):
/plugin marketplace add shaheer-00/switchXprovider
/plugin install switchXprovider@switchx-marketplace
Then run /switchx-install — it walks you through the whole setup (proxy start, adding a provider, switching settings.json over) and refuses to break your setup along the way.
Local, without the marketplace:
git clone https://github.com/shaheer-00/switchXprovider
/plugin marketplace add /path/to/switchXprovider
/plugin install switchXprovider@switchx-marketplace
Standalone (no plugin registration — dashboard and proxy only, no slash commands or auto-start hook):
git clone https://github.com/shaheer-00/switchXprovider
node switchXprovider/server/ensure.mjs
What it does
- Set-and-forget Claude Code config —
~/.claude/settings.jsonis written once (by the installer) with sentinel model names. Provider switches never touch it again, and no Claude Code restart is needed to fail over. - Priority routing — you set the provider order (1 = highest). Traffic always goes to the highest-priority healthy provider.
- Automatic failover — on failure the same request is retried on the next provider in the priority list:
Signal Meaning Base cooldown 401 / 403 bad or revoked key 60 min 402 out of credits 30 min 429 rate limited / usage window 5 min (respects retry-after)404 model missing on provider 2 min 5xx / 529 provider trouble 1 min network / timeout unreachable 30 s - Auto-learning cooldowns — cooldowns scale up to 8× with consecutive failures (exponential backoff), and honor upstream
retry-afterheaders. Each provider tracks requests, success rate, and EMA latency. - Auto-recovery — a background health loop re-probes down providers every 30s (and just before cooldown expiry); a recovered provider returns to rotation automatically at its priority (e.g. when your Claude subscription window resets, you drift back to provider #1 with zero action).
- Usage analytics — the proxy reads token usage (
input/output/cache_read/cache_creation) out of every response — streaming and non-streaming — without touching the stream, and tracks totals per provider, per model, and per day. The dashboard shows animated stat cards, a 14-day usage chart, per-provider token share, a per-model table, and a live request feed (model, tokens, latency, status). - Cost tracking — every request is priced against a per-model rate table (Claude models at official Anthropic rates, GLM/DeepSeek/Kimi/MiMo/MiniMax/Qwen at current market rates, explicit
-freevariants at $0), so you can see roughly what your traffic would cost if you paid per-token. Estimated cost shows up as a hero pill, a stat card with today/7-day breakdowns, per-day chart tooltips, per-provider bars, and a per-model table column. Estimates only — gateway subscriptions, credits, and promos aren't modelled. - Pricing editor — the Pricing view lists every model seen in usage, mapped on a provider, or known built-in, with its effective rate and where it comes from (built-in / your override / per-provider). Set a price universally or per provider (e.g. $0 for a free-tier gateway, market rate elsewhere). Models the same under different names across providers (GLM-5.2 / GLM-5.2-Free) are auto-detected and can be aliased to share one price while stats stay separate. Unpriced models are badged instead of silently costing $0. When a price changes, the dashboard asks whether to recalculate past usage with the new price or apply it from now on — recalculation is exact for per-provider/model/day tracked history, and there's a manual Recalculate costs button for history recorded before a price existed.
- Shareable stats card — the Overview's Share stats button opens a popup where you compose a usage card: pick a time period (today / 7d / 14d / 30d / all-time), toggle which stats show (tokens, estimated cost, daily chart, top provider & model), and choose one of four themes (Midnight, Aurora, Light, Terminal). The live preview is the exported image — download it as a PNG or hand it straight to the OS share sheet where the browser supports it. Rendered entirely in-browser on a canvas, no external services.
- Traffic flow playground — the overview's Traffic flow widget renders your providers as free-floating bubbles around the switchX core. Drag them anywhere (both sides), toss them and watch them bounce off the walls — purely cosmetic, nothing about routing changes. Edges redraw live as bubbles move; the active route keeps its animated gradient. Click a bubble to open that provider in the Providers view.
- Provider discovery — a curated catalog of gateways — all with free tiers (free models, credits, or daily-login rewards), and more added over time — with provider favicons, star ratings, pricing notes, filter chips (free tier / not added / remote), sorting, a featured row for the top-rated picks, expandable card details, and one-click prefill of the add-provider form. A remote catalog (same JSON schema, e.g. a raw GitHub file) can be set in Discover → Catalog source and overrides matching entries — useful for community-maintained lists.
- Config backup — export/import the full provider list (including keys) as JSON from the dashboard.
- Install status detection — the dashboard reads
~/.claude/settings.jsonand shows whether Claude Code is actually routed through the proxy. - Help & troubleshooting — a built-in Help view with the common problems and their fixes: claude-mem capture dying after proxy setup (with the credentials-sync hook fix), statusline plugins showing stale mode labels, the proxy serving old code after a plugin update, shell
ANTHROPIC_*env vars overridingsettings.json, providers stuck in cooldown, model-name mismatches across providers, $0 cost estimates, and a dead dashboard. - Deadlock protection — if every provider is down, cooldowns reset (at most once a minute) and the request is retried rather than hard-failing; a full outage returns a clear error instead of hammering dead providers on every request.
- Token saver — the proxy shrinks oversized
tool_resultcontent before forwarding: runs of 3+ blank lines collapse to one, and blocks over the threshold (default 12,000 chars) keep head 70% / tail 30% with an explicit[switchx elided N chars]marker so the model knows data was cut. System prompts, user text, tool_use blocks, and images are never touched; a block is never grown; output is deterministic, so prompt-cache prefixes stay valid. On by default — toggle it and set the threshold in Settings, and watch the saved-token counter grow. Free-tier quotas are metered in input tokens: this stretches them.
Setup
⚠️ Order matters. The moment
settings.jsonpoints at the proxy, ALL Claude Code traffic goes through it — if no provider is configured yet, Claude Code is completely stuck with no API access. So the installer runs checks and refuses to touchsettings.jsonuntil the proxy is running and at least one enabled provider has an API key.
Correct order:
node server/ensure.mjs # 1. start the proxy (daemonizes)
open http://127.0.0.1:8787 # 2. add a provider (API key + model IDs), click "test"
node scripts/install.mjs # 3. NOW switch Claude Code to the proxy (backs up settings.json)
# 4. restart Claude Code
Or as a plugin: the SessionStart hook auto-starts the proxy, and /switchx-install runs the installer with the same checks. --force skips them.
If Claude Code gets stuck after installing: restore the backup —
copy ~/.claude/settings.json.switchx-backup ~/.claude/settings.json— then fix the provider in the dashboard and re-run the installer.Shell/system
ANTHROPIC_*environment variables overridesettings.json— remove them or nothing here takes effect. The installer warns about conflicts it can see.
Use
- Dashboard: http://127.0.0.1:8787 — add/edit/delete providers as large status cards, reorder priority (▲▼), test connectivity (including a check that your configured model IDs actually exist on the provider), fetch a provider's model list straight from its API, watch status and the event log live, check estimated costs, and edit per-model prices in the Pricing view. The Traffic flow bubbles on the Overview page are draggable just for fun. The Share stats button on the Overview exports your usage as a shareable PNG card.
- Commands:
/switchx(status),/switchx-add(add provider),/switchx-install(run installer). - Config lives in
~/.claude/switchx/config.json(providers + keys + stats). Server log:~/.claude/switchx/server.log.
Adding a provider
In the dashboard or via POST /api/providers:
| Field | Notes |
|---|---|
baseUrl | e.g. https://api.anthropic.com, https://openrouter.ai/api/v1 — /v1 duplication is handled |
apiKey | provider key |
authStyle | auto (default — sends both header styles, works everywhere), or force anthropic / bearer for rare strict providers |
protocol | anthropic (default — /v1/messages) or openai (/chat/completions). OpenAI-protocol providers (Google AI Studio, NVIDIA NIM, Groq, …) are translated automatically — requests, responses, streaming, and tool calls — so Claude Code works unchanged. |
models | real model IDs for the opus / sonnet / haiku slots — the proxy maps switchx:sonnet → your value |
How the model mapping works
Claude Code sends model: "switchx:sonnet" (or opus/haiku) because that's what the installer put in settings.json. The proxy rewrites switchx:<slot> to the active provider's model for that slot before forwarding, so every provider can use completely different model names — including non-Anthropic gateways that expose Anthropic-compatible /v1/messages endpoints.
Security
- 🔒 Proxy binds to 127.0.0.1 only — never reachable from the network.
- 🔑 API keys are stored in plaintext in
~/.claude/switchx/config.json(same trust level as your~/.claudedirectory) and are masked in all API/dashboard responses.
Remote catalog schema
Host a JSON file (e.g. catalog.json in a GitHub repo, served via raw.githubusercontent.com) and paste its URL into Settings → Remote catalog. Entries with the same id as the built-in catalog override it:
{
"version": 1,
"updated": "2026-09-05",
"providers": [
{
"id": "my-gateway",
"name": "My Gateway",
"baseUrl": "https://api.example.com",
"authStyle": "auto",
"description": "What it is and why you'd use it.",
"website": "https://example.com",
"docsUrl": "https://docs.example.com",
"pricing": "per-token | subscription | free",
"freeTier": true,
"rating": 4.5,
"tags": ["community"],
"models": { "opus": "...", "sonnet": "...", "haiku": "..." }
}
]
}
id, name, baseUrl are required; everything else is optional. Ratings are editorial — set them yourself for your community.
Support
If switchXprovider saves your session, consider supporting development: ☕ Buy me a coffee
Files
.claude-plugin/plugin.json plugin manifest + SessionStart hook (auto-start)
server/server.mjs HTTP server: dashboard / API / proxy routing
server/ensure.mjs daemon bootstrap (used by the hook)
server/lib/config.mjs config + stats + event log (~/.claude/switchx/)
server/lib/proxy.mjs forwarding, model rewrite, failover, cooldowns
server/lib/translate.mjs Anthropic ⇄ OpenAI protocol translation (tools + streaming)
server/lib/compress.mjs token saver — tool_result compression before upstream
server/lib/health.mjs background probes, auto-recovery
server/lib/api.mjs management REST API
server/lib/pricing.mjs model rate table, aliases, cost recalculation
server/lib/routing.mjs flip routing on/off (proxy vs direct Anthropic)
server/catalog.json curated provider catalog (free-tier gateways)
public/index.html dashboard (single file, no external assets)
commands/switchx*.md slash commands
scripts/install.mjs one-time settings.json installer
test/run-tests.mjs end-to-end tests (failover, mapping, recovery)
// faq
What is switchXprovider?
Local multi-provider proxy for Claude Code — automatic failover, priority routing, auto-recovery, usage analytics, and a provider catalog. It is open-source on GitHub.
Is switchXprovider free to use?
switchXprovider is open-source under the MIT license, so it is free to use.
What category does switchXprovider belong to?
switchXprovider is listed under plugins in the Claudeers registry of Claude-compatible tools.
// embed badge
[](https://claudeers.com/switchxprovider)
// retro hit counter
[](https://claudeers.com/switchxprovider)
// reviews
// guestbook
// related in Claude Plugins
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explainin…
"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
financial-services — a Claude ecosystem project on GitHub.









