HERMES-GIELIE/api
Nathan Esquenazi e829fa50d5
fix: OpenRouter models stripped of prefix, causing 404 (#116)
When config has provider=openrouter and model=openrouter/free,
resolve_model_provider() stripped the 'openrouter/' prefix because
prefix == config_provider. This sent 'free' to OpenRouter's API,
which returned 404 (model not found).

OpenRouter always needs the full provider/model path (e.g.
openrouter/free, anthropic/claude-sonnet-4.6). The prefix-stripping
logic is only correct for direct-API providers.

Fix: skip prefix stripping entirely when config_provider is 'openrouter'.
Return the full model_id with provider='openrouter'.

Added 7 unit tests for resolve_model_provider() covering:
- openrouter/free keeps full path (the bug)
- openrouter cross-provider models keep full path
- direct API providers still strip prefix correctly
- cross-provider routing to openrouter
- bare model names use config provider
- empty model returns defaults

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 13:58:37 -07:00
..
__init__.py Hermes Web UI — Sprints 11-14: multi-provider models, settings, session QoL, alerts, polish 2026-03-31 07:02:47 +00:00
auth.py fix: correct 9 inaccurate type hints 2026-04-04 23:54:58 -07:00
config.py fix: OpenRouter models stripped of prefix, causing 404 (#116) 2026-04-05 13:58:37 -07:00
helpers.py chore: add missing type hints across 10 files 2026-04-05 13:30:20 +07:00
models.py fix: correct 9 inaccurate type hints 2026-04-04 23:54:58 -07:00
profiles.py chore: add missing type hints across 10 files 2026-04-05 13:30:20 +07:00
routes.py fix: Enter key reliably submits login form (#124) 2026-04-05 12:45:57 -07:00
state_sync.py fix: correct 9 inaccurate type hints 2026-04-04 23:54:58 -07:00
streaming.py security: fix env race, signing key, upload traversal, password hash (#106) 2026-04-04 22:25:08 -07:00
updates.py fix: apply_update concurrency lock, boot.js settings-fail guard, dead workspace code, test_updates URL param 2026-04-05 16:20:12 +00:00
upload.py chore: add missing type hints across 10 files 2026-04-05 13:30:20 +07:00
workspace.py chore: add missing type hints across 10 files 2026-04-05 13:30:20 +07:00