diff --git a/hermes_cli/model_switch.py b/hermes_cli/model_switch.py index 48bf031b75b3c..b3a1ae570b59e 100644 --- a/hermes_cli/model_switch.py +++ b/hermes_cli/model_switch.py @@ -1958,8 +1958,14 @@ def _has_aws_sdk_creds_for_listing(slug: str) -> bool: models_list.append(m) elif isinstance(cfg_models, list): for m in cfg_models: - if m and m not in models_list: - models_list.append(m) + # List entries are normally plain id strings, but hand-edited + # configs sometimes use {id|model|name: ..., label: ...} dicts. + # Extract the id so models_list stays a list[str]: every + # downstream consumer (inventory dedup, capabilities, pricing) + # assumes string ids and calls .lower() / uses them as keys. + mid = (m.get("id") or m.get("model") or m.get("name") or "") if isinstance(m, dict) else m + if mid and mid not in models_list: + models_list.append(mid) # Official OpenAI API rows in providers: often have base_url but no # explicit models: dict — avoid a misleading zero count in /model.