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(responses): avoid sending empty tools list in follow-up turns

Sameer Kankutee6d5e3af02cd
diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py
index 71fa88fb751..3467dbbd27f 100644
--- a/litellm/responses/litellm_completion_transformation/transformation.py
+++ b/litellm/responses/litellm_completion_transformation/transformation.py
@@ -229,9 +229,13 @@ class LiteLLMCompletionResponsesConfig:
if litellm_logging_obj:
litellm_logging_obj.stream_options = stream_options
- # only pass non-None values
+ # only pass non-None / non-empty values
+ # Explicitly exclude an empty tools list — sending tools=[] to providers
+ # like Anthropic in a tool_result conversation makes them return empty content.
litellm_completion_request = {
- k: v for k, v in litellm_completion_request.items() if v is not None
+ k: v
+ for k, v in litellm_completion_request.items()
+ if v is not None and not (k == "tools" and v == [])
}
return litellm_completion_request