From 58e0d5e12e724a27b2677d067c4add0bee649c1c Mon Sep 17 00:00:00 2001 From: jho1-godaddy <171078705+jho1-godaddy@users.noreply.github.com> Date: Wed, 17 Jun 2026 06:09:17 -0500 Subject: [PATCH] fix(types): prevent internal parallel_request_limiter fields from leaking to upstream providers (#30545) * fix(types): add internal parallel_request_limiter fields to all_litellm_params to prevent forwarding to upstream providers * test(types): add regression test for internal rate-limit fields in all_litellm_params --- litellm/types/utils.py | 5 +++++ tests/test_litellm/types/test_types_utils.py | 23 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 5e50369799f..de0c621c97b 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -3246,6 +3246,11 @@ all_litellm_params = ( "order", "enable_json_schema_validation", "use_xai_oauth", + "_litellm_rate_limit_descriptors", + "_litellm_tpm_reserved_tokens", + "_litellm_tpm_reserved_model", + "_litellm_tpm_reserved_scopes", + "_litellm_tpm_reservation_released", ] + list(StandardCallbackDynamicParams.__annotations__.keys()) + list(CustomPricingLiteLLMParams.model_fields.keys()) diff --git a/tests/test_litellm/types/test_types_utils.py b/tests/test_litellm/types/test_types_utils.py index a4074ccdaaa..fde71ae65f2 100644 --- a/tests/test_litellm/types/test_types_utils.py +++ b/tests/test_litellm/types/test_types_utils.py @@ -321,6 +321,29 @@ class TestNativeFinishReason: assert choice.provider_specific_fields["native_finish_reason"] == "MAX_TOKENS" +def test_parallel_request_limiter_internal_fields_in_all_litellm_params(): + """ + Regression test: internal fields written by parallel_request_limiter_v3 must + be in all_litellm_params so they are stripped before forwarding to upstream + providers. If missing, they are sent as extra body parameters and providers + like OpenAI reject the request with a 400 invalid_request_error. + """ + from litellm.types.utils import all_litellm_params + + internal_fields = [ + "_litellm_rate_limit_descriptors", + "_litellm_tpm_reserved_tokens", + "_litellm_tpm_reserved_model", + "_litellm_tpm_reserved_scopes", + "_litellm_tpm_reservation_released", + ] + for field in internal_fields: + assert field in all_litellm_params, ( + f"{field!r} is not in all_litellm_params. " + "It will be forwarded to upstream providers and cause 400 errors." + ) + + def test_delta_maps_reasoning_to_reasoning_content(): """ Test that Delta maps 'reasoning' field to 'reasoning_content'.