From 638136e353541de7077ecfdb1368639fc9103cbf Mon Sep 17 00:00:00 2001 From: teknium1 Date: Thu, 12 Mar 2026 19:34:55 -0700 Subject: [PATCH] fix(anthropic): skip thinking params for Haiku models MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Haiku models don't support extended thinking at all. Without this guard, claude-haiku-4-5-20251001 would receive type=enabled + budget_tokens and return a 400 error. Incorporates the fix from PR #1127 (by frizynn) on top of #1128's adaptive thinking refactor. Verified live with Claude Code OAuth: claude-opus-4-6 → adaptive thinking ✓ claude-haiku-4-5 → no thinking params ✓ claude-sonnet-4 → enabled thinking ✓ --- agent/anthropic_adapter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py index d604097de..bfe54c585 100644 --- a/agent/anthropic_adapter.py +++ b/agent/anthropic_adapter.py @@ -414,8 +414,9 @@ def build_anthropic_kwargs( # Map reasoning_config to Anthropic's thinking parameter. # Claude 4.6 models use adaptive thinking + output_config.effort. # Older models use manual thinking with budget_tokens. + # Haiku models do NOT support extended thinking at all — skip entirely. if reasoning_config and isinstance(reasoning_config, dict): - if reasoning_config.get("enabled") is not False: + if reasoning_config.get("enabled") is not False and "haiku" not in model.lower(): effort = str(reasoning_config.get("effort", "medium")).lower() budget = THINKING_BUDGET.get(effort, 8000) if _supports_adaptive_thinking(model):