diff --git a/strix/config/models.py b/strix/config/models.py index 3babbe37..49fa00cc 100644 --- a/strix/config/models.py +++ b/strix/config/models.py @@ -837,7 +837,17 @@ def model_supports_reasoning(model_name: str) -> bool: entry = litellm.model_cost.get(name) if entry is None and "/" in name: entry = litellm.model_cost.get(name.rsplit("/", 1)[1]) - return bool(entry and entry.get("supports_reasoning")) + if entry is not None: + return bool(entry.get("supports_reasoning")) + # Reasoning is a property of the model, not of the route: a model only + # mapped under other providers (``zai/glm-5.3`` for ``openai/glm-5.3``) + # still reasons through an OpenAI-compatible gateway. + bare_name = name.rsplit("/", 1)[-1] + return any( + bool(candidate.get("supports_reasoning")) + for key, candidate in litellm.model_cost.items() + if key.endswith(f"/{bare_name}") and isinstance(candidate, dict) + ) def is_recommended_or_frontier_model(model_name: str) -> bool: diff --git a/tests/test_models.py b/tests/test_models.py index cd11819a..0535f70d 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -12,6 +12,7 @@ from strix.config.models import ( _NonStreamingModel, _TurnGuardModel, is_recommended_or_frontier_model, + model_supports_reasoning, request_timeout_extra_args, routes_through_litellm, supports_strict_tool_schemas, @@ -23,6 +24,19 @@ def test_recommended_models_are_accepted(model_name: str) -> None: assert is_recommended_or_frontier_model(model_name) +@pytest.mark.parametrize( + "model_name", + ["openai/glm-5.3", "glm-5.3", "hosted_vllm/glm-5.3", "openai/kimi-k3", "openai/qwen3.8-max"], +) +def test_reasoning_support_follows_the_model_not_the_route(model_name: str) -> None: + assert model_supports_reasoning(model_name) + + +def test_reasoning_support_rejects_unknown_models() -> None: + assert not model_supports_reasoning("openai/no-such-model-xyz") + assert not model_supports_reasoning("openai/gpt-4.1") + + def test_request_timeout_extra_args_positive() -> None: assert request_timeout_extra_args(300) == {"timeout": 300} assert request_timeout_extra_args(10) == {"timeout": 10}