hermes - ✅(Solved) Fix fix(webui): model picker doesn't switch provider when selecting non-default provider model [1 pull requests, 1 participants]

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…
GitHub stats
NousResearch/hermes-agent#14058Fetched 2026-04-23 07:47:05
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
labeled ×6cross-referenced ×1

Error Message

ERROR: API call failed after 3 retries. HTTP 404: model 'gemini-2.5-flash' not found | provider=ollama-local

Root Cause

In web_server.py, _denormalize_config_from_web() preserves the existing provider from disk when updating the model:

disk_model["default"] = model_val  # updates model name
# but keeps disk_model["provider"] = "ollama-local" unchanged

The frontend only sends the model name as a flat string — no provider info. So when a user picks a model that belongs to a different provider, the provider is never updated.

Fix Action

Fixed

PR fix notes

PR #14076: fix(gateway): web UI model picker now switches provider when selecting non-default provider model

Description (problem / solution / changelog)

When a user selected a model from a different provider in the Web UI config page (e.g. switching from an ollama-local model to google/gemini-2.5-flash on OpenRouter), the on-disk provider was never updated. _denormalize_config_from_web preserved all sub-keys from the disk model dict — including the stale provider — and only updated default, so API calls failed with "model not found" errors against the wrong provider.

What changed and why

  • hermes_cli/web_server.py: Added _infer_provider_for_model() helper that checks user-configured providers dict (explicit model lists) first, then falls back to the built-in OPENROUTER_MODELS / _PROVIDER_MODELS curated catalogs. When the model name changes and a different provider is inferred, the new provider is written to disk and provider-specific sub-keys (base_url, api_mode) are cleared so they don't carry over to the wrong provider.
  • hermes_cli/web_server.py: Added model_provider as a top-level virtual config field (parallel to model_context_length) so users can explicitly override the provider in the web UI; an explicit non-empty model_provider takes priority over inference.
  • web/src/pages/ConfigPage.tsx: Clear model_provider in local state when the model field changes so the stale on-disk provider does not shadow the backend inference.
  • tests/hermes_cli/test_web_server.py: 21 new tests covering normalize/denormalize with model_provider, inference from user provider lists and built-in catalogs, and schema placement.

How to test

  1. Set default provider to ollama-local with a local model (e.g. llama3.2).
  2. Open the Web UI → Config → General tab.
  3. Change the Model field to moonshotai/kimi-k2.6 (a curated OpenRouter model) and leave Model Provider blank.
  4. Click Save — verify the saved config now has provider: openrouter.
  5. Alternatively, change Model Provider explicitly to any provider slug (e.g. anthropic) before saving — the explicit value wins over inference.
  6. When the model name stays the same (no edit), the provider is not changed.

What platforms tested on

  • macOS on darwin-arm64 (local)

Fixes #14058

<!-- autocontrib:worker-id=issue-new-964c5d46 kind=pr-open -->

Changed files

  • hermes_cli/web_server.py (modified, +81/-12)
  • tests/hermes_cli/test_web_server.py (modified, +267/-0)
  • web/src/pages/ConfigPage.tsx (modified, +10/-1)

Code Example

disk_model["default"] = model_val  # updates model name
# but keeps disk_model["provider"] = "ollama-local" unchanged

---

ERROR: API call failed after 3 retries. HTTP 404: model 'gemini-2.5-flash'
not found | provider=ollama-local
RAW_BUFFERClick to expand / collapse

Bug

When selecting an OpenRouter model (e.g. google/gemini-2.5-flash) from the Web UI model picker, the provider stays ollama-local instead of switching to openrouter.

Root cause

In web_server.py, _denormalize_config_from_web() preserves the existing provider from disk when updating the model:

disk_model["default"] = model_val  # updates model name
# but keeps disk_model["provider"] = "ollama-local" unchanged

The frontend only sends the model name as a flat string — no provider info. So when a user picks a model that belongs to a different provider, the provider is never updated.

Steps to reproduce

  1. Default provider: ollama-local
  2. Open Web UI model picker
  3. Select any OpenRouter model (e.g. google/gemini-2.5-flash)
  4. Send a message

Result

ERROR: API call failed after 3 retries. HTTP 404: model 'gemini-2.5-flash'
not found | provider=ollama-local

Expected

Provider should switch to openrouter automatically when selecting an OpenRouter model.

Environment

  • Hermes version: latest (2026-04-22)
  • Default provider: ollama-local (custom endpoint)
  • OpenRouter configured as custom_provider

extent analysis

TL;DR

Update the _denormalize_config_from_web() function in web_server.py to switch the provider to openrouter when an OpenRouter model is selected.

Guidance

  • Identify the provider of the selected model and update the disk_model["provider"] accordingly in the _denormalize_config_from_web() function.
  • Consider adding a mapping of models to their respective providers to determine the correct provider when a model is selected.
  • Verify that the provider is correctly updated by checking the disk_model["provider"] value after selecting an OpenRouter model.
  • Test the fix by selecting an OpenRouter model and checking if the provider switches to openrouter and the API call is successful.

Example

# Example of how to update the provider in _denormalize_config_from_web()
if model_val.startswith("google/"):
    disk_model["provider"] = "openrouter"

Notes

This fix assumes that the provider for OpenRouter models is always openrouter. If there are other providers for OpenRouter models, a more complex mapping or logic may be needed.

Recommendation

Apply workaround: Update the _denormalize_config_from_web() function to correctly update the provider when an OpenRouter model is selected, as this is a specific fix for the identified issue.

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

hermes - ✅(Solved) Fix fix(webui): model picker doesn't switch provider when selecting non-default provider model [1 pull requests, 1 participants]