Skip to content
dhhieu113proPublic
forked from namhv94/ezRouter

About

⚡ Ultra-fast LLM router & proxy in Rust. Multi-account quota pooling (Gemini, Codex, Claude), Token Saver engine, sub-millisecond latency & embedded Web UI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

⚡ ezRouter (Termux fork)

Fork of namhv94/ezRouter — an ultra-fast LLM router & proxy written in Rust (multi-account quota pooling, Token Saver engine, embedded Web UI). Providers are configured externally via the /admin/providers admin interface (plus combos), so the router is external-provider-only via the database.

👉 See the original repo for full documentation, features, benchmarks, and releases.

Why this fork exists

The upstream prebuilt binaries and installer target Linux x86_64 only. This fork documents how to build and run ezRouter natively on an Android phone via Termux (aarch64).

Run on Android (Termux)

# 1. Toolchain
pkg update
pkg install git rust binutils

# 2. Build
git clone https://github.com/dhhieu113pro/ezRouter.git
cd ezRouter
cp .env.example .env
cargo build --release   # 10–40 min on a phone

# 3. Install as a global command + env file
./scripts/install-termux.sh

Start it:

ezrouter

Verify: curl http://127.0.0.1:20229/health · Console: http://127.0.0.1:20229/

LAN access is the default — the installer binds to 0.0.0.0, so other devices can open http://<phone-LAN-IP>:20229/ right away. Find the phone's LAN IP with ifconfig | grep -oE 'inet [0-9.]+' | grep -v 127.0.0.1.

⚠️ Plain HTTP on your LAN — the AG_API_KEY is visible to anyone on the network. Fine for home use; don't reuse a real credential.

Configuration

The binary reads plain env vars (AG_HOST, AG_PORT, AG_DATA_DIR, AG_API_KEY, AG_UPSTREAM_BASE_URL, AG_UPSTREAM_API_KEY, ...). The launcher loads them from ~/.ezrouter/env before starting, so edit that file to change settings:

AG_HOST=0.0.0.0
AG_PORT=20229
AG_API_KEY=123456
AG_DATA_DIR=/data/data/com.termux/files/home/.ezrouter/data
RUST_LOG=ezrouter=info,tower_http=info

AG_API_KEY doubles as the admin/console key (default: 123456 — change it before sharing the service outside your home network).

After rebuilding (cargo build --release), refresh the installed binary with ./scripts/install-termux.sh.

Run as a Termux service (auto-start, auto-restart)

With termux-services installed (pkg install termux-services), ezRouter runs supervised by runsv — it starts on boot after Termux opens, restarts on crash, and logs to ~/log/ezrouter/current:

pkg install termux-services
./scripts/install-termux.sh   # also creates $PREFIX/var/service/ezrouter
sv-enable ezrouter            # enable + start now and on future boots

Manage it with sv:

sv status ezrouter   # check state
sv down ezrouter     # stop (use sv-disable to also skip future boots)
sv up ezrouter       # start again
sv restart ezrouter  # pick up a new config in ~/.ezrouter/env

Logs are rotated by svlogd into ~/log/ezrouter/ — use tail -f ~/log/ezrouter/current to follow output.

Manual run (no install)

Still possible from the repo root so the web UI in ui/dist is found:

AG_HOST=0.0.0.0 AG_PORT=20229 AG_API_KEY=123456 AG_DATA_DIR=$HOME/.ezrouter/data \
  ./target/release/ezrouter

Use ezRouter as ZeroClaw's model provider

Point ZeroClaw at the ezRouter OpenAI-compatible gateway so all of ZeroClaw's agent traffic flows through ezRouter:

./scripts/setup-zeroclaw.sh     # idempotent; safe to re-run
zeroclaw self-test              # verify the wiring

This adds a zerorouter.9router provider profile (http://127.0.0.1:20229/v1, api key 123456) and routes the main agent to it with the default risk profile:

[providers.models.zerorouter.9router]
uri = "http://127.0.0.1:20229/v1"
api_key = "123456"
model = "ag/gemini-4-argon"

[agents.main]
model_provider = "zerorouter.9router"
risk_profile = "default"

💡 "Model: all" — ZeroClaw sends one model per profile. ezRouter is a router, so it accepts any model id and forwards it to whichever upstream you configure. To fan ZeroClaw across ezRouter's whole catalog, configure ezRouter's upstream (AG_UPSTREAM_BASE_URL / AG_UPSTREAM_API_KEY in ~/.ezrouter/env), then set the ZeroClaw profile model to any model ezRouter exposes (/v1/models).

Telegram channel

Have ZeroClaw answer in a Telegram chat — get a bot token from @BotFather (/newbot), then:

# one-shot: create the channel, set the token, and route the main agent to it
ZEROCLAW_TELEGRAM_TOKEN=8618519189:AA... ./scripts/setup-zeroclaw.sh

# or set the fields directly
zeroclaw channels create telegram main
# edit ~/.zeroclaw/config.toml: set bot_token, enabled = true under [channels.telegram.main]
zeroclaw config set agents.main.channels '["telegram.main"]'

Start the ZeroClaw daemon so it polls Telegram and routes messages to ezRouter:

zeroclaw daemon        # or: zeroclaw agent

Messages you send your bot are answered by the main agent through zerorouter.9router → ezRouter → upstream.

Credits

All credit for ezRouter goes to NamHV and the EzLabs team, released under the MIT license. This fork only adds Termux documentation.

About

⚡ Ultra-fast LLM router & proxy in Rust. Multi-account quota pooling (Gemini, Codex, Claude), Token Saver engine, sub-millisecond latency & embedded Web UI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages