fix: guard unsupported Anthropic reasoning fields across providers#3031
fix: guard unsupported Anthropic reasoning fields across providers#3031amitksingh1490 wants to merge 12 commits intomainfrom
Conversation
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
| /// 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; |
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.
|
I'm afraid this doesn't fix the big Anthropic problem. |
This is for Haiku models getting 400 for Opus-4.7 we would build on top of this |
|
closing in favour of #3067 |
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