fix(anthropic): register thinking-binding-controls-2026-08-01 in beta headers config

Anthropic's preserved-thinking controls (`thinking.block_binding`, Claude
Fable 5.1) are only accepted alongside the beta header
`thinking-binding-controls-2026-08-01`. The proxy forwards the body field
untouched but `filter_and_transform_beta_headers` drops the header because
it has no entry in `anthropic_beta_headers_config.json`, so Bedrock and
Vertex reject the request with
"thinking.adaptive.block_binding: Extra inputs are not permitted".

Map the header for anthropic, bedrock, bedrock_converse, vertex_ai and
databricks (same beta name on all of them per Anthropic's docs). azure_ai is
left null pending verification on Foundry.
This commit is contained in:
Chloe Lu 2026-09-15 15:34:24 +08:00
parent 15bd8b0e4a
commit c19a19999f
2 changed files with 22 additions and 0 deletions

View file

@ -27,6 +27,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": "token-efficient-tools-2025-02-19",
"web-fetch-2025-09-10": "web-fetch-2025-09-10",
"web-search-2025-03-05": "web-search-2025-03-05"
@ -57,6 +58,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": null,
"token-efficient-tools-2025-02-19": null,
"web-fetch-2025-09-10": "web-fetch-2025-09-10",
"web-search-2025-03-05": "web-search-2025-03-05"
@ -87,6 +89,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": null,
"tool-search-tool-2025-10-19": null,
"web-fetch-2025-09-10": null,
@ -118,6 +121,7 @@
"structured-outputs-2025-11-13": null,
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": null,
"tool-search-tool-2025-10-19": "tool-search-tool-2025-10-19",
"web-fetch-2025-09-10": null,
@ -149,6 +153,7 @@
"structured-outputs-2025-11-13": null,
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": null,
"tool-search-tool-2025-10-19": "tool-search-tool-2025-10-19",
"web-fetch-2025-09-10": null,
@ -181,6 +186,7 @@
"structured-outputs-2025-11-13": "structured-outputs-2025-11-13",
"text_editor_20241022": null,
"text_editor_20250124": null,
"thinking-binding-controls-2026-08-01": "thinking-binding-controls-2026-08-01",
"token-efficient-tools-2025-02-19": "token-efficient-tools-2025-02-19",
"web-fetch-2025-09-10": "web-fetch-2025-09-10",
"web-search-2025-03-05": "web-search-2025-03-05"

View file

@ -426,6 +426,22 @@ class TestAnthropicBetaHeadersFiltering:
assert filtered == ["fine-grained-tool-streaming-2025-05-14"]
@pytest.mark.parametrize(
"provider", ["anthropic", "bedrock", "bedrock_converse", "vertex_ai", "databricks"]
)
def test_thinking_binding_controls_forwarded(self, provider):
"""`thinking.block_binding` (preserved thinking, Claude Fable 5.1) is only
accepted alongside thinking-binding-controls-2026-08-01. The body field is
forwarded untouched, so stripping the header (previously unknown, hence
dropped) makes Bedrock and Vertex reject the request with
"thinking.adaptive.block_binding: Extra inputs are not permitted"."""
filtered = filter_and_transform_beta_headers(
beta_headers=["thinking-binding-controls-2026-08-01"],
provider=provider,
)
assert filtered == ["thinking-binding-controls-2026-08-01"]
def test_null_value_headers_filtered(self):
"""Test that headers with null values are always filtered out."""
for provider in [