From 7febdf7208d59db52f8ebe54b8be71a0d6c31d7c Mon Sep 17 00:00:00 2001 From: teknium1 Date: Wed, 11 Mar 2026 23:29:26 -0700 Subject: [PATCH] fix: custom endpoint model validation + better /model error messages - Custom endpoints can serve any model, so skip validation for provider='custom' in validate_requested_model(). Previously it would reject any model name since there's no static catalog or live API to check against. - Show clear setup instructions when switching to custom endpoint without OPENAI_BASE_URL/OPENAI_API_KEY configured. - Added curated model lists for Nous Portal and OpenAI Codex to _PROVIDER_MODELS so /model shows their available models. --- cli.py | 6 +++++- hermes_cli/models.py | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index 723a7554d..7f2b2394a 100755 --- a/cli.py +++ b/cli.py @@ -2795,7 +2795,11 @@ class HermesCLI: base_url_for_probe = runtime.get("base_url", "") except Exception as e: provider_label = _PROVIDER_LABELS.get(target_provider, target_provider) - print(f"(>_<) Could not resolve credentials for provider '{provider_label}': {e}") + if target_provider == "custom": + print(f"(>_<) Custom endpoint not configured. Set OPENAI_BASE_URL and OPENAI_API_KEY,") + print(f" or run: hermes setup → Custom OpenAI-compatible endpoint") + else: + print(f"(>_<) Could not resolve credentials for provider '{provider_label}': {e}") print(f"(^_^) Current model unchanged: {self.model}") return True diff --git a/hermes_cli/models.py b/hermes_cli/models.py index 0df1d3095..54d4e3c16 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -276,6 +276,15 @@ def validate_requested_model( "message": "Model names cannot contain spaces.", } + # Custom endpoints can serve any model — skip validation + if normalized == "custom": + return { + "accepted": True, + "persist": True, + "recognized": False, + "message": None, + } + # Probe the live API to check if the model actually exists api_models = fetch_api_models(api_key, base_url)