diff --git a/plugins/model-providers/commandcode/__init__.py b/plugins/model-providers/commandcode/__init__.py index 156f06535b..95a9e0bc66 100644 --- a/plugins/model-providers/commandcode/__init__.py +++ b/plugins/model-providers/commandcode/__init__.py @@ -79,6 +79,7 @@ class CommandCodeProfile(ProviderProfile): self, *, api_key: str | None = None, + base_url: str | None = None, timeout: float = 8.0, ) -> list[str] | None: """Fetch from the public CommandCode /models endpoint.""" @@ -126,6 +127,7 @@ class CommandCodeAnthropicProfile(ProviderProfile): self, *, api_key: str | None = None, + base_url: str | None = None, timeout: float = 8.0, ) -> list[str] | None: """Fetch from the public CommandCode /models endpoint. diff --git a/tests/plugins/model_providers/test_commandcode_profile.py b/tests/plugins/model_providers/test_commandcode_profile.py index 11420ea573..300e7a3d01 100644 --- a/tests/plugins/model_providers/test_commandcode_profile.py +++ b/tests/plugins/model_providers/test_commandcode_profile.py @@ -232,3 +232,27 @@ class TestCommandCodeModelFiltering: assert "startswith(\"claude-\")" in source or '"claude-" in m' in source, ( "CommandCodeAnthropicProfile.fetch_models should filter to claude-* models" ) + + +# ── Picker contract ────────────────────────────────────────────────────────── + +class TestCommandCodeFetchModelsPickerContract: + """``fetch_models`` must accept the kwargs the model picker passes. + + Regression: the generic live-fetch path in ``hermes_cli/models.py`` + (``provider_model_ids``) calls ``profile.fetch_models(api_key=..., + base_url=...)``. The original CommandCode overrides only accepted + ``api_key``/``timeout``, so every picker open raised TypeError, which + was swallowed, leaving the provider with zero models. + """ + + @pytest.mark.parametrize("profile_name", ["commandcode", "commandcode-anthropic"]) + def test_accepts_base_url_kwarg(self, profile_name): + import inspect + + import model_tools # noqa: F401 — triggers discovery + import providers + + profile = providers.get_provider_profile(profile_name) + assert profile is not None + assert "base_url" in inspect.signature(profile.fetch_models).parameters