Skip to content

Latest commit

 

History

83 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ERouter

typing

Free AI router and token saver. Point Claude Code, Cursor, Codex or Cline
at one OpenAI-compatible endpoint. Auto-fallback, RTK, usage dashboard.

Why · Features · Architecture · Quick start · Docker · Config

License Next.js OpenAI compatible Docker Version

Stars Forks Last commit Issues PRs welcome


✨ Why

One gateway. Many providers. No vendor lock-in in the IDE.

Rate limits kill a coding session. ERouter sits in front of 40+ providers, keeps an OpenAI-shaped /v1 API, and fails over when the primary key is exhausted.

Pain What ERouter does
One provider hits 429 Auto-fallback down the configured list
Every tool wants a different base URL OpenAI-compatible /v1/chat/completions
Tokens disappear into the void RTK + basic cost tracking + dashboard
Keys live in five IDE settings One self-hosted gateway

Provider order is fallback priority. First entry is preferred. If every provider is rate-limited, the router returns a clear error instead of hanging. Start with 2–3 providers and reorder later in the dashboard or config.

🧩 Features

🔀 Multi-provider routing

Smart fallback across 40+ upstreams. No client changes.

📉 Token saver / RTK

Reduce wasted tokens. Track rough cost from the dashboard.

📊 Live dashboard

Monitor usage, reorder providers, inspect requests.

🔌 IDE drop-in

Claude Code, Cursor, Codex, Cline — point them at the local `/v1`.

🐳 Self-host

Next.js app + Docker Compose. Your keys stay on your machine.

🧰 CLI

Packed CLI under cli/ for install and ops workflows.

🏗 Architecture

flowchart LR
  IDE["Claude Code / Cursor / Codex / Cline"] --> GW["ERouter /v1"]
  GW --> D["Dashboard"]
  GW --> P1["Provider A"]
  GW --> P2["Provider B"]
  GW --> P3["Provider N"]
  P1 -.->|429 / down| P2
  P2 -.->|429 / down| P3
Loading

⚡ Quick start

git clone https://github.com/awhite0030/ERouter.git
cd ERouter
cp .env.example .env
npm install
npm run dev

Dev server listens on port 20127.

curl http://localhost:20127/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'

Full setup: docs/. Docker: DOCKER.md. CI: CI-CD.md.

🐳 Docker

cp .env.example .env
docker compose up --build

Production-oriented env uses PORT=20128 and DATA_DIR=/var/lib/erouter.

⚙ Configuration

Variable Purpose
JWT_SECRET Auth secret — set a long random value
INITIAL_PASSWORD First admin password
DATA_DIR Persistent data directory
PORT HTTP port (20128 in the Docker contract)
API_KEY_SECRET Endpoint proxy API key secret
REQUIRE_API_KEY Require API keys on /v1
ENABLE_REQUEST_LOGS Verbose request logging
OBSERVABILITY_ENABLED Metrics / observability switch
BASE_URL Public URL of this instance
HTTP_PROXY / HTTPS_PROXY Outbound proxy for upstream calls

Never commit real keys. .env is gitignored.

🤝 Contributing

PRs welcome. Chinese docs: README.zh-CN.md.

ERouter is a rebranded MIT derivative of 9router.

📄 License

MIT © 2026 A. White / ERouter contributors

footer

About

ERouter — FREE AI router & token saver. Connect Claude Code, Cursor, Codex, Cline to 40+ providers. Auto-fallback, RTK, dashboard.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages