diff --git a/strix/config/models.py b/strix/config/models.py index 7f676b2a..d8444ee1 100644 --- a/strix/config/models.py +++ b/strix/config/models.py @@ -808,13 +808,11 @@ def uses_chat_completions_tool_schema(model_name: str, settings: Settings) -> bo """Return whether the resolved SDK route can only receive JSON function tools.""" if codex.subscription_model(model_name): return False - if settings.llm.api_type == "chat_completions": - return True - if settings.llm.api_type == "responses": - return False model = model_name.strip().lower() if "/" in model and not model.startswith("openai/"): return True + if settings.llm.api_type is not None: + return settings.llm.api_type == "chat_completions" if settings.llm.api_base: return True return not model_supports_reasoning(model_name) diff --git a/tests/test_models.py b/tests/test_models.py index 7b5556cc..7078ca98 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -184,6 +184,8 @@ def test_api_type_override_settings(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("STRIX_LLM", "openai/gpt-4") monkeypatch.setenv("STRIX_API_TYPE", "responses") assert uses_chat_completions_tool_schema("openai/gpt-4", Settings()) is False + monkeypatch.setenv("STRIX_LLM", "anthropic/claude-sonnet-4-5") + assert uses_chat_completions_tool_schema("anthropic/claude-sonnet-4-5", Settings()) is True @pytest.mark.parametrize(