Skip to content

fix(anthropic): pin API 2023-06-01 when forwarding sampling params to older models - #4135

Merged
crazywoola merged 1 commit into
langgenius:mainfrom
Taranum01:fix/4132-anthropic-api-version-pin
Oct 28, 2026
Merged

crazywoola merged 1 commit into
langgenius:mainfrom
Taranum01:fix/4132-anthropic-api-version-pin

Conversation

@Taranum01

Copy link
Copy Markdown
Contributor

Summary

Fixes #4132.

Plugin 0.3.37/0.3.38 lock Anthropic SDK 2.1.0, which sends anthropic-version: 2026-10-21 by default. That API version rejects temperature/top_p/top_k with a 400 even at their default values, so the extra_body forwarding added in #3843 no longer helps older models (e.g. claude-sonnet-4-6). Anthropic's migration guide prescribes keeping such requests on 2023-06-01.

  • Requests that forward sampling parameters to a model that accepts them are pinned to anthropic-version: 2023-06-01 via per-request extra_headers.
  • When the request also carries output_config (structured output / effort / task budget, which require 2026-10-21), the sampling parameters are dropped with a warning instead of breaking the structured-output request.
  • Adaptive-thinking models are unchanged: they already drop sampling parameters and stay on the SDK default version.

Release Notes

  • Fixed a regression where configuring temperature, Top P or Top K for older Claude models (such as Claude Sonnet 4.6) failed with HTTP 400 after the Anthropic SDK 2.x upgrade in plugin 0.3.37. Requests that use sampling parameters are now sent with API version 2023-06-01, which accepts them, so existing workflows keep their configured sampling behavior.

Tests

  • 4 new tests in 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 when output_config is present.
  • Full plugin test suite passes: pytest tests/ --ignore=tests/test_llm_live.py -> 154 passed (live-credential tests excluded).

… 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
crazywoola deployed to models/anthropic October 28, 2026 05:40 — with GitHub Actions Active
@crazywoola
crazywoola merged commit 24f8a73 into langgenius:main Oct 28, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
models/anthropic — 00c344e7 Deployed Oct 28, 2026 by crazywoola via test (models/anthropic) #2932
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.

[Anthropic] Suspected regression in 0.3.37+: SDK 2.x API version rejects temperature on older Claude models

2 participants