The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(providers): unify local OpenAI-compatible provider aliases to custom (#62213)
PRATHAMESH757a5c71584484
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.pyindex b8eed5e9e20..96f99d2e2dd 100644--- a/hermes_cli/auth.py+++ b/hermes_cli/auth.py@@ -1398,6 +1398,7 @@ _PROVIDER_ALIASES: Dict[str, str] = {"lmstudio": "lmstudio", "lm-studio": "lmstudio", "lm_studio": "lmstudio","chatgpt": "openai-codex", "chatgpt-codex": "openai-codex",# Local server aliases — route through the generic custom provider+ "local": "custom","ollama": "custom", "ollama_cloud": "ollama-cloud","vllm": "custom", "llamacpp": "custom","llama.cpp": "custom", "llama-cpp": "custom"}diff --git a/hermes_cli/models_catalog_static.py b/hermes_cli/models_catalog_static.pyindex 8a9b1728770..c73fcd5145a 100644--- a/hermes_cli/models_catalog_static.py+++ b/hermes_cli/models_catalog_static.py@@ -500,6 +500,10 @@ _PROVIDER_ALIASES = dict((("lm_studio", "lmstudio"), ("chatgpt", "openai-codex"), ("chatgpt-codex", "openai-codex"),("ollama", "custom"), # bare "ollama" = local; use "ollama-cloud" for cloud("ollama_cloud", "ollama-cloud"),+ # Local OpenAI-compatible servers route through the generic "custom" provider+ # (parity with hermes_cli.auth and hermes_cli.providers). Issue #62213.+ ("local", "custom"), ("vllm", "custom"), ("llamacpp", "custom"),+ ("llama.cpp", "custom"), ("llama-cpp", "custom"),))diff --git a/hermes_cli/providers.py b/hermes_cli/providers.pyindex f788b17d175..302d56ea809 100644--- a/hermes_cli/providers.py+++ b/hermes_cli/providers.py@@ -131,8 +131,10 @@ _ALIAS_GROUPS: Dict[str, Tuple[str, ...]] = {"gmi": ("gmi-cloud", "gmicloud"), "fireworks": ("fireworks-ai", "fw"), "upstage": ("solar",),"actual": ("actual-computer", "actualcomputer", "aci"),"nebius-token-factory": ("nebius", "nebius-tokenfactory", "nebius-tf", "token-factory", "tokenfactory"),- "lmstudio": ("lmstudio", "lm-studio", "lm_studio"), "custom": ("ollama",),- "local": ("vllm", "llamacpp", "llama.cpp", "llama-cpp"),+ "lmstudio": ("lmstudio", "lm-studio", "lm_studio"),+ # Local OpenAI-compatible servers route through the generic "custom" provider,+ # matching hermes_cli.auth and hermes_cli.models so every layer agrees. Issue #62213.+ "custom": ("ollama", "local", "vllm", "llamacpp", "llama.cpp", "llama-cpp"),}ALIASES: Dict[str, str] = {alias: canon for canon, aliases in _ALIAS_GROUPS.items() for alias in aliases}diff --git a/tests/hermes_cli/test_local_provider_alias_parity.py b/tests/hermes_cli/test_local_provider_alias_parity.pynew file mode 100644index 00000000000..31715874c3e--- /dev/null+++ b/tests/hermes_cli/test_local_provider_alias_parity.py@@ -0,0 +1,40 @@+"""Parity contract for local OpenAI-compatible provider aliases (issue #62213).++The CLI, config, and credential layers each normalise provider names through a+different table:++* ``hermes_cli.providers.normalize_provider`` (routing / api-mode)+* ``hermes_cli.models.normalize_provider`` (model picker / web server)+* ``hermes_cli.auth.resolve_provider`` (credential resolution)++Historically these disagreed for the local self-hosted server aliases: bare+``vllm`` / ``llamacpp`` resolved to ``"local"`` in ``providers`` (an orphan id+with no ``ProviderDef``), stayed ``"vllm"`` in ``models`` (unknown), yet mapped+to ``"custom"`` in ``auth`` — the "custom, local, custom:local" confusion the+bug report describes. They must all agree on the generic ``"custom"`` provider.+"""++import pytest++from hermes_cli.auth import resolve_provider+from hermes_cli.models import normalize_provider as models_normalize+from hermes_cli.providers import normalize_provider as providers_normalize++# Local OpenAI-compatible server aliases users are told to configure.+#+# ``local`` is included: it is declared a ``custom`` alias in+# ``plugins/model-providers/custom/__init__.py`` and ``auth.resolve_provider``+# already mapped it to ``"custom"`` (statically and via the plugin import), so+# leaving it as the orphan ``"local"`` id (no ``ProviderDef``) in the providers+# and models tables was exactly the cross-table disagreement this contract+# guards against. Routing code already treats ``{"custom", "local"}`` as+# equivalent (e.g. ``model_switch``/``web_server``), so unifying to ``custom``+# is behaviour-preserving.+_LOCAL_ALIASES = ("local", "ollama", "vllm", "llamacpp", "llama.cpp", "llama-cpp")++[email protected]("alias", _LOCAL_ALIASES)+def test_local_aliases_normalize_to_custom_in_every_table(alias):+ assert providers_normalize(alias) == "custom"+ assert models_normalize(alias) == "custom"+ assert resolve_provider(alias) == "custom"