The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(models): import openrouter_variant_base from its defining module
Teknium30e467377675
diff --git a/hermes_cli/models.py b/hermes_cli/models.pyindex 6a475c8a44f..57cf83d1e91 100644--- a/hermes_cli/models.py+++ b/hermes_cli/models.py@@ -39,7 +39,6 @@ from hermes_cli.models_catalog_static import (_LIVE_FIRST_PICKER_PROVIDERS,_MODELS_DEV_PREFERRED,_OPENAI_FAST_MODE_PREFIXES,- _OPENROUTER_VARIANT_SUFFIXES,_PROVIDER_ALIASES,_PROVIDER_LABELS,_PROVIDER_MODELS,@@ -60,7 +59,6 @@ from hermes_cli.models_local import (_ollama_probe_cache_key,_root_for_ollama_native_api,fetch_ollama_cloud_models)-from hermes_constants import OPENROUTER_VARIANT_SUFFIXES, openrouter_variant_baselogger = logging.getLogger(__name__)@@ -839,13 +837,6 @@ def _model_in_provider_catalog(name_lower: str, providers: set[str]) -> bool:for model in _provider_catalog_names(provider))-# Canonical suffix set lives in ``hermes_constants`` so the metadata layer can-# share it without importing the CLI. Re-exported here under the historical-# private names used by ``validate_requested_model``.-_OPENROUTER_VARIANT_SUFFIXES = OPENROUTER_VARIANT_SUFFIXES-_openrouter_variant_base = openrouter_variant_base--def _resolve_static_model_alias(name_lower: str, current_keys: set[str]) -> Optional[tuple[str, str]]:"""Resolve short aliases (e.g. sonnet/opus) using static catalogs only."""diff --git a/hermes_cli/models_catalog_static.py b/hermes_cli/models_catalog_static.pyindex d99faa026af..6de68d51042 100644--- a/hermes_cli/models_catalog_static.py+++ b/hermes_cli/models_catalog_static.py@@ -8,8 +8,6 @@ from __future__ import annotationsfrom typing import NamedTuple-from hermes_constants import OPENROUTER_VARIANT_SUFFIXES-# Fallback OpenRouter snapshot used when the live catalog is unavailable, as# ``(model_id, description shown in menus)``. ``:free`` SKUs are described "free".@@ -508,12 +506,6 @@ _PROVIDER_RETIRED_ALIASES: dict[str, tuple[str, ...]] = {_AGGREGATOR_PROVIDERS = frozenset({"nous", "openrouter", "ai-gateway", "copilot", "kilocode"})-# Canonical suffix set lives in ``hermes_constants`` so the metadata layer can-# share it without importing the CLI. Re-exported here under the historical-# private name used by ``hermes_cli.models``.-_OPENROUTER_VARIANT_SUFFIXES = OPENROUTER_VARIANT_SUFFIXES--# Subscription/OAuth providers whose catalogs RE-EXPOSE other vendors' models; tried only as a last# resort for bare short-alias resolution (after every native-vendor catalog) so they never hijack# an alias from the model's native vendor. None currently defined.diff --git a/hermes_cli/models_validate.py b/hermes_cli/models_validate.pyindex 2adc43c0b26..2e81a03a707 100644--- a/hermes_cli/models_validate.py+++ b/hermes_cli/models_validate.py@@ -16,6 +16,7 @@ from difflib import get_close_matchesfrom typing import Any, Callable, Optionalfrom utils import base_url_host_matches+from hermes_constants import openrouter_variant_base# ── Verdicts ─────────────────────────────────────────────────────────────@@ -433,7 +434,7 @@ def _validate_live_listing(req: _Request) -> Optional[dict[str, Any]]:# catalog entries — validate the BASE but keep the suffixed id. Must run BEFORE fuzzy# auto-correction, which would otherwise "correct" `model:nitro` → `model` and silently# strip the routing opt-in.- variant_base = _m._openrouter_variant_base(req.lookup) if req.normalized == "openrouter" else None+ variant_base = openrouter_variant_base(req.lookup) if req.normalized == "openrouter" else Noneif variant_base is not None and variant_base in set(api_models):return _accept()# Listed but not found: the account may reach models absent from the public listing@@ -502,7 +503,7 @@ def _validate_catalog_fallback(req: _Request) -> dict[str, Any]:return _accept()# Same OpenRouter routing-variant rule as the live-listing path.if req.normalized == "openrouter":- variant_base = _m._openrouter_variant_base(req.lookup)+ variant_base = openrouter_variant_base(req.lookup)if variant_base is not None and variant_base.lower() in {m.lower() for m in catalog}:return _accept()return match.verdict(req, keep_suffix=True) or _soft_accept(