diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py index e984df82140..a98472a77a1 100644 --- a/litellm/litellm_core_utils/core_helpers.py +++ b/litellm/litellm_core_utils/core_helpers.py @@ -431,6 +431,7 @@ def filter_internal_params( "skip_mcp_handler", "mcp_handler_context", "_skip_mcp_handler", + "client_metadata", } # Add any additional internal params if provided diff --git a/tests/test_litellm/litellm_core_utils/test_core_helpers.py b/tests/test_litellm/litellm_core_utils/test_core_helpers.py index b67ea91bb0b..1385ee27765 100644 --- a/tests/test_litellm/litellm_core_utils/test_core_helpers.py +++ b/tests/test_litellm/litellm_core_utils/test_core_helpers.py @@ -4,6 +4,7 @@ import pytest from litellm.litellm_core_utils.core_helpers import ( _FINISH_REASON_MAP, + filter_internal_params, map_finish_reason, reconstruct_model_name, redact_nested_match_and_regex_keys, @@ -201,3 +202,11 @@ class TestRedactNestedMatchAndRegexKeys: def test_passes_through_none_and_str(self): assert redact_nested_match_and_regex_keys(None) is None assert redact_nested_match_and_regex_keys("plain") == "plain" + + +class TestFilterInternalParams: + def test_should_strip_client_metadata(self): + data = {"temperature": 0.7, "client_metadata": {"app": "codex-cli"}} + result = filter_internal_params(data) + assert "client_metadata" not in result + assert result["temperature"] == 0.7