AnyRouter

Hermes Agent

Run Nous Research's Hermes Agent on AnyRouter — install the first-class provider plugin, drop in one key, and get a model picker that only offers tool-capable routes.

Hermes Agent (source on GitHub) by Nous Research is an autonomous coding agent that runs in your terminal and on the messaging platforms you already use (Telegram, Discord, Slack, Signal, SMS, WhatsApp, …), with persistent memory and scheduled tasks. AnyRouter publishes a first-class model-provider plugin for it, so pointing Hermes at AnyRouter is a plugin install plus one API key — and every call then flows through one gateway with unified billing.

Why route through AnyRouter

  • One key. The same sk-ar- key reaches every model Hermes can run.
  • A model list the agent can actually drive. The plugin filters the picker down to routes AnyRouter advertises as tool-capable, so you never select a model Hermes can't call tools on.
  • Audit logs. Every Hermes call lands in your dashboard with cost, latency, and tokens.
  • Free model swaps. Change model.default to any AnyRouter id without rotating keys.

Install the provider plugin

The plugin is in the Hermes plugin catalog under the name anyrouter:

hermes plugins install anyrouter
hermes plugins enable anyrouter

Installing a catalog entry only puts the plugin on disk — like any plugin it must be enabled before it loads, so run the second line. hermes plugins install anyrouter --enable does both in one step.

A catalog install checks out one exact commit that a Hermes maintainer reviewed, not a moving branch tip, so a later commit pushed to the plugin repo cannot change what you installed. Confirm it's live:

hermes plugins list     # anyrouter → enabled
hermes doctor           # provider health check

Other install paths. The catalog is the reviewed one and the one to prefer. If you'd rather install from git, the plugin lives in a subdirectory of its repo — Hermes takes that in the identifier, not in a flag:

hermes plugins install duyet/hermes-provider-anyrouter/anyrouter
# equivalently, an explicit fragment, or a GitHub browser URL:
hermes plugins install https://github.com/duyet/hermes-provider-anyrouter#anyrouter
hermes plugins install https://github.com/duyet/hermes-provider-anyrouter/tree/master/anyrouter

You can also install the plugin repository as a pip package — Hermes discovers it through the hermes_agent.plugins entry point:

pip install git+https://github.com/duyet/hermes-provider-anyrouter.git

Add your key

The plugin reads its credential from ~/.hermes/.env:

ANYROUTER_API_KEY=sk-ar-your-anyrouter-key

Get a key at anyrouter.dev. The same key also works against the OpenAI-compatible endpoint https://anyrouter.dev/api/v1.

Keep secrets in ~/.hermes/.env and everything else in ~/.hermes/config.yaml. You can also read and write config from the CLI without opening a file — hermes config get KEY prints a resolved value, hermes config set KEY VAL sets one, and hermes config check reports missing options.

Pick a model

hermes model                                          # interactive picker → anyrouter
hermes --provider anyrouter -m anyrouter/hermes       # or pin both for one run

hermes model opens the provider-and-model picker; hermes --provider / -m are the per-run overrides. --provider anyrouter works because the plugin registers anyrouter in Hermes's provider registry — the flag accepts any registered provider name, not only the bundled ones.

To make it the default, write it to ~/.hermes/config.yaml:

model:
  provider: anyrouter
  default: anyrouter/hermes

Take anyrouter/hermes as the default for agentic work. It is an AnyRouter routing meta-model, not a Nous Research model: it ranks the strongest tool-calling models and routes to the best available one, falling back automatically when a route is unavailable. It is billed to your AnyRouter credits at each underlying model's rate, so no BYOK keys are required.

To switch mid-session, use the /model slash command. Hermes applies the switch immediately but resets the prompt cache on the next message, so prefer switching early or in a fresh session.

Other ids in the catalog, all reachable from the same key:

ModelNotes
anyrouter/hermesAuto-routes the top tool-calling models, one best per upstream provider, with fallback — the agentic default
anyrouter/autoTop-usage and top stable platform models, mixing free-tier and credit-billed routes. Tools are optional here, so for agent loops stay on anyrouter/hermes
anyrouter/latestThe latest stable production chat model actually serving traffic
x-ai/grok-4.7Direct vendor route
moonshotai/kimi-k31M context, agentic
deepseek/deepseek-v4-flashFast, reasoning-capable

