test(router): pin unscoped exact credential lookup

This commit is contained in:
Yujong Lee 2026-08-30 18:56:26 -07:00 committed by GitHub
parent 413cb8076c
commit 952191bd58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View file

@ -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.

View file

@ -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"