diff --git a/litellm/llms/anthropic/common_utils.py b/litellm/llms/anthropic/common_utils.py index c73376ba498..3c2e37be341 100644 --- a/litellm/llms/anthropic/common_utils.py +++ b/litellm/llms/anthropic/common_utils.py @@ -341,7 +341,9 @@ class AnthropicModelInfo(BaseLLMModelInfo): prefixes: Final = ( "bedrock/converse/", "bedrock/invoke/", + "bedrock/mantle/", "bedrock/", + "mantle/", "vertex_ai/", ) deprefixed: Final = tuple(model[len(p) :] for p in prefixes if model.startswith(p)) diff --git a/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py b/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py index cea299280f8..9c043271be5 100644 --- a/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py +++ b/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py @@ -427,6 +427,34 @@ def test_output_config_forwarded_for_bedrock_chat_invoke_request(): assert result["max_tokens"] == 100 +def test_output_config_forwarded_for_mantle_routed_model(): + """A mantle-routed id must resolve the same capabilities as its us.* twin. + + bedrock/mantle/anthropic.claude-opus-5 and bedrock/us.anthropic.claude-opus-5 + are the same underlying model, but the mantle route segment was not among the + prefixes capability lookups strip, so supports_output_config and the effort + check both came back False and this path stripped output_config. The request + then went out with the legacy thinking.type=enabled shape, which Bedrock + rejects. + """ + config = AmazonAnthropicClaudeConfig() + + optional_params = { + "max_tokens": 100, + "output_config": {"effort": "high"}, + } + + result = config.transform_request( + model="mantle/anthropic.claude-opus-5", + messages=[{"role": "user", "content": "test"}], + optional_params=optional_params, + litellm_params={}, + headers={}, + ) + + assert result.get("output_config") == {"effort": "high"} + + def test_output_config_format_converted_for_bedrock_chat_invoke_request(): """Bedrock Invoke chat path consumes ``output_config.format`` before forwarding.""" config = AmazonAnthropicClaudeConfig()