Menu

How to add custom providers to the Hermes Agent model picker on WSL2

5 min read Manuel

The Hermes Agent picker (hermes model or /model in a session) is the heart of this agent's flexibility. You can add OpenRouter, custom endpoints (Ollama, vLLM, LM Studio) and OAuth providers, keep them always available and change model with a single command.

Two commands, two functions

hermes model (from the terminal, outside a session) — It is the complete wizard: it adds providers, configures API keys, runs OAuth flows, sets models. It is the only way to add a provider.

/model (inside an active session) — It can only switch between already configured providers and models. It does not add providers, it does not ask for API keys, it does not do OAuth.

If you do not see a provider in the picker, you probably have not configured it.
Exit the session (Ctrl+C or /quit), run hermes model, and add it.

Configuring OpenRouter

Interactive method

hermes model
  1. Select OpenRouter from the provider list
  2. Enter your API key (it starts with sk-or-...)
  3. Choose the model from the curated catalogue (400+ models, including the stealth ones)

The write goes to ~/.hermes/config.yaml:

model:
  provider: openrouter
  default: ~anthropic/claude-sonnet-latest

Quick method (non-interactive)

hermes config set OPENROUTER_API_KEY sk-or-v1-xxxxxxxxxxxx
hermes chat --provider openrouter --model '~anthropic/claude-sonnet-latest'

Or edit ~/.hermes/.env directly:

OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxx

Provider routing with OpenRouter

OpenRouter routes through hundreds of providers. You can control how:

provider_routing:
  sort: "throughput"          # "price" (default), "throughput", o "latency"
  # only: ["anthropic"]       # Solo questi provider
  # ignore: ["deepinfra"]     # Salta questi provider
  order: ["anthropic", "google"]  # Prova in quest'ordine
  data_collection: "deny"     # Escludi provider che conservano i dati

Shortcut: Add :nitro to any model to sort by throughput (e.g. ~anthropic/claude-sonnet-latest:nitro), or :floor for the minimum price.

Configuring custom endpoints (Ollama, vLLM, LM Studio)

Interactive method

hermes model
# Seleziona: "Custom endpoint (self-hosted / VLLM / etc.)"
# API base URL: http://localhost:11434/v1
# API key: ollama (o vuoto per server locali)
# Model name: qwen2.5-coder:32b
# Context length: 65536 ← minimo Hermes: 64K

config.yaml method

model:
  default: qwen2.5-coder:32b
  provider: custom
  base_url: http://localhost:11434/v1

provider: custom is a first-class provider, not an alias. It works with any OpenAI-compatible API.

WSL2: the localhost problem

On WSL2, localhost does not point to Windows. If your Ollama/vLLM server runs on Windows, you must use the Windows host IP:

# Trova l'IP di Windows da dentro WSL2
ip route show | grep -i default | awk '{print $3}'

Then use that IP:

model:
  default: qwen2.5-coder:32b
  provider: custom
  base_url: http://172.29.192.1:11434/v1  # IP Windows, non localhost

If instead the server runs inside WSL2, localhost works normally.

Fallback providers

Configure a chain of providers that Hermes tries in sequence when the first one fails:

fallback_providers:
  - provider: openrouter
    model: ~anthropic/claude-sonnet-latest
  - provider: openrouter
    model: ~google/gemini-flash-latest
  - provider: custom
    model: qwen2.5-coder:32b
    base_url: http://localhost:11434/v1

Useful for long sessions: if a provider goes down, Hermes automatically switches to the next one without interrupting the session.

Custom model aliases

Create aliases for models you use often, so you can call them with /model alias:

custom_providers:
  local-qwen:
    base_url: http://localhost:11434/v1
    api_key: ollama

model_aliases:
  fav: openrouter/~anthropic/claude-sonnet-latest
  grok: openrouter/~x-ai/grok-4
  local: custom:local-qwen:qwen2.5-coder:32b

Use in session:

/model fav
/model grok
/model local

Filtering providers in the picker

If you have many providers and want to reduce the noise, use picker_providers:

model:
  default: ~anthropic/claude-sonnet-latest
  provider: openrouter
  picker_providers:
    - openrouter
    - custom
ValueEffect
Not setShows all providers (default)
["custom"]Shows only custom providers
["openrouter", "custom"]Shows OpenRouter + custom
[]Not shown (edge case)

Complete example configuration

Here is a config.yaml with OpenRouter, local Ollama and fallback:

model:
  provider: openrouter
  default: ~anthropic/claude-sonnet-latest
  picker_providers:
    - openrouter
    - custom

provider_routing:
  sort: "throughput"
  data_collection: "deny"

fallback_providers:
  - provider: openrouter
    model: ~google/gemini-flash-latest
  - provider: custom
    model: qwen2.5-coder:32b
    base_url: http://localhost:11434/v1

custom_providers:
  local-qwen:
    base_url: http://localhost:11434/v1
    api_key: ollama

model_aliases:
  fav: openrouter/~anthropic/claude-sonnet-latest
  local: custom:local-qwen:qwen2.5-coder:32b

Troubleshooting

Provider not visible in the picker: It is not configured. Exit the session and use hermes model to add it.

/model does not show a specific model: It might not be in the curated catalogue. Use /model provider:model to force it, or check that the model supports tool-calling.

WSL2: connection refused to the custom endpoint: You are probably using localhost instead of the Windows IP. Find the IP with ip route show | grep -i default | awk '{print $3}' and use it in base_url.

API key not recognised: Check ~/.hermes/.env for environment variables, or run hermes model again to re-enter it.

Model with too small a context: Hermes requires a minimum of 64K tokens. If your local model has less, set context_length manually in the config.

References


TAG: #wsl2 #openrouter #ai