wikis / Hermes / wiki / entities / provider-openrouter.md view as markdown
Overview
OpenRouter is the most-recommended single key for Hermes: an aggregator that fronts hundreds of models (Anthropic, Google, Meta, DeepSeek, …) behind one OpenAI-compatible API. Provider id: openrouter. One OPENROUTER_API_KEY unlocks the main model and — importantly — the default auxiliary model path: vision, web summarization, and MoA tools default to Gemini Flash via OpenRouter, so an OpenRouter key "enables these tools automatically" even when your primary provider is Nous Portal, Codex, or a custom endpoint. It is also the only provider with sub-provider routing controls (model switching covers the broader switching machinery).
Characteristics
- Setup:
OPENROUTER_API_KEYin~/.hermes/.env(keys look likesk-or-v1-...);OPENROUTER_BASE_URLoverrides the endpoint - Model id format:
vendor/model, e.g.anthropic/claude-sonnet-4,meta-llama/llama-3.1-70b-instruct; with an explicit provider prefix on the CLI:openrouter/meta-llama/llama-3.1-70b-instruct - Variant tags:
:free,:extended,:fastsuffixes are preserved across/modelswitches (added in version v0.9.0) - Provider routing (OpenRouter only):
provider_routinginconfig.yaml—sort(price/throughput/latency),only,ignore,order,require_parameters,data_collection(allow/deny) — passed viaextra_body.provideron every call - Catalog: live catalog refresh (v0.9.0); pulled from a remote manifest since version v0.12.0
- Response caching: explicit cache control on supporting models (version v0.13.0); 1-hour cross-session Claude prompt cache also applies on OpenRouter (version v0.14.0)
- Pareto Code router:
min_coding_scoreknob routes to the cheapest model meeting your coding-quality bar (v0.14.0) - Sticky routing: session_id passed in
extra_bodyfor in-session provider stickiness (version v0.15.0) - Credential pools: multiple OpenRouter keys rotate on 429/402/401 (
hermes auth add openrouter)
How to Use
# Set the key (auto-saves to ~/.hermes/.env)
hermes config set OPENROUTER_API_KEY sk-or-v1-your-key-here
# Pick a model interactively
hermes model
# Or per-session
hermes chat --model openrouter/meta-llama/llama-3.1-70b-instruct
Permanent config in ~/.hermes/config.yaml:
model:
provider: openrouter
default: anthropic/claude-sonnet-4
provider_routing:
sort: "price" # cheapest sub-provider first
ignore: ["Together"] # never route to these
require_parameters: true # only sub-providers supporting all params (tools, temperature, ...)
data_collection: "deny"
Add a second key to the pool:
hermes auth add openrouter --api-key sk-or-v1-your-second-key
Switch mid-session: /model openrouter:claude-sonnet-4. Aggregator-aware resolution keeps you on OpenRouter when the requested model is reachable through it.
Related Entities
- provider nous portal — the other aggregator-style choice; common fallback pairing in either direction
- provider anthropic, provider google ai studio — direct connections to models also reachable via OpenRouter (note:
provider_routinghas no effect on direct connections) - provider ollama local — local last-resort fallback in a typical chain
- version v0.9.0 — variant tags; version v0.14.0 — Pareto Code router; version v0.15.0 — sticky routing
- model switching — credential pools, fallback chains,
/model - auxiliary models — OpenRouter is the default auxiliary path
- configuration reference —
provider_routinglives inconfig.yaml
