Feature Description
When using DeepSeek models (e.g., deepseek-v4-flash, deepseek-v4-pro) via the opencode-go provider, the reasoning_effort parameter is not passed as a top-level API kwarg. DeepSeek requires reasoning_effort at the top level of the request body and uses "max" as its highest reasoning level (vs OpenAI "xhigh").
Currently, only LM Studio and Kimi/Moonshot have top-level reasoning_effort support in agent/transports/chat_completions.py. opencode-go is missing.
Motivation
Without this, /reasoning xhigh doesn't work properly with opencode-go + DeepSeek — the reasoning effort falls back to the default instead of respecting the user's configuration.
Proposed Solution
Add a block in build_kwargs() in agent/transports/chat_completions.py (after the LM Studio block, before extra_body assembly) that:
- Checks
params.get("is_opencode_go", False)
- Maps Hermes effort levels (
minimal, low, medium, high, xhigh) to DeepSeek-compatible values
- Maps
xhigh → max (DeepSeek's highest level, analogous to Claude thinking mode's max budget)
- Sets
api_kwargs["reasoning_effort"] as a top-level parameter
And in run_agent.py, detect the opencode-go provider by host matching opencode.ai + provider string "opencode-go".
Implementation Reference
This is the exact patch we have been carrying downstream:
run_agent.py — add detection after _is_lmstudio:
_is_opencode_go = (
base_url_host_matches(self._base_url_lower, "opencode.ai")
and self.provider == "opencode-go"
)
Then pass is_opencode_go=_is_opencode_go in the params dict to the transport.
agent/transports/chat_completions.py — add after the LM Studio block:
# opencode-go: top-level reasoning_effort with DeepSeek effort mapping.
if params.get("is_opencode_go", False):
_oc_thinking_off = bool(
reasoning_config
and isinstance(reasoning_config, dict)
and reasoning_config.get("enabled") is False
)
if not _oc_thinking_off:
_oc_effort = "medium"
if reasoning_config and isinstance(reasoning_config, dict):
_e = (reasoning_config.get("effort") or "").strip().lower()
if _e in ("minimal", "low", "medium", "high"):
_oc_effort = _e
elif _e == "xhigh":
_oc_effort = "max"
api_kwargs["reasoning_effort"] = _oc_effort
Alternatives Considered
- Using
extra_body.reasoning — but DeepSeek via opencode-go expects reasoning_effort at the top level of the request, not nested in extra_body.
- Generalizing the existing
supports_reasoning path — would conflict with how other providers handle the field (some expect it in extra_body, others at top level). The opencode-go case is distinct.
Environment
- opencode-go provider with DeepSeek models (deepseek-v4-flash, deepseek-v4-pro)
- Hermes
agent/transports/chat_completions.py v2026.4.30
Feature Description
When using DeepSeek models (e.g., deepseek-v4-flash, deepseek-v4-pro) via the
opencode-goprovider, thereasoning_effortparameter is not passed as a top-level API kwarg. DeepSeek requiresreasoning_effortat the top level of the request body and uses"max"as its highest reasoning level (vs OpenAI"xhigh").Currently, only LM Studio and Kimi/Moonshot have top-level
reasoning_effortsupport inagent/transports/chat_completions.py. opencode-go is missing.Motivation
Without this,
/reasoning xhighdoesn't work properly with opencode-go + DeepSeek — the reasoning effort falls back to the default instead of respecting the user's configuration.Proposed Solution
Add a block in
build_kwargs()inagent/transports/chat_completions.py(after the LM Studio block, beforeextra_bodyassembly) that:params.get("is_opencode_go", False)minimal,low,medium,high,xhigh) to DeepSeek-compatible valuesxhigh → max(DeepSeek's highest level, analogous to Claude thinking mode's max budget)api_kwargs["reasoning_effort"]as a top-level parameterAnd in
run_agent.py, detect the opencode-go provider by host matchingopencode.ai+ provider string"opencode-go".Implementation Reference
This is the exact patch we have been carrying downstream:
run_agent.py— add detection after_is_lmstudio:Then pass
is_opencode_go=_is_opencode_goin the params dict to the transport.agent/transports/chat_completions.py— add after the LM Studio block:Alternatives Considered
extra_body.reasoning— but DeepSeek via opencode-go expectsreasoning_effortat the top level of the request, not nested inextra_body.supports_reasoningpath — would conflict with how other providers handle the field (some expect it inextra_body, others at top level). The opencode-go case is distinct.Environment
agent/transports/chat_completions.pyv2026.4.30