Drop the unified settings Claude, Gemini and Grok models reject instead of sending them
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.
| Model | Rejected with a 400 | Now |
|---|---|---|
Every Grok model (XaiModel) | presence_penalty, frequency_penalty | declared in XaiModel.unsupported_settings |
| Every Grok model except Grok 4.20 non-reasoning | stop_sequences | new 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 Cloud | presence_penalty, frequency_penalty | new 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 together | new 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 twotest_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_modelpins the per-model table;test_model_settings_support.pynow probes Google through Google Cloud and xAI atgrok-4.20-non-reasoning, the models with full support, and theSupported 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