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(utils.py): only add non none values to extra body

Krrish Dholakia8db3f6f927e9
diff --git a/litellm/utils.py b/litellm/utils.py
index 60716cb5c11..ccc4b475621 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -4085,7 +4085,7 @@ def add_provider_specific_params_to_optional_params(
):
extra_body = passed_params.pop("extra_body", {})
for k in passed_params.keys():
- if k not in openai_params:
+ if k not in openai_params and passed_params[k] is not None:
extra_body[k] = passed_params[k]
optional_params.setdefault("extra_body", {})
initial_extra_body = {
@@ -4107,7 +4107,7 @@ def add_provider_specific_params_to_optional_params(
)
else:
for k in passed_params.keys():
- if k not in openai_params:
+ if k not in openai_params and passed_params[k] is not None:
optional_params[k] = passed_params[k]
return optional_params