patch - auth checks for model access (#8924)

This commit is contained in:
Ishaan Jaff 2025-03-01 10:11:44 -08:00 committed by GitHub
parent 428ed1360c
commit 5508239375
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
# What is this?
## Common checks for /v1/models and `/model/info`
import copy
from typing import Dict, List, Optional, Set
import litellm
@ -30,7 +31,7 @@ def get_provider_models(provider: str) -> Optional[List[str]]:
return get_valid_models()
if provider in litellm.models_by_provider:
provider_models = litellm.models_by_provider[provider]
provider_models = copy.deepcopy(litellm.models_by_provider[provider])
for idx, _model in enumerate(provider_models):
if provider not in _model:
provider_models[idx] = f"{provider}/{_model}"