hermes-router


Stretch free AI quotas across providers. hermes-router sits between your app and a pool
of AI providers (Gemini, OpenRouter, Groq, and more). When one provider hits its rate limit,
it automatically tries the next. Requests can still fail when every configured option is
unavailable or exhausted.
It implements the commonly used OpenAI-compatible chat, embeddings, and models endpoints,
plus Anthropic's Messages endpoint. Compatible clients can usually connect by changing their
base URL and API key; unsupported OpenAI/Anthropic endpoints are listed in
Usage.
Your app ──────► hermes-router ──► Gemini → OpenRouter → Groq → … (tries each until one works)
(OpenAI SDK or localhost:8319
Anthropic SDK)
Highlights: OpenAI-compatible chat/embeddings/models + Anthropic Messages · automatic key rotation &
failover · smart routing (sends each request to the cheapest model that can handle it) ·
local models (Ollama / LM Studio) with cloud fallback · tool calling · embeddings ·
response caching (incl. optional semantic cache) · per-key budgets & rate limits ·
built-in web dashboard (just open http://localhost:8319/) · multi-instance
manager (monitor existing routers or launch Docker-backed routers) · usage analytics
(/v1/usage) with cost/spend tracking · circuit breaker for unhealthy providers ·
Prometheus /metrics · runs as a reboot-surviving service (hr service) · toggle
optional features with hr features · one structured auth.json for all your keys.
Documentation
The docs read in order, from zero experience to a running, monitored router:
Start here (assume no experience):
- 🚀 Getting started — what this is, key terms, your first message
- 📖 Concepts — plain-language glossary (LLM, token, agent, RAG…)
- 🧭 Routing Features — plain-language guide to how requests get routed (chat, tools, vision, embeddings)
Set it up:
- Deployment — Windows/macOS/Linux, Docker, Hugging Face Spaces, surviving reboots
- Providers — free & paid providers, sign-up links, capabilities
- Free model rankings — compare the default free models by quality and best use
- Configuration —
auth.json, main .env settings and provider patterns, core features vs. add-ons (hr features)
Build with it:
Operate & extend:
- Monitoring — web dashboard (
/dashboard), Instances manager, hr status, Prometheus /metrics, /v1/status (tokens, spend)
- VS Code Extension — monitor & manage the router, and use it as a model in Copilot Chat
- Context synchronization — keep extension context limits in sync with dashboard settings; coordinated upgrade and troubleshooting
Architecture
A single Python file (router.py) running a small Flask/Waitress server. One request
flows through it like this: