fix auth checks for provider routes

This commit is contained in:
Ishaan Jaff 2024-08-29 16:40:46 -07:00
parent b60e42db09
commit c30fd9a775
2 changed files with 28 additions and 1 deletions

View file

@ -227,3 +227,24 @@ def get_key_model_tpm_limit(user_api_key_dict: UserAPIKeyAuth) -> Optional[dict]
return user_api_key_dict.metadata["model_tpm_limit"]
return None
def is_pass_through_provider_route(route: str) -> bool:
PROVIDER_SPECIFIC_PASS_THROUGH_ROUTES = [
"vertex-ai",
]
# check if any of the prefixes are in the route
for prefix in PROVIDER_SPECIFIC_PASS_THROUGH_ROUTES:
if prefix in route:
return True
return False
def should_run_auth_on_pass_through_provider_route(route: str) -> bool:
"""
Use this to decide if the rest of the LiteLLM Virtual Key auth checks should run on /vertex-ai/{endpoint} routes
"""
# by default we do not run virtual key auth checks on /vertex-ai/{endpoint} routes
return False