The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(bedrock): forward output_config effort for application inference profile ARNs
mateo-berri0f41365c3473
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.pyindex f7f240af54f..85918d40e12 100644--- a/litellm/llms/bedrock/chat/converse_transformation.py+++ b/litellm/llms/bedrock/chat/converse_transformation.py@@ -80,6 +80,7 @@ from ..common_utils import (bedrock_converse_supports_parallel_tool_use_config,get_anthropic_beta_from_headers,get_bedrock_tool_name,+ is_bedrock_application_inference_profile_arn,is_claude_4_5_on_bedrock,normalize_bedrock_opus_output_config_effort,)@@ -1318,7 +1319,12 @@ class AmazonConverseConfig(BaseConfig):additional_request_params = filter_exceptions_from_params(additional_request_params)if anthropic_output_config is not None and isinstance(anthropic_output_config, dict):- if base_model.startswith("anthropic"):+ # Application inference profile ARNs hide the underlying model, so the+ # effort ceiling and capability gates below cannot run; forward+ # verbatim (like ``thinking``) and let Bedrock enforce.+ if is_bedrock_application_inference_profile_arn(model):+ additional_request_params["output_config"] = anthropic_output_config+ elif base_model.startswith("anthropic"):if litellm.drop_params is True and not AnthropicConfig._model_supports_effort_param(model, "bedrock"):litellm.verbose_logger.warning(DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING,diff --git a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.pyindex cba87427bee..d1d1f9ab489 100644--- a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py+++ b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py@@ -410,6 +410,33 @@ def test_output_config_supported_param_for_arn_models_converse():assert "output_config" in config.get_supported_openai_params(arn_model)+def test_output_config_effort_forwarded_for_application_inference_profile_arn():+ """Regression: opaque application inference profile ARNs cannot resolve a+ base model, so the anthropic-only serialization gate dropped ``output_config``+ while still sending ``thinking``: adaptive thinking with no effort tier, and+ Bedrock streams zero ``reasoningContent`` blocks. The effort must be forwarded+ verbatim (ceilings and capability gates are unknowable behind the alias) for+ Bedrock to enforce."""+ config = AmazonConverseConfig()+ arn_model = "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abcdef123456"++ result = config._transform_request(+ model=arn_model,+ messages=[{"role": "user", "content": "hi"}],+ optional_params={+ "maxTokens": 256,+ "thinking": {"type": "adaptive"},+ "output_config": {"effort": "max"},+ },+ litellm_params={},+ headers={},+ )++ additional = result.get("additionalModelRequestFields", {})+ assert additional.get("thinking") == {"type": "adaptive"}+ assert additional.get("output_config") == {"effort": "max"}++def test_output_config_format_translated_to_native_output_config_converse():"""``output_config.format`` becomes Bedrock ``outputConfig`` and is not forwarded raw."""config = AmazonConverseConfig()