Repository navigation
fix(anthropic): pin API 2023-06-01 when forwarding sampling params to older models - #4135
Merged
crazywoola merged 1 commit intoOct 28, 2026
Conversation
… older models Anthropic SDK 2.x defaults to API version 2026-10-21, which rejects temperature/top_p/top_k with a 400 even at default values, so the extra_body forwarding no longer reaches older models (e.g. Sonnet 4.6). Pin the request to 2023-06-01 (the migration guide's remedy) when sampling parameters are forwarded; drop them with a warning when the request also carries output_config, which requires the newer version. Bump plugin version to 0.3.39.
crazywoola
approved these changes
Oct 28, 2026
This branch was successfully deployed
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 #4132.
Plugin 0.3.37/0.3.38 lock Anthropic SDK 2.1.0, which sends
anthropic-version: 2026-10-21by default. That API version rejectstemperature/top_p/top_kwith a 400 even at their default values, so theextra_bodyforwarding added in #3843 no longer helps older models (e.g.claude-sonnet-4-6). Anthropic's migration guide prescribes keeping such requests on2023-06-01.anthropic-version: 2023-06-01via per-requestextra_headers.output_config(structured output / effort / task budget, which require2026-10-21), the sampling parameters are dropped with a warning instead of breaking the structured-output request.Release Notes
Tests
tests/test_sampling_parameters.py: version pin applied when forwarding sampling parameters; no pin without sampling parameters; no pin for adaptive-thinking models; parameters dropped with a warning whenoutput_configis present.pytest tests/ --ignore=tests/test_llm_live.py-> 154 passed (live-credential tests excluded).