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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Merge pull request #39571 from BerriAI/codex/team-id-empty-field
yujongleebb7d787425ee
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex c6ecb0be8b9..97f5f59d2dc 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -1930,6 +1930,13 @@ class NewTeamRequest(TeamBase):model_config = ConfigDict(protected_namespaces=())+ @field_validator("team_id", mode="before")+ @classmethod+ def treat_blank_team_id_as_unset(cls, v: object) -> object:+ if isinstance(v, str) and not v.strip():+ return None+ return v+class GlobalEndUsersSpend(LiteLLMPydanticObjectBase):api_key: str | None = Nonediff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.pyindex 30b2ab86b9a..088e82b370f 100644--- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py+++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py@@ -11083,6 +11083,14 @@ async def test_new_team_rejects_reserved_ui_session_team_id():mock_prisma.get_data.assert_not_called()[email protected]("team_id", ["", " "])+def test_new_team_request_blank_team_id_is_unset(team_id: str) -> None:+ from litellm.proxy._types import NewTeamRequest++ assert NewTeamRequest(team_alias="t", team_id=team_id).team_id is None+ assert NewTeamRequest(team_id="custom").team_id == "custom"++# ---------------------------------------------------------------------------# PATCH /team/{team_id} — RFC 7386 JSON Merge Patch#