Skip to content

Anthropic-path models fail 400 when Claude Code sends adaptive thinking (budget_tokens=0) #171

Description

@zhenrong2019

Summary

Claude Code 2.1.252 sends thinking: {"budget_tokens": 0, "type": "adaptive"} on Anthropic-format requests. routatic-proxy forwards this verbatim to OpenCode Go's /zen/go/v1/messages, which returns 400 {"model":"qwen3.7-plus"} (and {"model":"qwen3.7-max"}), ultimately surfacing as 502 all models failed.

Repro

Against the proxy's /v1/messages with an Anthropic-path model (qwen3.7-plus via opencode-go):

curl -s http://127.0.0.1:3456/v1/messages \
  -H "anthropic-version: 2023-06-01" -H "content-type: application/json" \
  -d '{"model":"qwen3.7-plus","max_tokens":1000,"thinking":{"budget_tokens":0,"type":"adaptive"},"messages":[{"role":"user","content":"hi"}]}'
# → {"error":{"message":"all models failed","type":"api_error"}}

Controls:

  • No thinking field → succeeds.
  • "thinking": {"type":"enabled","budget_tokens":4000} → succeeds.
  • "thinking": {"budget_tokens":8000} (no type) → also fails.

Root cause

The thinking field with type: "adaptive" (or a bare budget_tokens) is passed through to OpenCode Go's Anthropic endpoint, which rejects it with HTTP 400.

Impact

Every real Claude Code agent (>= 2.1.252) sends adaptive thinking by default, so qwen3.7-plus / qwen3.7-max via opencode-go fail 100% on real multi-turn requests. CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1 does not help — it only affects Claude models (per Anthropic docs), and qwen is unaffected by it.

Expected

Either strip the thinking field when forwarding to OpenCode Go, or map type:"adaptive" → type:"enabled" with a sane budget_tokens. Ideally expose a config option to override request-level thinking so downstream users can force {"type":"enabled"}.

Environment

  • routatic-proxy v0.6.5-beta.3 (linux-amd64)
  • Claude Code 2.1.252
  • Models: qwen3.7-plus, qwen3.7-max (opencode-go)

Activity

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