From 9344f205a8891f8213dca4eb5dcb4169d476bfc3 Mon Sep 17 00:00:00 2001 From: Mateo Wang <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 4 Jun 2026 12:13:11 -0700 Subject: [PATCH] fix(proxy): add default=None to LiteLLM_TeamMembership.litellm_budget_table (#29684) In Pydantic v2, Optional[T] without a default is a required field. Any row with budget_id=null triggered a validation error and returned 401. Co-authored-by: Florent Chenebault --- tests/test_litellm/proxy/test_proxy_types.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_litellm/proxy/test_proxy_types.py b/tests/test_litellm/proxy/test_proxy_types.py index b435244638..bc77a9ba3c 100644 --- a/tests/test_litellm/proxy/test_proxy_types.py +++ b/tests/test_litellm/proxy/test_proxy_types.py @@ -47,6 +47,24 @@ def test_audit_log_masking(): assert json_before_value["key"] == "sk-1*****7890" +def test_team_membership_null_budget_table(): + """ + Regression test for: LiteLLM_TeamMembership.litellm_budget_table missing = None. + In Pydantic v2, Optional[T] without a default is required; rows with budget_id=null + raised a validation error and returned 401. + Related: https://github.com/BerriAI/litellm/issues/28689 + """ + from litellm.proxy._types import LiteLLM_TeamMembership + + membership = LiteLLM_TeamMembership(user_id="u1", team_id="t1") + assert membership.litellm_budget_table is None + + membership_explicit = LiteLLM_TeamMembership( + user_id="u1", team_id="t1", litellm_budget_table=None + ) + assert membership_explicit.litellm_budget_table is None + + def test_internal_jobs_user_has_proxy_admin_role(): """ Test that the internal jobs system user has PROXY_ADMIN role.