Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions hermes_cli/runtime_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,22 +333,15 @@ def _get_named_custom_provider(requested_provider: str) -> Optional[Dict[str, An
if not requested_norm or requested_norm == "custom":
return None

# Raw names should only map to custom providers when they are not already
# valid built-in providers or aliases. Explicit menu keys like
# ``custom:local`` always target the saved custom provider.
if requested_norm == "auto":
return None
if not requested_norm.startswith("custom:"):
try:
auth_mod.resolve_provider(requested_norm)
except AuthError:
pass
else:
return None

config = load_config()

# First check providers: dict (new-style user-defined providers)

# First check providers: dict (new-style user-defined providers) — do this
# BEFORE the builtin provider guard so that user-defined providers whose
# name happens to match a _PROVIDER_ALIASES entry (e.g. "llama-cpp" → "custom")
# are found in the providers dict instead of being rejected as a builtin.
providers = config.get("providers")
if isinstance(providers, dict):
for ep_name, entry in providers.items():
Expand Down Expand Up @@ -442,6 +435,16 @@ def _get_named_custom_provider(requested_provider: str) -> Optional[Dict[str, An
result["model"] = model_name
return result

# Only if not found in any user-defined provider, check if this is a
# built-in provider (not a custom provider at all).
if not requested_norm.startswith("custom:"):
try:
auth_mod.resolve_provider(requested_norm)
except AuthError:
pass
else:
return None

return None


Expand Down