Tiny proxy that exposes a single AI endpoint backed by OpenRouter's best currently-available free model — auto-discovers, scores, and falls back on failure.
- Polls OpenRouter's
/modelsevery 5 min and filters to zero-price models - Scores by context length, parameter count, and recent failures; picks the top one
- Proxies chat-completions requests to the selected model; transparently switches on errors
- Persists rolling stats (request/error/switch counters) to
data/stats.json
Bun runtime, no framework — a single server.js.
cp .env.example .env # add your OpenRouter key
bun run start # bun server.jsServer listens on PORT (default 3700).
- Required env:
OPENROUTER_API_KEY. Optional:PORT. - Generated state lives in
data/models.jsonanddata/stats.json— both git-ignored. nginx.confis an example reverse-proxy config.