Skip to content

[OpenCode Go] Anthropic endpoint defaults to dynamic reasoning when 'thinking' is omitted (breaks Claude Code classifier latency) #56678

Open

Description

@i-am-oliver

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

  1. Query https://opencode.ai/inference/go/anthropic/v1/messages with deepseek-v4.1-flash without a thinking field:
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.

  1. 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

  1. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and the curl commands. 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 returns Go requires a credential before it reaches the model. The gateway's default for an omitted thinking field 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:

  2. i-am-oliver commented on Oct 18, 2026

    @i-am-oliver
    Author

    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/messages instead 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 to https://opencode.ai/inference/go/anthropic/v1/messages without 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 thinking default is the only remaining gap to make the Claude Code integration fast and seamless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions