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.
This commit is contained in:
6
cli.py
6
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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user