docs oauh 2.0 enterprise feature

This commit is contained in:
Ishaan Jaff 2024-08-16 14:00:24 -07:00
parent 0d41e2972b
commit ac833f415d
3 changed files with 22 additions and 0 deletions

View file

@ -2,6 +2,12 @@
Use this if you want to use an Oauth2.0 token to make `/chat`, `/embeddings` requests to the LiteLLM Proxy Use this if you want to use an Oauth2.0 token to make `/chat`, `/embeddings` requests to the LiteLLM Proxy
:::info
This is an Enterprise Feature - [get in touch with us if you want a free trial to test if this feature meets your needs]((https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat))
:::
## Usage ## Usage
1. Set env vars: 1. Set env vars:

View file

@ -21,6 +21,14 @@ async def check_oauth2_token(token: str) -> UserAPIKeyAuth:
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm.llms.custom_httpx.http_handler import _get_async_httpx_client from litellm.llms.custom_httpx.http_handler import _get_async_httpx_client
from litellm.proxy._types import CommonProxyErrors
from litellm.proxy.proxy_server import premium_user
if premium_user is not True:
raise ValueError(
"Oauth2 token validation is only available for premium users"
+ CommonProxyErrors.not_premium_user.value
)
verbose_proxy_logger.debug("Oauth2 token validation for token=%s", token) verbose_proxy_logger.debug("Oauth2 token validation for token=%s", token)
# Get the token info endpoint from environment variable # Get the token info endpoint from environment variable

View file

@ -201,6 +201,14 @@ async def user_api_key_auth(
if general_settings.get("enable_oauth2_auth", False) is True: if general_settings.get("enable_oauth2_auth", False) is True:
# return UserAPIKeyAuth object # return UserAPIKeyAuth object
# helper to check if the api_key is a valid oauth2 token # helper to check if the api_key is a valid oauth2 token
from litellm.proxy.proxy_server import premium_user
if premium_user is not True:
raise ValueError(
"Oauth2 token validation is only available for premium users"
+ CommonProxyErrors.not_premium_user.value
)
return await check_oauth2_token(token=api_key) return await check_oauth2_token(token=api_key)
if general_settings.get("enable_jwt_auth", False) is True: if general_settings.get("enable_jwt_auth", False) is True: