fix: skip extended thinking params for Haiku models#1127
Closed
frizynn wants to merge 1 commit into
Closed
Conversation
Haiku models (e.g. claude-haiku-4-5-20251001) do not support extended thinking, but the substring check `"4-5" in model` was matching them and sending `thinking.adaptive.budget_tokens`, causing a 400 error from the Anthropic API. Skip thinking params entirely when the model name contains 'haiku'.
teknium1
added a commit
that referenced
this pull request
Mar 13, 2026
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 ✓
Contributor
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
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 NousResearch#1127 (by frizynn) on top of NousResearch#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 ✓
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
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 NousResearch#1127 (by frizynn) on top of NousResearch#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 ✓
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
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 NousResearch#1127 (by frizynn) on top of NousResearch#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 ✓
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
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 NousResearch#1127 (by frizynn) on top of NousResearch#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 ✓
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where Haiku models (e.g.
claude-haiku-4-5-20251001) would receive extended thinking parameters, causing a 400 error from the Anthropic API.Bug
The reasoning config logic in
anthropic_adapter.pyuses substring matching to detect model capabilities:This check matches Haiku model names like
claude-haiku-4-5-20251001because they contain the substring"4-5". As a result, the adapter sendsthinking: {type: "adaptive", budget_tokens: ...}to the API — but Haiku models do not support extended thinking at all, so the API returns a 400 error.Root Cause
The substring-based version check does not account for the fact that Haiku models share version substrings (e.g.
4-5) with Sonnet/Opus models that do support thinking.Fix
Added a guard clause to skip thinking parameters entirely when the model name contains
"haiku":This ensures Haiku models are never sent thinking parameters, regardless of version substring matches.
Test plan
claude-haiku-4-5-20251001no longer includethinkingparamsclaude-sonnet-4-5-20250514still getsthinking: {type: "adaptive", ...}thinking: {type: "enabled", ...}