diff --git a/litellm/router.py b/litellm/router.py index 50841410a23..e15cf013585 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -9558,12 +9558,12 @@ class Router: Args: model_id: Model ID or model name from model_list (e.g., "gpt-4o-litellm") - team_id: Optional team id of the caller. When set, team-scoped - deployments (indexed by team public model name, including team - wildcard models like "openai/*") are also considered. Name and - wildcard lookups never resolve a deployment owned by a - different team, so shared model names can't leak another - team's credentials. + team_id: Optional team id of the caller. When set, team-scoped + deployments (indexed by team public model name, including team + wildcard models like "openai/*") are also considered. Exact-ID, + name, and wildcard lookups never resolve a deployment owned by + a different team. Callers without a team id retain legacy + exact-ID behavior for internal credential-resolution flows. Returns: Dictionary containing api_key, api_base, custom_llm_provider, etc. diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py index 1b39af44494..b0878b8a21e 100644 --- a/tests/test_litellm/test_router.py +++ b/tests/test_litellm/test_router.py @@ -4801,6 +4801,10 @@ def test_get_deployment_credentials_with_provider_rejects_other_team_exact_id(): assert owner_credentials is not None assert owner_credentials["api_key"] == "team-b-key" + unscoped_credentials = router.get_deployment_credentials_with_provider(model_id="team-b-deployment") + assert unscoped_credentials is not None + assert unscoped_credentials["api_key"] == "team-b-key" + assert ( router.get_deployment_credentials_with_provider( model_id="team-b-deployment", team_id="team-a"