hermes - 💡(How to fix) Fix [Bug]: provider: ollama not recognized by auxiliary_client.py — silently falls back to OpenRouter

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

provider: ollama is recognized by model_metadata.py (line 61, lists it as a known local server type) but is NOT handled in auxiliary_client.py's resolve_provider_client. The two code paths are out of sync.

Fix Action

Workaround

Change model.provider to custom — the custom branch explicitly reads base_url from config and routes all traffic (main loop + aux) to the local endpoint:

model:
  provider: custom
  default: qwen3.6:35b-64k
  base_url: http://localhost:11434/v1

This works because resolve_provider_client's custom branch (~line 2278) reads explicit_base_url, falls back to OPENAI_BASE_URL, and defaults to "no-key-required" if no API key is set — correct for local Ollama.

Code Example

model:
  provider: ollama
  default: qwen3.6:35b-64k
  base_url: http://localhost:11434/v1

---

# agent/auxiliary_client.pyresolve_provider_client() ~line 2095
# Handles: openrouter, nous, openai-codex, custom, github-copilot-acp, ...
# Missing: ollama

---

model:
  provider: custom
  default: qwen3.6:35b-64k
  base_url: http://localhost:11434/v1
RAW_BUFFERClick to expand / collapse

Bug Description

When model.provider is set to ollama in config.yaml, the main conversation loop works correctly (routes to local Ollama), but all auxiliary tasks (context compression, session title generation, session search, etc.) silently fall back to OpenRouter.

This means users configured to use a local Ollama model are unknowingly routing auxiliary traffic — and in many cases the primary model too — through OpenRouter, incurring costs and defeating the purpose of running locally.

Related to #8268 but with root cause identified.

Steps to Reproduce

  1. Set config.yaml:
model:
  provider: ollama
  default: qwen3.6:35b-64k
  base_url: http://localhost:11434/v1
  1. Ensure OPENROUTER_API_KEY is set in .env
  2. Start a session
  3. Observe: requests route to OpenRouter/Claude instead of local Ollama

Expected Behavior

All requests — main loop and auxiliary — route to the configured local Ollama instance.

Actual Behavior

auxiliary_client.py's resolve_provider_client() has no branch for ollama. Step 1 returns None, Step 2 falls through to OpenRouter (because OPENROUTER_API_KEY is present).

# agent/auxiliary_client.py — resolve_provider_client() ~line 2095
# Handles: openrouter, nous, openai-codex, custom, github-copilot-acp, ...
# Missing: ollama

_PROVIDER_ALIASES (~line 131) also has no ollama entry, so normalization passes it through unchanged and it never matches any branch.

Root Cause

provider: ollama is recognized by model_metadata.py (line 61, lists it as a known local server type) but is NOT handled in auxiliary_client.py's resolve_provider_client. The two code paths are out of sync.

Workaround

Change model.provider to custom — the custom branch explicitly reads base_url from config and routes all traffic (main loop + aux) to the local endpoint:

model:
  provider: custom
  default: qwen3.6:35b-64k
  base_url: http://localhost:11434/v1

This works because resolve_provider_client's custom branch (~line 2278) reads explicit_base_url, falls back to OPENAI_BASE_URL, and defaults to "no-key-required" if no API key is set — correct for local Ollama.

Proposed Fix

Either:

  • Add an ollama branch to resolve_provider_client that reads base_url from config (same logic as custom)
  • Or add "ollama": "custom" to _PROVIDER_ALIASES so ollama is normalized to custom automatically

Option 2 is a one-liner and preserves backward compatibility for existing provider: ollama configs without requiring users to change anything.

Affected Component

Configuration (config.yaml, .env, hermes setup) / Provider routing / auxiliary_client.py

Operating System

Ubuntu 24.04

Hermes Version

Latest (main branch, May 2026)

Are you willing to submit a PR for this?

Yes — option 2 (alias) is a one-liner PR if the team prefers that approach.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING