Drop the unified settings Claude, Gemini and Grok models reject instead of sending them

Merged
DO
13d ago
+1326-53

Posted by Claude Code on Douwe's behalf.

Part of #12413

Why we make these changes

#12413: a unified setting chosen for one model reaches a fallback model that rejects it with a 400. This declares the restrictions confirmed live (2026-11-04, one call per model and setting) so the setting is dropped instead: silently for tuning knobs, including Claude's combination rules, and with an UnsupportedSettingWarning for stop_sequences.

ModelRejected with a 400Now
Every Grok model (XaiModel)presence_penalty, frequency_penaltydeclared in XaiModel.unsupported_settings
Every Grok model except Grok 4.20 non-reasoningstop_sequencesnew grok_supports_stop_sequences profile flag; dropped with UnsupportedSettingWarning
Every model on the Gemini API; Gemini 3.5 Flash-Lite, 3.6+ and Gemini 3 image models on Google Cloudpresence_penalty, frequency_penaltynew google_supports_penalties profile flag, turned off for the Gemini API transport in _instance_profile_defaults
Claude with thinking (Anthropic API and Bedrock)temperature other than 1, top_p below 0.95, top_k (docs)new anthropic_restricts_sampling_with_thinking flag (set for claude-*); dropped silently
Claude Haiku 4.5, Sonnet 4.5/4.6, Opus 4.5/4.6 (Anthropic API and Bedrock)temperature and top_p togethernew anthropic_disallows_temperature_with_top_p flag; top_p dropped silently

Not changed: out-of-range temperature (Anthropic's 0..1), and Gemini's "at most 5 stop_sequences", a value limit with no existing pattern to follow. max_tokens above the model maximum is a separate PR.

[!WARNING]
Compatibility impact: XaiModel.unsupported_settings now includes presence_penalty and frequency_penalty, and Gemini API requests no longer send them.

Why this can ship in a minor release: every Grok model and every Gemini API model rejects them with a 400 (verified live), so no request that succeeded changes.

Migration: none.

New public surface

Profile flags: GrokModelProfile.grok_supports_stop_sequences, GoogleModelProfile.google_supports_penalties (unrecognized Google Cloud models keep sending penalties), AnthropicModelProfile.anthropic_disallows_temperature_with_top_p, AnthropicModelProfile.anthropic_restricts_sampling_with_thinking. The shared Claude helper is private (models/_anthropic_sampling.py). Notes are added to docs/models/anthropic.md, bedrock.md and google.md.

Verification

  • Cassettes (recorded live): test_anthropic_thinking_drops_the_sampling_settings_it_rejects, test_anthropic_thinking_keeps_the_sampling_settings_it_accepts, test_anthropic_drops_top_p_set_together_with_temperature, the two test_bedrock_claude_* siblings, test_google_gemini_api_drops_penalties, test_google_cloud_sends_penalties, test_xai_penalties_are_not_sent, test_xai_reasoning_model_drops_stop_sequences.
  • test_google_cloud_penalty_support_by_model pins the per-model table; test_model_settings_support.py now probes Google through Google Cloud and xAI at grok-4.20-non-reasoning, the models with full support, and the Supported by: lists carry the caveats.

What changes for existing users

Requests that 400'd today now succeed without the rejected setting. Requests that succeeded are unchanged, except that Grok and Gemini API requests no longer carry penalties, which those APIs rejected anyway.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.

šŸ¤– Generated with Claude Code