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: keep reasoning_effort for mode: responses bridge deployments
jesus17dd6afbaafe
diff --git a/litellm/main.py b/litellm/main.pyindex 75b7f7f10a5..062ddb9a293 100644--- a/litellm/main.py+++ b/litellm/main.py@@ -5398,6 +5398,16 @@ def completion(if dynamic_api_key is not None:api_key = dynamic_api_key# check if user passed in any of the OpenAI optional params+ allowed_openai_params: Final[list[str] | None] = cast(+ list[str] | None,+ (+ [*(kwargs.get("allowed_openai_params") or []), "reasoning_effort"]+ if responses_api_model_info.get("mode") == "responses"+ and not skip_responses_api_bridge+ and "reasoning_effort" not in (kwargs.get("allowed_openai_params") or [])+ else kwargs.get("allowed_openai_params")+ ),+ )optional_param_args: Final = {"functions": functions,"function_call": function_call,@@ -5442,7 +5452,7 @@ def completion("service_tier": service_tier,"store": store,"prompt_cache_key": prompt_cache_key,- "allowed_openai_params": kwargs.get("allowed_openai_params"),+ "allowed_openai_params": allowed_openai_params,"base_model": base_model,}optional_params = get_optional_params(**optional_param_args, **non_default_params)diff --git a/tests/test_litellm/test_main.py b/tests/test_litellm/test_main.pyindex 038df3656fe..9ce2bb8400d 100644--- a/tests/test_litellm/test_main.py+++ b/tests/test_litellm/test_main.py@@ -1367,6 +1367,40 @@ def test_gpt_5_4_responses_bridge_preserves_reasoning_summary_dict(}[email protected]("reasoning_effort", ["high", {"effort": "high"}])+@patch("litellm.completion_extras.responses_api_bridge.completion")+def test_responses_bridge_preserves_reasoning_effort_with_drop_params(+ mock_responses_completion, reasoning_effort, restore_model_registry+):+ mock_responses_completion.return_value = MagicMock()+ model = "perplexity/test-responses-bridge"+ litellm.register_model(+ {+ model: {+ "litellm_provider": "perplexity",+ "mode": "responses",+ "supports_reasoning": True,+ "input_cost_per_token": 0.0,+ "output_cost_per_token": 0.0,+ }+ },+ persist_across_reloads=False,+ )++ with patch.object(litellm, "supports_reasoning", return_value=False):+ litellm.completion(+ model=model,+ messages=[{"role": "user", "content": "hello"}],+ reasoning_effort=reasoning_effort,+ drop_params=True,+ api_key="fake-key",+ api_base="https://api.perplexity.ai",+ )++ optional_params = mock_responses_completion.call_args.kwargs["optional_params"]+ assert optional_params["reasoning_effort"] == reasoning_effort++@pytest.mark.parametrize("model, model_info, expected_model_param, expected_base_model_param",[