Universal local AI proxy — multi-key rotation, quota control, analytics, and smart free routing for any OpenAI-compatible coding agent (OpenCode, Grok Build, Codex, Antigravity, Claude Code, Cline, Continue, Cursor, and more).
Free Router is a self-hosted proxy that sits between your coding agent and a fleet of free / cheap AI providers. It exposes a single OpenAI-compatible /v1 endpoint (http://127.0.0.1:8787/v1) and transparently:
- Rotates API keys across many accounts per provider, with per-key cooldowns.
- Routes requests through a configurable fallback chain (OpenRouter → Gemini → Zen → ZenMux → FreeModel → LLM7 → Workers AI → Featherless → iamHC).
- Recovers from transient failures (5xx / network blips) without freezing a provider for 24h — single-key free providers stay usable.
- Streams tokens as they are generated (no buffering before the first token).
- Syncs config to OpenCode and Grok Build, and works with any client that supports an OpenAI-compatible base URL.
- Drives real browser sessions (ChatGPT, Gemini) via an embedded Electron browser — no API key needed.
| Capability | Notes |
|---|---|
| Multi-provider routing | Sequential failover across 9 providers out of the box |
| Multi-key rotation | Per-provider key pools with cooldown & quota awareness |
| Smart cooldowns | Soft cooldown for transient errors; hard cooldown only for genuine quota exhaustion |
| Streaming | First token is sent to the client immediately |
| Model registry | Enable/disable, reorder, set default / compaction / small models |
| Vision sub-agent | Routes images to a vision model when the target model lacks vision |
| Browser sessions | Experimental — drive ChatGPT / Gemini through logged-in browser tabs (no API key). Currently broken, see Known limitations. |
| Analytics | SQLite-backed dashboard, requests, key usage, events |
| Agent integrations | One-click OpenCode + Grok Build sync; universal /v1 for everything else |
- Browser proxy is currently not working. The "Browser Sessions" feature (driving ChatGPT / Gemini through the embedded Electron webview) is experimental and is broken in this release — requests fail with errors such as
Browser session not startedorFailed to open a new tab. Use the API-key providers (OpenRouter, Gemini, Zen, ZenMux, FreeModel, LLM7, Workers AI, Featherless, iamHC) instead; they are fully functional. Browser sessions will be fixed in a future update. Track progress / report details in Issues. - The proxy binds to
127.0.0.1(localhost) only. Do not expose it on0.0.0.0without a reverse proxy + auth. state-*.json,settings.json, and*.sqliteare local runtime data and are git-ignored.
┌──────────────┐ http://127.0.0.1:8787/v1 ┌─────────────────┐
│ Coding Agent │ ───────────────────────────────▶ │ Free Router │
│ (OpenCode, │ OpenAI-compatible chat/completions │ (Node proxy) │
│ Grok, Codex,│ │ + Electron UI │
│ Claude…) │ ◀─────────────────────────────── │ │
└──────────────┘ streamed responses └────────┬───────┘
│ routes / failover
┌──────────────────────────────────────────┼─────────────────────────┐
▼ ▼ ▼ ▼ ▼ ▼
OpenRouter Gemini Zen ZenMux FreeModel LLM7 Workers AI …
src/index.js— HTTP server, admin API, request routing.src/router.js— failover / provider-selection logic.src/key_pool.js— per-provider key rotation + cooldown policy.src/model_registry.js— model catalog, OpenCode/Grok config generation.src/providers/— OpenRouter-compatible, Gemini, and browser providers.electron/— desktop shell (tray, embedded browser, webview bridge).frontend/— React/Vite dashboard (keys, models, dashboard, browser sessions).
- Download
Free Router Setup 1.0.0.exefrom the Releases page and install. - Open Free Router, go to API Keys, and paste keys for the providers you want.
- On the Settings page, click Sync OpenCode config (or Sync Grok config), or just point any agent at
http://127.0.0.1:8787/v1. - In your agent, set the model to e.g.
fusion/tencent/hy3orfusion/mimo-v2.5.
Note: The Browser Sessions tab (ChatGPT / Gemini via embedded browser) is currently non-functional — see Known limitations. Use the API-key providers, which work.
- Node.js ≥ 20
- A terminal (PowerShell / bash)
# Install root + frontend deps
npm install
npm --prefix frontend install
# Configure your keys
cp settings.example.json settings.json
# edit settings.json and paste your provider API keys
# Run the proxy (port 8787)
npm start
# or with hot reload: npm run dev
# In a second terminal, run the dashboard (Vite on :5173)
npm run frontend:dev
# Build the desktop app
npm run app:build:win # Windows NSIS installer -> release/Instead of (or in addition to) settings.json, you can use a .env file. See .env.example for every supported variable (e.g. OPENROUTER_KEYS_JSON, ZEN_KEYS_JSON, GEMINI_API_KEY, WORKERSAI_ACCOUNT_ID).
Free Router is a standard OpenAI-compatible API. For agents without a dedicated sync button, set:
| Setting | Value |
|---|---|
| Base URL | http://127.0.0.1:8787/v1 |
| API Key | anything (e.g. free-local) |
| Model | fusion/tencent/hy3, fusion/mimo-v2.5, fusion/z-ai/glm-5.2, … |
On the Settings page click Sync OpenCode config — it writes ~/.config/opencode/opencode.jsonc. The default model is set automatically.
Click Sync Grok config — it injects [model.*] entries into ~/.grok/config.toml while leaving your Grok login default intact. Switch with /model.
Point the agent's OpenAI-compatible base URL at http://127.0.0.1:8787/v1 with any placeholder key. No extra setup required.
| Model ID | Provider | Notes |
|---|---|---|
fusion/tencent/hy3 |
OpenRouter | Default model |
fusion/mimo-v2.5 |
Zen | Free MiMo v2.5 |
fusion/z-ai/glm-5.2 |
ZenMux | GLM 5.2 |
fusion/gemini-3.5-flash |
Gemini | Vision + reasoning |
fusion/gpt-5.5 |
FreeModel | |
fusion/workersai-glm-5.2 |
Workers AI | |
fusion/iamhc-glm-5.2 |
iamHC | GLM 5.2 |
fusion/iamhc-minimax-m3 |
iamHC | MiniMax M3 |
Add, enable/disable, and reorder models from the Models page.
router.default_route (in settings.json) controls failover order:
"default_route": ["openrouter", "gemini", "zen", "zenmux", "freemodel", "llm7", "workersai", "featherless", "iamhc"]- Soft cooldown (
soft_cooldown_ms, default 15000): applied on transient 5xx / network errors. Does not block key selection — keeps single-key free providers alive. - Hard cooldown (
cooldown_ms, default 86400000 = 24h): applied only after repeated genuine exhaustion (quota / 429 storm). Even then, the router still allows the last key through rather than returning a permanent 503.
Each provider supports keys, base_url, model_id, supports_images, daily_token_limit, max_retries, cooldown_ms, soft_cooldown_ms, state_file, api_style (openrouter-compatible | gemini). See settings.example.json.
openrouter-key-pool-proxy/
├── src/ # Node proxy (router, key pool, providers, registry)
├── electron/ # Desktop shell + embedded browser sessions
├── frontend/ # React/Vite dashboard
├── models.json # Default model/provider catalog
├── settings.example.json
├── .env.example
└── README.md
- Never commit
settings.jsonor.env— they contain real API keys. They are git-ignored by default. - The proxy binds to
127.0.0.1(localhost) only. Do not expose it on0.0.0.0without a reverse proxy + auth. - See SECURITY.md for reporting vulnerabilities.
- Dedicated one-click config generators for Codex / Claude Code / Antigravity.
- Per-model latency-aware routing (replace static
default_routewith live scoring). - Automatic provider model discovery on first run.
MIT © Free Router contributors.