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(openai/responses/transformation.py): update supported openai params

Krrish Dholakia5b641380ab3d
diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.py
index 40aae5a1cec..e70cadddaf7 100644
--- a/litellm/llms/openai/responses/transformation.py
+++ b/litellm/llms/openai/responses/transformation.py
@@ -1,4 +1,4 @@
-from typing import TYPE_CHECKING, Any, Dict, Optional, Union, cast
+from typing import TYPE_CHECKING, Any, Dict, Optional, Union, cast, get_type_hints
import httpx
from pydantic import BaseModel
@@ -34,34 +34,20 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):
"""
All OpenAI Responses API params are supported
"""
- return [
- "input",
- "model",
- "include",
- "instructions",
- "max_output_tokens",
- "metadata",
- "parallel_tool_calls",
- "previous_response_id",
- "reasoning",
- "store",
- "background",
- "stream",
- "prompt",
- "temperature",
- "text",
- "tool_choice",
- "tools",
- "top_p",
- "truncation",
- "user",
- "service_tier",
- "safety_identifier",
- "extra_headers",
- "extra_query",
- "extra_body",
- "timeout",
- ]
+ supported_params = get_type_hints(ResponsesAPIRequestParams).keys()
+ return list(
+ set(
+ [
+ "input",
+ "model",
+ "extra_headers",
+ "extra_query",
+ "extra_body",
+ "timeout",
+ ]
+ + list(supported_params)
+ )
+ )
def map_openai_params(
self,
diff --git a/tests/test_litellm/llms/openai/responses/test_openai_responses_transformation.py b/tests/test_litellm/llms/openai/responses/test_openai_responses_transformation.py
index 1ed2266d1f1..6d46a40f6c6 100644
--- a/tests/test_litellm/llms/openai/responses/test_openai_responses_transformation.py
+++ b/tests/test_litellm/llms/openai/responses/test_openai_responses_transformation.py
@@ -147,7 +147,7 @@ class TestOpenAIResponsesAPIConfig:
assert result.type == ResponsesAPIStreamEvents.RESPONSE_COMPLETED
assert result.response.id == "resp_123"
-
+
@pytest.mark.serial
def test_validate_environment(self):
"""Test that validate_environment correctly sets the Authorization header"""
@@ -292,27 +292,36 @@ class TestAzureResponsesAPIConfig:
def test_azure_get_complete_url_with_version_types(self):
"""Test Azure get_complete_url with different API version types"""
base_url = "https://litellm8397336933.openai.azure.com"
-
+
# Test with preview version - should use openai/v1/responses
result_preview = self.config.get_complete_url(
api_base=base_url,
litellm_params={"api_version": "preview"},
)
- assert result_preview == "https://litellm8397336933.openai.azure.com/openai/v1/responses?api-version=preview"
-
- # Test with latest version - should use openai/v1/responses
+ assert (
+ result_preview
+ == "https://litellm8397336933.openai.azure.com/openai/v1/responses?api-version=preview"
+ )
+
+ # Test with latest version - should use openai/v1/responses
result_latest = self.config.get_complete_url(
api_base=base_url,
litellm_params={"api_version": "latest"},
)
- assert result_latest == "https://litellm8397336933.openai.azure.com/openai/v1/responses?api-version=latest"
-
+ assert (
+ result_latest
+ == "https://litellm8397336933.openai.azure.com/openai/v1/responses?api-version=latest"
+ )
+
# Test with date-based version - should use openai/responses
result_date = self.config.get_complete_url(
api_base=base_url,
litellm_params={"api_version": "2025-01-01"},
)
- assert result_date == "https://litellm8397336933.openai.azure.com/openai/responses?api-version=2025-01-01"
+ assert (
+ result_date
+ == "https://litellm8397336933.openai.azure.com/openai/responses?api-version=2025-01-01"
+ )
class TestTransformListInputItemsRequest:
@@ -650,3 +659,12 @@ class TestTransformListInputItemsRequest:
for key, value in params.items():
assert isinstance(key, str)
assert value is not None
+
+
+def test_get_supported_openai_params():
+ config = OpenAIResponsesAPIConfig()
+ params = config.get_supported_openai_params("gpt-4o")
+ assert "temperature" in params
+ assert "stream" in params
+ assert "background" in params
+ assert "stream" in params