WorldRouter

Skip to Content
AgentsHermes Agent

Hermes Agent Custom Provider Setup

Hermes Agent  by Nous Research reads provider settings from ~/.hermes/config.yaml. Connect its OpenAI-compatible custom provider to WorldRouter to access Claude, GPT, DeepSeek, GLM, Kimi, and 60+ models with one API key.

Note:

Coming from OpenRouter? See WorldRouter vs OpenRouter for model prices and differences. Need credits? Top up with card, Alipay, WeChat Pay, or stablecoin.

Fastest setup (choose one path)

If Hermes is already installed, use either path below. Otherwise, start with Prerequisites.

Option A: Interactive wizard (hermes model)

Run the built-in provider picker and select Custom endpoint:

hermes model

Enter these values when prompted:

  • Base URL: https://inference-api.worldrouter.ai/v1
  • API key: your key from the API Keys dashboard.
  • Model name: an exact ID from the Models page, such as claude-opus-4-6 or gpt-5.4.

Hermes saves the selection in ~/.hermes/config.yaml. Named providers in current releases use the providers: format shown below; older releases may save a legacy custom-provider entry.

Option B: Edit ~/.hermes/config.yaml directly

Add a named provider and make it the active model.provider. If the file already has providers: or model: sections, merge these settings into them instead of replacing the whole file:

providers: worldrouter: base_url: https://inference-api.worldrouter.ai/v1 key_env: WORLDROUTER_API_KEY transport: chat_completions models: claude-opus-4-6: {} claude-sonnet-4-6: {} claude-haiku-4-5: {} gpt-5.4: {} deepseek-v4-pro: {} gemini-3.8-flash: {} model: default: claude-opus-4-6 provider: custom:worldrouter

Export the key in the shell that launches Hermes:

export WORLDROUTER_API_KEY="your_api_key"

Then run a one-shot verification:

hermes -z "Reply with 'ok' if you can see this."

Prerequisites

Detailed config.yaml setup

1. Open your Hermes config file

Hermes reads settings from:

  • macOS / Linux: ~/.hermes/config.yaml
  • Windows: %USERPROFILE%\.hermes\config.yaml

For first-time setup, run hermes setup or hermes model to create the file. For an existing installation, preserve unrelated settings and add the WorldRouter provider to the existing provider map.

2. Understand the provider fields

  • providers.worldrouter names the provider. The worldrouter key is referenced by model.provider: custom:worldrouter.
  • base_url is https://inference-api.worldrouter.ai/v1. Keep the /v1 suffix for the chat-completions endpoint. Current Hermes also accepts api as the endpoint field.
  • key_env names the environment variable containing the key, without a $ prefix. To store a key inline instead, use api_key: your_api_key and omit key_env.
  • transport: chat_completions selects the OpenAI chat-completions format.
  • models lists exact, case-sensitive WorldRouter model IDs. Empty {} values use the defaults; per-model settings such as context_length can override them.
  • model.default selects the default model; model.provider selects the named provider.

Existing custom_providers configurations

Hermes still reads the older custom_providers: list. In that format, an entry has name: worldrouter and uses api_mode: chat_completions. Current releases use a providers: map with transport: chat_completions; hermes update can migrate the legacy format. Keep one WorldRouter entry rather than defining it in both formats.

See the Hermes Custom Providers reference  for the supported fields and migration details.

3. Persist your API key

For zsh or bash, add the export to ~/.zshrc or ~/.bashrc and reload the matching profile:

export WORLDROUTER_API_KEY="your_api_key" source ~/.zshrc # or: source ~/.bashrc

For fish, use its environment-variable syntax:

set -gx WORLDROUTER_API_KEY "your_api_key"

Alternatively, add WORLDROUTER_API_KEY=your_api_key to ~/.hermes/.env so Hermes loads it without changing your shell profile. Skip this step if you configured an inline api_key.

4. Verify traffic reaches WorldRouter

Run hermes -z "Reply with 'ok' if you can see this.", or start hermes chat and send a short prompt. Use -z for a one-shot prompt; a bare hermes "<prompt>" is not the same command.

Check the resolved provider with hermes doctor, then inspect the request on the Activity dashboard. Usage records can appear after the response; a missing entry by itself does not establish which provider served the call.

Switch or change provider in Hermes

To switch from OpenRouter, Anthropic, or another provider, run hermes model and select the provider and model you want.

For a manual change, update the top-level model: block and restart the Hermes session:

model: default: gpt-5.4 provider: custom:worldrouter

The suffix in custom:worldrouter must match the configured provider name. Select an exact model ID from the Models page and include it in the provider’s models: map when maintaining that list manually.

How it works

With this configuration, Hermes sends OpenAI-compatible chat-completions requests to https://inference-api.worldrouter.ai/v1/chat/completions using your WorldRouter key. WorldRouter routes the request to the selected model and records its usage against your account.

Model compatibility notes

  • Model families. Change model.default to switch between configured WorldRouter model IDs. The endpoint and key stay the same.
  • Provider-specific features. Tool use, reasoning parameters, and service tiers depend on the selected model and route. Check the model details before relying on provider-specific behavior.
  • Fallbacks. Hermes supports fallback provider configurations. If you configure one, inspect provider resolution and usage when verifying which route handled a request. See the Hermes fallback guide .

Troubleshooting

  • 401 Unauthorized: Confirm that WORLDROUTER_API_KEY is set in the shell that launches Hermes or in ~/.hermes/.env. Check for missing values or whitespace without printing the full key.
  • 404 Not Found or model not found: Confirm that base_url is https://inference-api.worldrouter.ai/v1 and that the model ID exactly matches the Models page.
  • Hermes still selects the previous provider: Restart the session after editing config.yaml, then run hermes doctor to inspect provider resolution.
  • Expected usage is missing: Check model.provider, base_url, any fallback configuration, and the Activity dashboard. Allow for usage-processing delay before drawing a routing conclusion.

Reference