Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

English | 한국어

Version License: Apache 2.0 npm downloads CI

Free model router CLI - discover, ping, and configure free AI models for OpenCode / OpenClaw.

free-router terminal demo

Install

npx @bytonylee/free-router # or npm i -g @bytonylee/free-router # or bunx @bytonylee/free-router # or bun install -g @bytonylee/free-router

Run

free-router

On first run, a setup wizard prompts for API keys (ESC to skip any provider).

If you accept the in-app update prompt (Y), free-router now updates globally and restarts automatically, so you can continue without running free-router again.

Ways to use free-router

  1. First-run onboarding wizard Launch free-router, open provider websites in-browser from the wizard, paste keys, and start.
  2. Interactive model search + target config Use / to filter models, then Enter to configure OpenCode, OpenClaw, or Hermes Agent.
  3. Quick API key rescue from main screen Press A (or R for expired/missing provider) to jump into key editing with auto browser opening for missing keys.
  4. Full settings workflow Press P to edit keys, toggle providers, run live key tests, and onboard missing keys provider-by-provider.
  5. Non-interactive best-model selection Run free-router --best to print the best responding model ID for scripts.

Providers

ProviderFree key
NVIDIA NIMbuild.nvidia.com - prefix nvapi-
OpenRouteropenrouter.ai/settings/keys - prefix sk-or-

API key priority: environment variable → ~/.free-router.json → keyless ping (latency still shown).

NVIDIA_API_KEY=nvapi-xxx free-router OPENROUTER_API_KEY=sk-or-xxx free-router # Optional: pause auto re-sorting while you scroll (milliseconds) FREE_ROUTER_SCROLL_SORT_PAUSE_MS=2500 free-router # Optional: disable rolling metrics cache and force legacy recompute path FREE_ROUTER_METRICS_CACHE=0 free-router

TUI

The interactive TUI pings all models in parallel every 2 seconds and shows live latency, uptime, and verdict. The selected row uses a stable marker, and redraws are deferred while the terminal is unfocused to avoid background-tab blinking.

Columns

ColumnDescription
#Rank
TierCapability tier derived from SWE-bench score (S+ → C)
ProviderNIM or OpenRouter
ModelDisplay name
CtxContext window size
AAArena Elo / intelligence score
AvgRolling average latency (HTTP 200 only)
LatLatest measured ping latency
Up%Uptime percentage this session
VerdictCondition summary (✓ Perfect / ✓ Normal / x Overloaded / …)

Default ranking: availability first, then higher tier first (S+ → S → A+ …), then lower latency.

Search bar provider badges:

  • Name:✓ key exists and looks healthy
  • Name:✗ provider appears expired/no-auth
  • Name:○ key missing

The ? help overlay and A API-key editor use the same terminal header/footer chrome as the main list. Their mode tags stay left-aligned, and help body text uses the same foreground color as the table rows.

Keyboard shortcuts

Navigation

KeyAction
/ kMove up
/ jMove down
PgUp / PgDnPage up / down
gJump to top
GJump to bottom

Actions

KeyAction
EnterConfigure current model for OpenCode / OpenClaw / Hermes
/Search / filter models (Enter in search = configure target)
AQuick API key add/change (opens key editor in Settings)
REdit API key for likely expired/missing provider
TCycle tier filter: All → S+ → S → A+ → …
PSettings screen (edit keys, toggle providers, test)
W / XFaster / slower ping interval
?Help overlay
q / Ctrl+CQuit

Sort (press to sort, press again to reverse)

KeyColumn
0Priority (default)
1Tier
2Provider
3Model name
4Avg latency
5Latest ping
6Uptime %
7Context window
8Verdict
9AA Intelligence

Target handoff

Pressing Enter on a model opens a target picker:

  • OpenCode~/.config/opencode/opencode.json with optional Save + Launch.
  • OpenClaw~/.openclaw/openclaw.json using agents.defaults.model.primary and agents.defaults.models.
  • Hermes Agent~/.hermes/config.yaml using the documented model.provider and model.default fields.

If OpenCode fallback remaps the provider (for example NIM Stepfun → OpenRouter) and the effective provider key is missing, free-router asks: Add API key now? (Y/n, default: Y).

If model metadata says the selected model is unsupported by the known target support list, free-router falls back to NVIDIA NIM deepseek-ai/deepseek-v4-pro as the default high-performance model.

Existing target configs are backed up before writing.

OpenClaw and Hermes Agent use their built-in openrouter / nvidia provider names. If FREE_ROUTER_EXPORT_PLAINTEXT_KEYS=1 is set, free-router also writes the selected provider key into OpenClaw env or Hermes ~/.hermes/.env; otherwise those tools should read provider keys from your shell environment.

When free-router launches OpenCode, it now sets OPENCODE_CLI_RUN_MODE=true by default (unless you already set it) to reduce startup log noise from plugin auto-update checks in the OpenCode TUI.

If you want OpenCode's default startup hook behavior instead, launch free-router with:

OPENCODE_CLI_RUN_MODE=false free-router

Settings screen (P)

Tip: press A from the main list to jump directly into API key editing. Tip: if a selected provider has no key, free-router auto-opens that provider key page in browser (once per provider per settings session), including when you move selection.

KeyAction
/ / j / kNavigate providers
EnterEdit API key inline
SpaceToggle provider enabled / disabled
TFire a live test ping
DDelete key for this provider
ESCBack to main list

Flags

FlagBehavior
(none)Interactive TUI
--bestNon-interactive: ping 4 rounds, print best model ID to stdout
--help / -hShow help

--best scripted usage

# Print best model ID after ~10 s analysis free-router --best # Capture in a variable MODEL=$(free-router --best) echo "Best model: $MODEL"

Requires at least one API key to be configured. Selection tri-key sort: status=up → lowest avg latency → highest uptime.

Config

Stored at ~/.free-router.json (permissions 0600).

{ "apiKeys": { "nvidia": "nvapi-xxx", "openrouter": "sk-or-xxx" }, "providers": { "nvidia": { "enabled": true }, "openrouter": { "enabled": true } }, "ui": { "scrollSortPauseMs": 1500 } }

ui.scrollSortPauseMs sets how long (ms) auto re-sorting stays paused after navigation input. FREE_ROUTER_SCROLL_SORT_PAUSE_MS overrides config. Set to 0 to disable pause.

Tier scale (SWE-bench Verified)

TierScoreDescription
S+≥ 70%Elite frontier
S60–70%Excellent
A+50–60%Great
A40–50%Good
A-35–40%Decent
B+30–35%Average
B20–30%Below average
C< 20%Lightweight / edge

Verdict legend

VerdictTrigger
x OverloadedLast HTTP code = 429
x UnstableWas up, now failing
x Not ActiveNever responded
- PendingWaiting for first success
✓ PerfectAvg < 400 ms
✓ NormalAvg < 1000 ms
x SlowAvg < 3000 ms
x Very SlowAvg < 5000 ms
x UnusableAvg ≥ 5000 ms

Development notes

  • TypeScript source of truth: src/
  • ESLint config is TypeScript: eslint.config.ts
  • Runtime JS output is generated only in dist/ via npm run build

License

Apache License 2.0. See LICENSE.

关于 About

The free AI model router, API for everyday AI work. Find the best option, compare results, switch with less friction.

语言 Languages

TypeScript39.1%
HTML29.0%
JavaScript23.7%
CSS6.0%
Shell2.2%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
422
Total Commits
峰值: 129次/周
Less
More

核心贡献者 Contributors