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): keep litellm params out of provider request bodies

Devin AI6f9915b65005
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 1d73542c9bb..fbfcc678de9 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -3761,6 +3761,16 @@ all_litellm_params = (
"model_file_id_mapping",
"litellm_logging_obj",
"litellm_call_id",
+ "completion_call_id",
+ "model_alias_map",
+ "custom_prompt_dict",
+ "stream_response",
+ "cost_per_query",
+ "ssl_verify",
+ "data_residency",
+ "async_call",
+ "aembedding",
+ "allm_passthrough_route",
"_litellm_strip_stream_usage",
"use_client",
"id",
diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py
index 2dfe00b0537..04d2d35e05f 100644
--- a/tests/test_litellm/test_utils.py
+++ b/tests/test_litellm/test_utils.py
@@ -29,6 +29,7 @@ from litellm._logging import (
verbose_logger,
)
from litellm.integrations.custom_logger import CustomLogger
+from litellm.litellm_core_utils.get_litellm_params import get_litellm_params
from litellm.litellm_core_utils.thread_pool_executor import executor as logging_executor
from litellm.proxy.utils import is_valid_api_key
from litellm.types.utils import (
@@ -5389,6 +5390,26 @@ def test_websearch_interception_control_fields_never_reach_the_provider():
assert set(WEBSEARCH_INTERNAL_CONTROL_FIELDS) <= set(all_litellm_params)
+def test_get_litellm_params_keys_never_reach_the_provider():
+ """Bridges (chat <-> Responses, agentic loop follow-ups) forward litellm_params as
+ `completion()` kwargs. Any key the param builder does not recognize is swept into
+ extra_body, and OpenAI rejects the call with `Unknown parameter: 'model_alias_map'`.
+ """
+ litellm_param_keys = frozenset(get_litellm_params()) - {"drop_params"}
+ kwargs = {
+ "a_real_provider_specific_param": 1,
+ "model_alias_map": {"alias": "gpt-5.4"},
+ **{key: "configured-value" for key in litellm_param_keys - {"model_alias_map"}},
+ }
+
+ non_default = get_non_default_completion_params(kwargs)
+
+ assert non_default == {"a_real_provider_specific_param": 1}, (
+ "litellm params leaked into the provider params: "
+ f"{sorted(set(non_default) - {'a_real_provider_specific_param'})}"
+ )
+
+
def test_bedrock_batch_params_never_reach_the_provider():
"""A Bedrock managed-batch deployment carries aws_batch_role_arn / s3_* /
bedrock_tags in its litellm_params, and the same deployment also serves chat.