Repository navigation
Description
Description
On OpenCode Go's Anthropic compatibility endpoint (https://opencode.ai/inference/go/anthropic/v1/messages), omitting the thinking field on DeepSeek models (deepseek-v4.1-flash) causes the gateway to enable dynamic reasoning by default.
In Anthropic Messages API semantics, extended thinking is opt-in (omitting thinking means thinking is disabled).
This causes high latency for coding agents like Claude Code (listed as a validated client in the Go docs): Claude Code's fast background checks (CLAUDE_CODE_BG_CLASSIFIER_MODEL, auto-mode evaluations, and agent namer) do not attach a thinking block over the wire for custom models. As a result, DeepSeek generates hundreds of thinking tokens for simple 1-sentence classification tasks, spiking latency from ~200ms to several seconds.
Steps to reproduce
- Query
https://opencode.ai/inference/go/anthropic/v1/messageswithdeepseek-v4.1-flashwithout athinkingfield:
curl -s -X POST https://opencode.ai/inference/go/anthropic/v1/messages \
-H "Authorization: Bearer <OPENCODE_API_KEY>" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-H "x-opencode-session: test-session" \
-d '{
"model": "deepseek-v4.1-flash",
"max_tokens": 100,
"messages": [{"role": "user", "content": "1+1="}]
}'Current behavior: Returns a {"type": "thinking", ...} block before text.
- Query with
"thinking": {"type": "disabled"}:
curl -s -X POST https://opencode.ai/inference/go/anthropic/v1/messages \
-H "Authorization: Bearer <OPENCODE_API_KEY>" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-H "x-opencode-session: test-session" \
-d '{
"model": "deepseek-v4.1-flash",
"max_tokens": 100,
"thinking": {"type": "disabled"},
"messages": [{"role": "user", "content": "1+1="}]
}'Expected behavior: Returns immediately with zero thinking tokens.
Expected Behavior
On the Anthropic route, omitting thinking should default to reasoning disabled, matching standard Anthropic API wire semantics. Thinking should only be enabled when explicitly passed via thinking: {"type": "enabled" | "adaptive"}.
Control Evidence (Anthropic vs DeepSeek on OpenCode Go)
Under standard Anthropic wire specs, extended thinking is strictly opt-in. This is already demonstrated by native Claude models on this exact same OpenCode Go endpoint:
# Request to claude-haiku-5-5 without a thinking parameter:
curl -s -X POST https://opencode.ai/inference/go/anthropic/v1/messages \
-H "Authorization: Bearer <OPENCODE_API_KEY>" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-H "x-opencode-session: test-control" \
-d '{
"model": "claude-haiku-5-5",
"max_tokens": 50,
"messages": [{"role": "user", "content": "1+1="}]
}'Returns text immediately with zero thinking tokens:
{
"content": [{"type": "text", "text": "1 + 1 = **2**"}],
"usage": {
"output_tokens_details": {
"thinking_tokens": 0
}
}
}In contrast, sending the identical payload to deepseek-v4.1-flash causes OpenCode Go to emit a thinking content block and hundreds of reasoning tokens. The gateway route is therefore inconsistent across models—defaulting to reasoning-enabled for DeepSeek, while defaulting to reasoning-disabled for Claude. Aligning deepseek-* to also default to disabled when thinking is omitted would restore consistency with Anthropic wire semantics.
Additional Context / Feature Idea
Since Claude Code allows overriding the classifier model (CLAUDE_CODE_BG_CLASSIFIER_MODEL), it would also be great to expose lightweight decision models (like jev-1.13 from the OpenCode catalog) over this Anthropic route specifically for fast agent classification and auto-mode evaluation.
Activity
opencode-agent commentedon Oct 18, 2026
Thanks for the detailed report and the
curlcommands. I couldn't try them here because they need an OpenCode Go API key, and the sandbox doesn't have one. Without a key the endpoint returnsGo requires a credentialbefore it reaches the model. The gateway's default for an omittedthinkingfield is set in the hosted inference service, not in the code in this repository. A maintainer with Go access will need to compare the two requests to confirm it.Related issues:
/v1/messagesendpointi-am-oliver commentedon Oct 18, 2026
Thanks @opencode-agent. Just to clarify regarding the link to #55714:
#55714 is actually based on a misconception about the endpoint path (the author tested
.../go/v1/messagesinstead of.../go/anthropic/v1/messages).DeepSeek models (
deepseek-v4.1-flash) are already served natively on OpenCode Go's Anthropic Messages endpoint today. Claude Code talks directly tohttps://opencode.ai/inference/go/anthropic/v1/messageswithout any local translation proxy or adapter, and tools, streaming, and prompt caching all work out of the box.Because the route is already live and serving traffic, resolving the omitted
thinkingdefault is the only remaining gap to make the Claude Code integration fast and seamless.