Skip to content

fix: convert adaptive thinking to enabled for Bedrock models that don't support it#220

Open
blinkagent[bot] wants to merge 3 commits intomainfrom
fix/bedrock-adaptive-thinking-fallback
Open

fix: convert adaptive thinking to enabled for Bedrock models that don't support it#220
blinkagent[bot] wants to merge 3 commits intomainfrom
fix/bedrock-adaptive-thinking-fallback

Conversation

@blinkagent
Copy link
Copy Markdown

@blinkagent blinkagent bot commented Mar 16, 2026

When Claude Code sends thinking.type: "adaptive" (the default for Opus 4.6 / Sonnet 4.6), Bedrock models that predate adaptive thinking support (e.g. Sonnet 4.5 in GovCloud us-gov-west-1) reject the request with a 400 error:

thinking: Input tag 'adaptive' found using 'type' does not match any of the expected tags: 'disabled', 'enabled'

Changes

intercept/messages/base.go

  • Added bedrockModelSupportsAdaptiveThinking() to detect whether the target Bedrock model supports adaptive thinking (only Opus 4.6 and Sonnet 4.6 do)
  • Added convertAdaptiveThinkingForBedrock() which converts {"type": "adaptive"} to {"type": "enabled", "budget_tokens": 10000} when the target model doesn't support it
  • Extended augmentRequestForBedrock() to call the new conversion after the model name remap

intercept/messages/base_test.go

  • Added TestBedrockModelSupportsAdaptiveThinking — 11 cases covering all model name formats
  • Added TestConvertAdaptiveThinkingForBedrock — 6 cases: conversion for non-4.6 models, preservation for 4.6 models, no-op for enabled/disabled/absent thinking

Fixes #219

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Bedrock models that don't support adaptive thinking reject thinking.type: "adaptive" requests

1 participant