Drop Anthropic sampling settings when the client sends API version `2026-10-21`

Closed
AD
8d ago
+55-1

anthropic>=2 sends anthropic-version: 2026-10-21 by default. On that version, Claude rejects temperature, top_p and top_k on every model. So Sonnet 4.6, Haiku 4.5 and the other models without anthropic_disallows_sampling_settings returned a 400.

This change reads the version from the client's default headers. When it's 2026-10-21 or later, the sampling settings are dropped with the existing warning, the same as for Opus 4.7+. The legacy Bedrock client is skipped, because it pins its own version in the request body.

Not covered: Vertex sends the version in the request body, not in a header, so it keeps today's behavior. Happy to handle it here if you'd like.

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.

Summary by cubic

Closes #14352. Makes Anthropic drop sampling settings for all models when the client sends API version 2026-10-21 or later, since that version rejects temperature, top_p, and top_k on every model instead of only Opus 4.7+.

  • Reads the anthropic-version header from the client's default headers and drops settings with the existing warning.
  • Skips the legacy Bedrock client, which pins its own version in the request body.
  • Vertex behavior is unchanged because it sends the version in the request body.