fix(intercept/messages): convert enabled thinking to adaptive for Bedrock Opus 4.7+#281
Closed
dannykopping wants to merge 1 commit into
Closed
fix(intercept/messages): convert enabled thinking to adaptive for Bedrock Opus 4.7+#281dannykopping wants to merge 1 commit into
dannykopping wants to merge 1 commit into
Conversation
…rock Opus 4.7+ Claude Opus 4.7 (and future adaptive-only Bedrock models) reject the legacy thinking.type "enabled" + budget_tokens shape with a 400. Claude Code falls back to that shape when it cannot read the upstream model's capability metadata, which is exactly the case when AI Bridge sits between the client and Bedrock. This is the symmetric counterpart to the adaptive -> enabled conversion added in #225 for older Bedrock models. The new conversion is gated on a bedrockModelRequiresAdaptiveThinking helper that matches Opus 4.7 model IDs (and ARN-style application inference profile names). The effort level is derived from the original budget_tokens / max_tokens ratio using the midpoints of the forward mapping's anchor ratios, so a payload that round-trips through both conversions lands on the same effort level it started with. An explicit output_config.effort already present in the request is preserved. Adaptive-only models support output_config natively (no beta flag), so the field-strip pass is updated to exempt output_config for those models. Fixes #280
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.
Disclaimer: implemented by a Coder Agent using Claude Opus 4.6
Fixes #280.
Closing in favour of the same change against
coder/coder, since aibridge is now vendored there.