From 56c9cadc9b4c9a03ccfdf277136106c4951ad649 Mon Sep 17 00:00:00 2001 From: PRABHU KIRAN VANDRANKI <72809214+VANDRANKI@users.noreply.github.com> Date: Mon, 18 May 2026 16:51:11 -0400 Subject: [PATCH] fix(auth): union proxy models in get_key_models when all-proxy-models sentinel present get_key_models replaced all_models with proxy_model_list when the "all-proxy-models" sentinel was present, discarding team-specific models already resolved. get_team_models correctly uses set.update() (union) for the same sentinel. Align both functions so /v1/models returns the expected union for team-scoped keys. --- litellm/proxy/auth/model_checks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/auth/model_checks.py b/litellm/proxy/auth/model_checks.py index bf76f99db69..49a09d61422 100644 --- a/litellm/proxy/auth/model_checks.py +++ b/litellm/proxy/auth/model_checks.py @@ -115,7 +115,11 @@ def get_key_models( user_api_key_dict.team_models ) # copy to avoid mutating cached objects if SpecialModelNames.all_proxy_models.value in all_models: - all_models = list(proxy_model_list) # copy to avoid mutating caller's list + # Union team-specific models with proxy-wide list, matching get_team_models() + # which uses set.update(). Replacing discards team-specific models. + merged = set(all_models) | set(proxy_model_list) + merged.discard(SpecialModelNames.all_proxy_models.value) + all_models = list(merged) if include_model_access_groups: all_models.extend(model_access_groups.keys())