Skip to content

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]

fix(responses): forward allowed_openai_params through the chat completions bridge (#35885)

devin-ai-integration[bot]f05d468769e2
diff --git a/litellm/responses/main.py b/litellm/responses/main.py
index f923702119c..7b02c1b8023 100644
--- a/litellm/responses/main.py
+++ b/litellm/responses/main.py
@@ -1064,6 +1064,7 @@ def responses(
extra_headers=extra_headers,
extra_body=extra_body,
timeout=timeout if timeout is not None else request_timeout,
+ allowed_openai_params=allowed_openai_params,
**kwargs,
)
diff --git a/tests/test_litellm/responses/test_responses_api_bridge_flag.py b/tests/test_litellm/responses/test_responses_api_bridge_flag.py
index 463af6562f1..f94c31831bf 100644
--- a/tests/test_litellm/responses/test_responses_api_bridge_flag.py
+++ b/tests/test_litellm/responses/test_responses_api_bridge_flag.py
@@ -16,6 +16,7 @@ sys.path.insert(
import litellm
from litellm.types.llms.openai import ResponseAPIUsage, ResponsesAPIResponse
+from litellm.types.utils import Choices, Message, ModelResponse, Usage
class TestUseResponsesApiBridgeFlag:
@@ -130,6 +131,44 @@ class TestUseResponsesApiBridgeFlag:
mock_bridge_handler.assert_called_once()
+ @patch("litellm.acompletion")
+ @patch(
+ "litellm.responses.main.ProviderConfigManager.get_provider_responses_api_config"
+ )
+ async def test_allowed_openai_params_forwarded_through_bridge(
+ self, mock_get_config, mock_acompletion
+ ):
+ """allowed_openai_params is a named param of responses(), so it must be
+ explicitly forwarded to the bridge; otherwise litellm.acompletion raises
+ UnsupportedParamsError for params the caller explicitly allowed."""
+ mock_get_config.return_value = litellm.OpenAIResponsesAPIConfig()
+ mock_acompletion.return_value = ModelResponse(
+ id="chatcmpl_123",
+ model="openai/my-custom-model",
+ choices=[
+ Choices(
+ index=0,
+ message=Message(role="assistant", content="Answer"),
+ finish_reason="stop",
+ )
+ ],
+ usage=Usage(prompt_tokens=10, completion_tokens=5, total_tokens=15),
+ )
+
+ await litellm.aresponses(
+ model="openai/my-custom-model",
+ input="Hello",
+ use_chat_completions_api=True,
+ allowed_openai_params=["reasoning_effort"],
+ reasoning={"effort": "high"},
+ litellm_logging_obj=MagicMock(),
+ )
+
+ mock_acompletion.assert_called_once()
+ assert mock_acompletion.call_args.kwargs.get("allowed_openai_params") == [
+ "reasoning_effort"
+ ]
+
@patch("litellm.responses.file_search.emulated_handler._call_aresponses")
@patch(
"litellm.responses.main.ProviderConfigManager.get_provider_responses_api_config"