Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gauss_cli/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
("z-ai/glm-5", ""),
("moonshotai/kimi-k2.5", ""),
("minimax/minimax-m2.5", ""),
("deepseek/deepseek-v4-pro", ""),
("deepseek/deepseek-v4-flash", ""),
]

_PROVIDER_MODELS: dict[str, list[str]] = {
Expand Down Expand Up @@ -79,6 +81,8 @@
"claude-haiku-4-5-20251001",
],
"deepseek": [
"deepseek-v4-pro",
"deepseek-v4-flash",
"deepseek-chat",
"deepseek-reasoner",
],
Expand Down
35 changes: 34 additions & 1 deletion run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2931,21 +2931,51 @@ def _build_api_kwargs(self, api_messages: list) -> dict:
extra_body["provider"] = provider_preferences
_is_nous = "nousresearch" in self.base_url.lower()

_is_deepseek = "deepseek.com" in self.base_url.lower()

if self._supports_reasoning_extra_body():
if self.reasoning_config is not None:
rc = dict(self.reasoning_config)
# Nous Portal requires reasoning enabled — don't send
# enabled=false to it (would cause 400).
if _is_nous and rc.get("enabled") is False:
pass # omit reasoning entirely for Nous when disabled
elif _is_deepseek:
# DeepSeek uses {"thinking": {"type": "enabled/disabled"}}
# in extra_body and reasoning_effort as a top-level param.
reasoning_enabled = rc.pop("enabled", True)
reasoning_effort = rc.pop("effort", "high")
extra_body["thinking"] = {"type": "enabled" if reasoning_enabled else "disabled"}
if reasoning_enabled:
api_kwargs["reasoning_effort"] = reasoning_effort
# Pass remaining keys through (e.g. user_id passthrough)
if rc:
extra_body.update(rc)
else:
extra_body["reasoning"] = rc
elif _is_deepseek:
# Default: enable thinking for DeepSeek with max effort
extra_body["thinking"] = {"type": "enabled"}
api_kwargs["reasoning_effort"] = "max"
else:
extra_body["reasoning"] = {
"enabled": True,
"effort": "medium"
}

# Resolve reasoning_effort as a top-level parameter for DeepSeek.
# DeepSeek supports: "high" (default) and "max" (complex agents).
# Only set when thinking is enabled (not already set above).
if _is_deepseek and "reasoning_effort" not in api_kwargs:
effort = "high"
if self.reasoning_config and isinstance(self.reasoning_config, dict):
if self.reasoning_config.get("enabled") is not False:
effort = self.reasoning_config.get("effort", "high")
else:
effort = None # thinking disabled, skip
if effort:
api_kwargs["reasoning_effort"] = effort

# Nous Portal product attribution
if _is_nous:
extra_body["tags"] = ["product=gauss-agent"]
Expand All @@ -2960,11 +2990,14 @@ def _supports_reasoning_extra_body(self) -> bool:

OpenRouter forwards unknown extra_body fields to upstream providers.
Some providers/routes reject `reasoning` with 400s, so gate it to
known reasoning-capable model families and direct Nous Portal.
known reasoning-capable model families, direct Nous Portal, and
direct DeepSeek API endpoints (which use a different format).
"""
base_url = (self.base_url or "").lower()
if "nousresearch" in base_url:
return True
if "deepseek.com" in base_url:
return True
if "openrouter" not in base_url:
return False
if "api.mistral.ai" in base_url:
Expand Down