From b516616aa59afa634083791e3d9f25d151ec2630 Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:02:53 -0700 Subject: [PATCH 1/2] fix(chatgpt): wrap string Responses input as user message Co-authored-by: lark Agent-Model: codex/gpt-6-sol/high --- .../llms/chatgpt/responses/transformation.py | 2 ++ .../test_chatgpt_responses_transformation.py | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/litellm/llms/chatgpt/responses/transformation.py b/litellm/llms/chatgpt/responses/transformation.py index 34953a79c60..4eb33a331b4 100644 --- a/litellm/llms/chatgpt/responses/transformation.py +++ b/litellm/llms/chatgpt/responses/transformation.py @@ -77,6 +77,8 @@ class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig): litellm_params: GenericLiteLLMParams, headers: dict, ) -> dict: + if isinstance(input, str): + input = [{"role": "user", "content": input}] request: Final = super().transform_responses_api_request( model, input, diff --git a/tests/unit/llms/chatgpt/responses/test_chatgpt_responses_transformation.py b/tests/unit/llms/chatgpt/responses/test_chatgpt_responses_transformation.py index e47d7fc702c..ed232d196df 100644 --- a/tests/unit/llms/chatgpt/responses/test_chatgpt_responses_transformation.py +++ b/tests/unit/llms/chatgpt/responses/test_chatgpt_responses_transformation.py @@ -31,6 +31,29 @@ def local_model_cost_map(monkeypatch: pytest.MonkeyPatch) -> Generator[None, Non class TestChatGPTResponsesAPITransformation: + @pytest.mark.parametrize( + ("input_value", "expected_input"), + [ + ("Reply with OK", [{"role": "user", "content": "Reply with OK"}]), + ("", [{"role": "user", "content": ""}]), + ( + [{"role": "user", "content": "Reply with OK"}], + [{"role": "user", "content": "Reply with OK"}], + ), + ], + ) + def test_chatgpt_wraps_string_input_for_codex_responses(self, input_value, expected_input) -> None: + config = ChatGPTResponsesAPIConfig() + request = config.transform_responses_api_request( + model="chatgpt/gpt-5.3-codex", + input=input_value, + response_api_optional_request_params={}, + litellm_params=GenericLiteLLMParams(), + headers={}, + ) + + assert request["input"] == expected_input + @pytest.mark.parametrize( ("requested_tier", "expected_tier"), [("default", "default"), ("priority", "priority"), ("fast", "priority")], From 90dced31a2c122c35847ccb3bb820f7e9fbad132 Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:39:03 -0700 Subject: [PATCH 2/2] fix: normalize ChatGPT Responses input without rebinding Co-authored-by: lark Agent-Model: codex/gpt-6-sol/high --- litellm/llms/chatgpt/responses/transformation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/litellm/llms/chatgpt/responses/transformation.py b/litellm/llms/chatgpt/responses/transformation.py index 4eb33a331b4..56f26e288eb 100644 --- a/litellm/llms/chatgpt/responses/transformation.py +++ b/litellm/llms/chatgpt/responses/transformation.py @@ -77,11 +77,12 @@ class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig): litellm_params: GenericLiteLLMParams, headers: dict, ) -> dict: - if isinstance(input, str): - input = [{"role": "user", "content": input}] + normalized_input: Final[str | ResponseInputParam] = ( + [{"role": "user", "content": input}] if isinstance(input, str) else input + ) request: Final = super().transform_responses_api_request( model, - input, + normalized_input, response_api_optional_request_params, litellm_params, headers,