fix: guard unsupported Anthropic reasoning fields across providers#3031
Draft
amitksingh1490 wants to merge 9 commits intomainfrom
Draft
fix: guard unsupported Anthropic reasoning fields across providers#3031amitksingh1490 wants to merge 9 commits intomainfrom
amitksingh1490 wants to merge 9 commits intomainfrom
Conversation
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
laststylebender14
requested changes
Apr 16, 2026
tusharmath
reviewed
Apr 17, 2026
| /// example, Claude 3.5 Haiku) reject both thinking and effort parameters, | ||
| /// while newer models such as Claude Haiku 4.5 support thinking but still | ||
| /// reject effort-style reasoning parameters. | ||
| pub struct StripUnsupportedAnthropicReasoning; |
Collaborator
There was a problem hiding this comment.
Too much of duplicate code across transformers. We can create one on Conversation to remove reasoning effort thing.
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
Guard Anthropic reasoning parameters by model capability across Anthropic, Bedrock, and OpenAI-compatible provider paths to prevent 400 errors like "This model does not support the effort parameter."
Context
The critical case is models that support thinking but not effort-style fields.
For example, Claude Haiku 4.5 supports reasoning/thinking budgets but rejects effort-style parameters. If effort is sent, Anthropic-compatible providers can return 400 invalid request errors.
Fixes #3030.
Changes
Implemented transformer-based compatibility guards per request pipeline so unsupported reasoning fields are removed before sending upstream requests.
Key Implementation Details
StripUnsupportedReasoningand wired it into the Anthropic provider pipeline.StripUnsupportedAnthropicReasoningand wired it into the OpenAI provider pipeline so proxy providers (OpenRouter, Requesty, GitHub Copilot, etc.) also sanitize Anthropic reasoning fields by model.StripUnsupportedReasoningto remove unsupportedadditional_model_request_fieldsthinking payloads for unsupported/non-Anthropic models.Use Cases
claude-haiku-4-5with reasoning enabled no longer fails due to unsupported effort fields.Testing
Links
fix/anthropic-haiku-reasoning-effort