From 0cb9ef5fb31c760cb4dd15e0b4e3c06004dbcc21 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 10 Oct 2025 18:07:18 -0700 Subject: [PATCH] fix(openai/responses): fallback to model construct, don't use it by default (causes downstream errors for nested values) --- litellm/llms/openai/responses/transformation.py | 12 +++++++++++- litellm/proxy/_new_secret_config.yaml | 9 ++------- tests/llm_translation/test_openai.py | 10 ++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.py index 4c82a35c11..1e949e434d 100644 --- a/litellm/llms/openai/responses/transformation.py +++ b/litellm/llms/openai/responses/transformation.py @@ -161,6 +161,10 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig): ) -> ResponsesAPIResponse: """No transform applied since outputs are in OpenAI spec already""" try: + logging_obj.post_call( + original_response=raw_response.text, + additional_args={"complete_input_dict": {}}, + ) raw_response_json = raw_response.json() raw_response_json["created_at"] = _safe_convert_created_field( raw_response_json["created_at"] @@ -169,7 +173,13 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig): raise OpenAIError( message=raw_response.text, status_code=raw_response.status_code ) - return ResponsesAPIResponse.model_construct(**raw_response_json) + try: + return ResponsesAPIResponse(**raw_response_json) + except Exception: + verbose_logger.debug( + f"Error constructing ResponsesAPIResponse: {raw_response_json}, using model_construct" + ) + return ResponsesAPIResponse.model_construct(**raw_response_json) def validate_environment( self, headers: dict, model: str, litellm_params: Optional[GenericLiteLLMParams] diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml index 95c6869b95..778d52e5a4 100644 --- a/litellm/proxy/_new_secret_config.yaml +++ b/litellm/proxy/_new_secret_config.yaml @@ -4,9 +4,9 @@ model_list: model: openai/gpt-4o-mini api_base: "https://webhook.site/2f385e05-00aa-402b-86d1-efc9261471a5" api_key: dummy - - model_name: "byok-wildcard/*" + - model_name: "gemini-2.5-flash" litellm_params: - model: openai/* + model: gemini/gemini-2.5-flash - model_name: xai-grok-3 litellm_params: model: xai/grok-3 @@ -22,8 +22,3 @@ mcp_servers: spec_path: "/Users/krrishdholakia/Documents/temp_py_folder/example_openapi.json" auth_type: none allowed_tools: ["getpetbyid", "my_api_mcp-findpetsbystatus"] - - -litellm_settings: - callbacks: ["prometheus"] - custom_prometheus_metadata_labels: ["metadata.initiative", "metadata.business-unit"] diff --git a/tests/llm_translation/test_openai.py b/tests/llm_translation/test_openai.py index eaf0377757..6894c4bc98 100644 --- a/tests/llm_translation/test_openai.py +++ b/tests/llm_translation/test_openai.py @@ -726,3 +726,13 @@ def test_openai_safety_identifier_parameter_sync(): assert "safety_identifier" in request_body # Verify safety_identifier is correctly sent to the API assert request_body["safety_identifier"] == "user_code_123456" + + +def test_gpt_5_reasoning(): + litellm._turn_on_debug() + response = litellm.completion( + model="openai/responses/gpt-5-mini", + messages=[{"role": "user", "content": "Think of a poem, and then write it."}], + reasoning_effort="low", + ) + print("response: ", response)