hermes model reads its list fresh from the AnyRouter catalog, so newly served tool-capable routes show up without reinstalling anything. To see the full catalog yourself:

curl https://anyrouter.dev/api/v1/models -H "Authorization: Bearer sk-ar-your-key"

What the plugin adds

  • Tool-capable picker filtering. AnyRouter's /api/v1/models annotates every route with a capabilities list. The plugin keeps only the routes advertising tool calling, so the picker never offers a model the agent can't drive. If the catalog is unreachable, or you point ANYROUTER_BASE_URL at a relay whose catalog isn't AnyRouter's to interpret, it falls back to the generic /v1/models list.
  • Sticky session grouping. Each request carries extra_body.session_id, which groups a conversation together in your request logs.
  • Routing preferences. extra_body.provider carries request-level preferences. See Route by provider.
  • Reasoning passthrough. extra_body.reasoning forwards Hermes's reasoning control; AnyRouter translates it to each upstream's native thinking control.
  • Meta-models surfaced. anyrouter/hermes and friends appear alongside plain vendor/model routes.
  • No attribution unless you ask. App-attribution headers are opt-in only.

Route by provider

AnyRouter can route each request across its upstream providers — sort by price/throughput/latency, pin or exclude providers, enforce data policies. With the plugin installed, Hermes's own provider_routing block is the lever, because the plugin forwards those preferences as extra_body.provider on every request:

provider_routing:
  sort: throughput            # price (default) | throughput | latency
  # only: [anthropic]         # only use these providers
  # ignore: [deepinfra]       # skip these providers
  # order: [anthropic, google]  # try providers in this order
  # require_parameters: true  # only providers supporting all request params
  # data_collection: deny     # exclude providers that may store/train on data

See Provider Routing for the full field list — including zdr, max_price, throughput/latency percentile thresholds, and the :nitro / :floor model-id shortcuts.

Optional settings

Add these to ~/.hermes/.env alongside the key.

ANYROUTER_BASE_URL

Overrides the default https://anyrouter.dev/api/v1 endpoint — useful when you sit behind a proxy or a self-hosted relay. The picker stops filtering by AnyRouter's capabilities field in that case, since the catalog behind a custom URL isn't ours to interpret.

ANYROUTER_APP_ATTRIBUTION=1

Opt in to app-attribution headers, which credit Hermes traffic in AnyRouter's public app rankings. Off by default; nothing is tagged unless you set it.

Use AnyRouter from inside Hermes

Beyond inference, AnyRouter ships an MCP server at https://anyrouter.dev/api/v1/mcp — browse models, check credits, and manage keys from inside the agent. Hermes reads MCP servers from the mcp_servers key in ~/.hermes/config.yaml; a remote HTTP server takes a url, plus headers or auth: oauth. Pick whichever auth path fits:

mcp_servers:
  anyrouter:
    url: https://anyrouter.dev/api/v1/mcp
    auth: oauth

Hermes opens a browser on the first connection and handles discovery, token exchange, and refresh. Pick a permission level at the consent page and manage or revoke tokens any time from the MCP dashboard.

After editing MCP config, run /reload-mcp in a session to pick up the change. AnyRouter's MCP endpoint is remote HTTP only — it exposes no stdio server. Full reference: AnyRouter MCP with other clients.

Verify

Send a message in hermes chat, then open your request logs. The call should appear within a second or two with the model name, token counts, and cost — confirmation Hermes is routing through AnyRouter.

Troubleshooting

unknown provider: anyrouter — the plugin isn't active. Run hermes plugins list and check it says enabled; a provider registered by a plugin is picked up by new sessions, so start a fresh one after enabling.

Model 'x' not found — the picker only lists routes AnyRouter currently serves with tool-calling support. Run hermes model to see the live list.

429 (rate limits) — Hermes runs tight loops with subagents and skills, which can burst beyond a single key's per-minute budget. If you see 429 Too Many Requests, back off and retry — the same key works again next window. Do not treat 429 as a permanent failure. See Rate Limits.

402 on the first call — the key has no credit left, or an upstream AnyRouter routes to is out of capacity. Check your balance in the dashboard, or pick another model.

Nothing is tagged as an app — expected. Attribution is opt-in; set ANYROUTER_APP_ATTRIBUTION=1 if you want Hermes traffic credited in the public app rankings.