Hermes Agent
Hermes Agent OpenRouter setup for tool calling
Updated 30 November 2026
You can connect Hermes Agent to OpenRouter with one key and choose the model that handles your chats and tool calls. If you’re weighing Claude Sonnet, Gemini or DeepSeek, check the exact model’s tool support and context window, then try a task where you can see whether Hermes actually used a tool.
The setup and limits below come from the Hermes Agent 0.23.5 source and documentation and the OpenRouter hosted API documentation, read on 30 November 2026. The OpenRouter Models API reference labels its spec version 1.0.0. See the Hermes provider guide, the OpenRouter Hermes integration and the Models API reference.
What Hermes Agent and OpenRouter each do
Hermes Agent is the open-source agent from Nous Research. OpenRouter is a hosted API that sends model requests to inference providers. Use OpenRouter’s API when your application needs access to models from multiple providers. Use Hermes with OpenRouter when you want an agent that can carry out tasks with tools. The model asks for a tool call through OpenRouter, then Hermes runs the tool and sends the result back to the model.
If you’ll run Hermes Agent yourself and still need to install it, follow the Hermes Agent installation guide first. If you use ReadyHermes, skip to OpenRouter on ReadyHermes.
Choose a model with tools and enough context
- Open the Models catalogue filtered for tool calling. The filter is
supported_parameters=tools. Look up the specific model you’re considering and copy its full ID in the form<author>/<slug>. - Check its context window, the amount of text the model can work with in one request. Hermes Agent 0.23.5 rejects an OpenRouter model at startup if Hermes resolves its window to fewer than 64,000 tokens. The Models API calls the advertised window
context_lengthand supports a minimum-window query parameter namedcontext. - If you plan to restrict routing to a provider, check the model detail page for the exact endpoint and its tool support. Several providers can serve the same model. Use the copy button beside a provider’s name for its routing slug, including any endpoint suffix.
OpenRouter’s setup tutorial calls out the 64,000-token context requirement. Check tool support separately. When the terminal picker refreshes from the live catalogue, it drops entries from its shortlist if their supported parameters omit tools. Models with missing capability data can still appear. If the refresh fails or no models pass the filter, Hermes can show a cached or curated list. Check your model in the catalogue and run the tool test below.
Connect OpenRouter from the terminal picker
If you use a named Hermes profile, use its command alias in place of hermes throughout this guide.
- Sign in to OpenRouter, create an API key on the API Keys page and copy it. If you’re testing a paid model, make sure your OpenRouter account has enough credits before sending the test message.
- In your terminal outside a Hermes chat, run
hermes modeland choose OpenRouter. Use the existing key if Hermes finds the one you want, or paste your new key when prompted. - Select your model. If its ID is missing from the terminal picker, choose Enter custom model name and paste the exact ID while staying on the OpenRouter provider.
The picker saves your default model with provider openrouter, base URL https://openrouter.ai/api/v1 and API mode chat_completions.
Set the key and model by hand
The paths below are for the default profile. If you use a named profile, edit its own .env and config.yaml files and apply the file permissions to its .env.
Open ~/.hermes/.env in a local text editor and add or update OPENROUTER_API_KEY=sk-or-..., replacing sk-or-... with your real key. On macOS, Linux or WSL, run chmod 600 ~/.hermes/.env to restrict access. Keep the file out of version control.
Update the model section in ~/.hermes/config.yaml as shown below and replace <author>/<slug> with the model ID you copied.
model:
default: <author>/<slug>
provider: openrouter
base_url: https://openrouter.ai/api/v1
api_mode: chat_completionsFor the hosted service, use the URL above and leave CUSTOM_BASE_URL and OPENROUTER_BASE_URL unset. CUSTOM_BASE_URL can override model.base_url, which takes precedence over OPENROUTER_BASE_URL.
To get a key through browser sign-in instead of adding one to .env, run hermes auth add openrouter --type oauth, open the authorisation link and approve access. If you’re connected over SSH, paste the code shown in the browser into the terminal prompt. Hermes saves the key in its credential pool. Then apply the model configuration above with your chosen model ID. Also leave OPENAI_BASE_URL unset so Hermes can use the pool.
Check the connection and run a tool call
- Start a fresh chat with
hermesorhermes --tuiand check the model shown on startup. Send a short message, then open the matching request in OpenRouter Logs to see its model, token usage and cost. - For the file test, open the terminal interface with
hermes --tuiif it isn’t already open. Put a short, unique, non-sensitive phrase in a text file in Hermes’s terminal environment. If you use SSH or a container, use the file path as it appears there. In the chat, enter/verbose verboseto show tool output. If the tools section is collapsed or hidden, enter/details tools expanded. Give Hermes the file’s path and ask it to useread_fileto report the phrase. Check that the phrase appears in both the tool output and the reply.
A successful chat reply checks that inference works. The file check exercises the tool loop. To verify the route, check for a Hermes fallback notice, then open the file test’s requests in OpenRouter Logs to see which model and provider handled them. For work that needs several tool calls, repeat these checks with a small version of that task.
Choose which provider serves a model
For the main OpenRouter route, Hermes passes preferences from provider_routing in ~/.hermes/config.yaml as the API request’s provider object. Set order, only and ignore as YAML lists of provider slugs. OpenRouter tries the providers in order first and can fall back to unlisted providers. The only list limits which endpoints can be used, and ignore excludes matching endpoints. A base provider slug can match several endpoints. To target a specific variant or region, put its full endpoint slug in only.
Set sort to price, throughput or latency to favour lower price, faster token generation or a quicker start to the response, respectively. Open a fresh terminal chat to test a routing change. If you run your own Hermes gateway for messaging channels, restart it to apply the settings to channel messages.
OpenRouter’s Hermes integration example labels price sorting the default. Follow the dedicated Provider Routing reference here because it describes how the service handles requests with no explicit routing preference. Hermes leaves sort unset unless configured. OpenRouter’s default routing weighs effective price, throughput, latency, reliability and tool-call quality. Explicit price sorting prioritises price.
With default routing, if your request includes tools and some providers for the model support it, OpenRouter routes only to those providers. If none support it, OpenRouter can still route the request and drop the parameter. To require support for every parameter Hermes sends, add or update this setting in provider_routing.
provider_routing:
require_parameters: trueIf the model has its own require_parameters setting under provider_routing.models, update it there too. Strict settings can leave no eligible provider.
Provider fallbacks, model fallbacks and Auto Router
- Another provider for the same model. OpenRouter’s
allow_fallbacksAPI setting defaults totrueand permits backup providers. Useonlyin Hermes to limit eligible providers. The tagged Hermes routing builder has noallow_fallbackssetting underprovider_routing. - Another model after an error. OpenRouter’s Chat Completions API accepts an ordered
modelsarray. The service can try the next model after a context validation error, rate limit or outage. The response’smodelidentifies the serving model and its rate applies. In Hermes, the agent manages its own orderedfallback_providerslist of provider and model pairs. It accepts OpenRouter entries. See the Hermes fallback model setup or the OpenRouter API fallback guide. - Let OpenRouter choose. Use
openrouter/autoas the OpenRouter model ID to give OpenRouter the model choice. It picks a model and reasoning effort for the request from a pool filtered by capabilities and restrictions, then routes to a provider for that model. The selected model can request tool calls. You pay its standard rate, with no added Auto Router fee. Auto Router is available only in OpenRouter’s global data region. If you send an API request with amodelsfallback list, leave other router models out of the same request. Pick a specific model when you need to verify a particular context window or repeat a test on the same model. See the Auto Router reference.
Fix key, credit, context and tool errors
The Hermes integration groups a credit check under its authentication advice. Use OpenRouter’s API error reference for the meanings of the status codes, and read the response message for the specific account or key limit involved.
- 401 invalid credentials. Read the error message and check that your key is active in OpenRouter. If you set the key directly, check
OPENROUTER_API_KEY. If you used browser sign-in or added a key to the credential pool, runhermes auth list openrouterto see which OpenRouter credentials Hermes has. After replacing an invalid key, start a fresh chat and retry. - 402 credits or spending limit. Read the error message. If your OpenRouter balance is too low, add credits. If the request itself is too large for the spending budget, shorten the prompt or add credits. If the message names a key limit, check the key’s settings. If other requests are temporarily tying up the spending budget, wait for them to settle before retrying. Follow the
Retry-Afterheader when present. OpenRouter can also return403for an exhausted guardrail, workspace or key budget. - Hermes stops at startup over the context window. Pick a model with at least 64,000 tokens of context. If Hermes detects a smaller window than the endpoint actually serves, set
model.context_lengthto the verified size in tokens. The setting overrides detection. - OpenRouter returns a context error during a request. The error type
context_length_exceededmeans the input and output together exceed the serving model’s context window. Reduce the request size or use a model with a larger window. - 404 with a message about no endpoints supporting tool use. Check the exact model ID and its tool-capable endpoints on OpenRouter. Review the
onlyandignorelists underprovider_routing, including any overrides for the model underprovider_routing.models. Check the allowed and ignored providers in your OpenRouter privacy settings too. Choose a tool-capable endpoint that those settings allow or pick another tool-capable model, then repeat the file check.
OpenRouter on ReadyHermes
Open the Model key panel in your ReadyHermes account during the trial or on a paid plan. Choose Your own API key, select OpenRouter, paste your key, then select a model or type its ID. The panel reads the list from OpenRouter’s /models endpoint at https://openrouter.ai/api/v1. Press Switch to my key. ReadyHermes sends a small test message with your key, then restarts the assistant on that key. The restart takes about a minute.
The panel covers key and model selection. ReadyHermes has no screen for editing Hermes config.yaml settings. The browser sign-in and advanced routing and fallback setups above have not been tested on ReadyHermes. See the ReadyHermes model options.
Questions
How do you connect Hermes Agent to OpenRouter?
Create an OpenRouter API key, run hermes model in your terminal, select OpenRouter, and enter the key and model ID. Make sure you have enough credits if you’re testing a paid model. Start a fresh chat with hermes or hermes --tui, send a message and find the matching request in OpenRouter Logs.
Which OpenRouter models support tool calling in Hermes Agent?
Filter the OpenRouter Models catalogue with supported_parameters=tools and check that the exact model has at least 64,000 tokens of context. If you restrict providers, check the endpoint’s tool support. In the terminal interface, enter /verbose verbose and verify the output of a read_file call.
Can Hermes Agent use OpenRouter Auto Router?
Yes, in OpenRouter’s global data region. Select openrouter/auto as the OpenRouter model ID. OpenRouter chooses a model and reasoning effort for the request, then routes it to a provider. The selected model’s standard rate applies.
What do OpenRouter errors 401 and 402 mean in Hermes?
A 401 means invalid credentials. Check the OpenRouter key, then check OPENROUTER_API_KEY or the Hermes credential pool, depending on how you signed in. A 402 can mean insufficient credits or a spending limit. Read the error message to see whether to add credits, shorten the request, check a key limit or wait before retrying.
Can you use your own OpenRouter key on ReadyHermes?
Yes. Open the Model key panel during the trial or on a paid plan, select Your own API key and OpenRouter, enter your key and choose a model. Press Switch to my key. ReadyHermes sends a small test message with your key, then restarts the assistant on that key. The restart takes about a minute.