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: drop null summary text and emit reasoning-only assistant turns

Cursor Agentd46b0bddd7f3
diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py
index cf227cfa7d1..13dd41f9b86 100644
--- a/litellm/completion_extras/litellm_responses_transformation/transformation.py
+++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py
@@ -434,6 +434,8 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
"content": self._convert_content_to_responses_format(content, cast(str, role)),
}
)
+ elif role == "assistant":
+ input_items.extend(_reasoning_input_items(msg))
return input_items, instructions
diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py
index 23a9a60d810..6d47d0de19f 100644
--- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py
+++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py
@@ -110,8 +110,8 @@ class LiteLLMAnthropicToResponsesAPIAdapter:
def _summary_part_text(part: object) -> str:
if isinstance(part, Mapping):
mapping: Final = cast(Mapping[str, Any], part) # cast-ok: summary parts are untyped provider json
- return str(mapping.get("text", ""))
- return str(getattr(part, "text", ""))
+ return str(mapping.get("text") or "")
+ return str(getattr(part, "text", None) or "")
@classmethod
def _thinking_blocks_from_reasoning_item(