From 5669742ea6beee1c98a17ba0b42ea692c1887559 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Tue, 11 Aug 2026 18:30:18 -0700 Subject: [PATCH] fix(model_prices): advertise native structured output on every Bedrock DeepSeek V3.2 and GLM 5 id `supports_native_structured_output` was set only on the bare `deepseek.v3.2` and `zai.glm-5` entries, so the cross-region inference profiles and the region-pinned ids resolved to None. The flag gates the native `outputConfig.textFormat` branch in BedrockConverseConfig, so callers addressing the same model as `us.deepseek.v3.2` or `bedrock/us-west-2/deepseek.v3.2` silently fell back to synthetic tool injection. `us.` is the form Bedrock steers callers toward, so the most common way to reach these models was the one missing the capability. Adds the flag to the 12 affected ids and keeps the packaged backup in sync. test_get_model_info_bedrock_models already caught the region-pinned ids, but it filters on `litellm_provider == "bedrock"` and the cross-region profiles carry `bedrock_converse`, so reverting just `us.deepseek.v3.2` and `eu.deepseek.v3.2` left it green. The new parity test covers the prefixed profiles and fails on exactly that mutation. --- ...odel_prices_and_context_window_backup.json | 12 +++++++ model_prices_and_context_window.json | 12 +++++++ tests/local_testing/test_get_model_info.py | 32 +++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 81e61a14ad0..9ac2d4a50f1 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -9707,6 +9707,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -9830,6 +9831,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -9922,6 +9924,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10007,6 +10010,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10410,6 +10414,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10624,6 +10629,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10701,6 +10707,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -11262,6 +11269,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -35769,6 +35777,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true }, "eu.deepseek.v3.2": { @@ -35781,6 +35790,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true }, "us.meta.llama3-1-405b-instruct-v1:0": { @@ -46057,6 +46067,7 @@ "supports_function_calling": true, "supports_reasoning": true, "supports_system_messages": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -46071,6 +46082,7 @@ "supports_function_calling": true, "supports_reasoning": true, "supports_system_messages": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 81e61a14ad0..9ac2d4a50f1 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -9707,6 +9707,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -9830,6 +9831,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -9922,6 +9924,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10007,6 +10010,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10410,6 +10414,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10624,6 +10629,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -10701,6 +10707,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -11262,6 +11269,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -35769,6 +35777,7 @@ "output_cost_per_token": 1.85e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true }, "eu.deepseek.v3.2": { @@ -35781,6 +35790,7 @@ "output_cost_per_token": 2.22e-06, "supports_function_calling": true, "supports_reasoning": true, + "supports_native_structured_output": true, "supports_tool_choice": true }, "us.meta.llama3-1-405b-instruct-v1:0": { @@ -46057,6 +46067,7 @@ "supports_function_calling": true, "supports_reasoning": true, "supports_system_messages": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, @@ -46071,6 +46082,7 @@ "supports_function_calling": true, "supports_reasoning": true, "supports_system_messages": true, + "supports_native_structured_output": true, "supports_tool_choice": true, "source": "https://aws.amazon.com/bedrock/pricing/" }, diff --git a/tests/local_testing/test_get_model_info.py b/tests/local_testing/test_get_model_info.py index 0ff303693f2..385be25fb07 100644 --- a/tests/local_testing/test_get_model_info.py +++ b/tests/local_testing/test_get_model_info.py @@ -328,6 +328,38 @@ def test_get_model_info_bedrock_models(): ), f"{base_model_key} is not equal to {base_model_value} for model {k}" +def test_get_model_info_bedrock_cross_region_capability_parity(): + """ + Cross-region inference profiles carry litellm_provider "bedrock_converse", so the + regional drift check above (which filters on "bedrock") never reaches them. + """ + os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True" + litellm.model_cost = litellm.get_model_cost_map(url="") + + prefixes = ("us.", "eu.", "apac.", "us-gov.") + checked = 0 + + for k, v in litellm.model_cost.items(): + if not str(v.get("litellm_provider", "")).startswith("bedrock"): + continue + base_model_key = next( + (k[len(p) :] for p in prefixes if k.startswith(p)), + None, + ) + if base_model_key is None or base_model_key not in litellm.model_cost: + continue + checked += 1 + for cap, base_value in litellm.model_cost[base_model_key].items(): + if not cap.startswith("supports_"): + continue + assert cap in v, f"{cap} is on {base_model_key} but missing from {k}" + assert ( + v[cap] == base_value + ), f"{cap} is {v[cap]} on {k} but {base_value} on {base_model_key}" + + assert checked > 0, "no cross-region bedrock profiles found - the filter is inert" + + def test_get_model_info_huggingface_models(monkeypatch): from litellm import Router from litellm.types.router import ModelGroupInfo