Skip to content

armgit / strix

Public Imported from GitHub
0

Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.

fix: gate reasoning_effort by LiteLLM model registry (closes #517) (#523)

Ahmed Allam13046cc74ae0
diff --git a/strix/config/models.py b/strix/config/models.py
index 9f1bdaed..89ec38c4 100644
--- a/strix/config/models.py
+++ b/strix/config/models.py
@@ -99,3 +99,17 @@ def uses_chat_completions_tool_schema(model_name: str, settings: Settings) -> bo
if model.startswith(("litellm/", "any-llm/")):
return True
return bool(settings.llm.api_base)
+
+
+def model_supports_reasoning(model_name: str) -> bool:
+ import litellm
+
+ name = model_name.strip().lower()
+ for prefix in ("litellm/", "any-llm/"):
+ if name.startswith(prefix):
+ name = name[len(prefix) :]
+ break
+ 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"))
diff --git a/strix/core/inputs.py b/strix/core/inputs.py
index 0913726f..148bf09b 100644
--- a/strix/core/inputs.py
+++ b/strix/core/inputs.py
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any
from agents.model_settings import ModelSettings
from openai.types.shared import Reasoning
-from strix.config.models import DEFAULT_MODEL_RETRY
+from strix.config.models import DEFAULT_MODEL_RETRY, model_supports_reasoning
if TYPE_CHECKING:
@@ -108,13 +108,19 @@ def build_scope_context(scan_config: dict[str, Any]) -> dict[str, Any]:
def make_model_settings(
reasoning_effort: ReasoningEffort | None,
+ *,
+ model_name: str,
) -> ModelSettings:
# Anthropic + DeepSeek thinking reject ``tool_choice="required"`` outright
# when reasoning is enabled; OpenAI o-series accepts both but doesn't need
# the safety net. When reasoning is on we let the model self-select tools
# and rely on the system prompt + the ``_finish_tool_use_behavior`` callback
# to keep the loop converging on a lifecycle tool.
- use_reasoning = reasoning_effort is not None and reasoning_effort != "none"
+ use_reasoning = (
+ reasoning_effort is not None
+ and reasoning_effort != "none"
+ and model_supports_reasoning(model_name)
+ )
model_settings = ModelSettings(
parallel_tool_calls=False,
tool_choice=None if use_reasoning else "required",
diff --git a/strix/core/runner.py b/strix/core/runner.py
index 7592c8fa..e69e632d 100644
--- a/strix/core/runner.py
+++ b/strix/core/runner.py
@@ -153,7 +153,10 @@ async def run_strix_scan(
is_whitebox = any(t.get("type") == "local_code" for t in targets)
skills = list(scan_config.get("skills") or [])
root_task = build_root_task(scan_config)
- model_settings = make_model_settings(settings.llm.reasoning_effort)
+ model_settings = make_model_settings(
+ settings.llm.reasoning_effort,
+ model_name=resolved_model,
+ )
run_config = RunConfig(
model=resolved_model,
model_settings=model_settings,