litellm/tests/unit/llms/anthropic/messages
rhea-tk d4e8f96b88
fix(anthropic): drop or reject sampling params under anthropic-version 2026-10-21 (#53407)
* fix(anthropic): drop or reject sampling params under anthropic-version 2026-10-21

* fix(anthropic): apply the 2026-10-21 sampling gate only on Anthropic's own API

anthropic-version 2026-10-21 removed temperature, top_p and top_k from Anthropic's API, but the gate ran for every anthropic/ deployment. Third-party Anthropic-compatible APIs set as api_base, such as DeepSeek or MiniMax, still accept those params, and /v1/messages dropped them or raised UnsupportedParamsError

The gate now checks the resolved API base (the deployment api_base, else ANTHROPIC_API_BASE or ANTHROPIC_BASE_URL, else the default) and applies only when its host is api.anthropic.com or a Foundry host. Any other host gets the params untouched, as before the gate. The Python hook and the Rust request_body take the base or URL across every override, and Azure AI, Claude Platform, Mantle and Vertex keep their gating

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-22 00:19:55 +00:00
..
adapters feat(vertex_ai): add Meta Muse models on Vertex AI (#50768) 2026-11-21 13:00:24 -08:00
context_management refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
native fix(anthropic): drop or reject sampling params under anthropic-version 2026-10-21 (#53407) 2026-11-22 00:19:55 +00:00
responses_adapters fix(anthropic): stream /v1/messages tool arguments that only arrive in done events (#53306) 2026-11-21 22:49:17 +00:00
__init__.py
conftest.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_advisor_orchestration.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_anthropic_native_passthrough_spend_logging.py refactor(anthropic): rename llms/anthropic/pass_through to llms/anthropic/messages (#48510) 2026-10-27 10:08:25 -07:00
test_caller_model_checks.py feat(auth): read teams, team memberships and organizations through rust repositories (#52176) 2026-11-18 22:32:05 +00:00
test_convertible_blocks.py fix(guardrails): keep tool_result is_error and system row output_config through /v1/messages guardrail rewrites (#52828) 2026-11-19 17:26:35 -08:00
test_reasoning_effort_fields.py fix(azure_ai): send reasoning_effort to Foundry reasoning models (#51775) 2026-11-16 16:40:16 -08:00
test_safeguards.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_stream_assembly.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00