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(litellm_responses_transformation/transformation.py): several fixes for chat completion to responses api bridge

Krrish Dholakia4ad1b9c9e140
diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py
index fd00470f2d1..59bfd001aa8 100644
--- a/litellm/completion_extras/litellm_responses_transformation/transformation.py
+++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py
@@ -203,6 +203,11 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
if value is not None:
if key == "instructions" and instructions:
request_data["instructions"] = instructions
+ elif key == "stream_options" and isinstance(value, dict):
+ request_data["stream_options"] = value.get("include_obfuscation")
+ elif key == "user": # string can't be longer than 64 characters
+ if isinstance(value, str) and len(value) <= 64:
+ request_data["user"] = value
else:
request_data[key] = value
diff --git a/tests/llm_translation/test_openai.py b/tests/llm_translation/test_openai.py
index aed3ca3d6c3..4b63311f1a7 100644
--- a/tests/llm_translation/test_openai.py
+++ b/tests/llm_translation/test_openai.py
@@ -1263,4 +1263,5 @@ def test_openai_gpt_5_codex_reasoning():
response = litellm.completion(**completion_kwargs)
print("response: ", response)
- assert response.choices[0].message.content is not None
+ for chunk in response:
+ print("chunk: ", chunk)