The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
docs oauh 2.0 enterprise feature
Ishaan Jaffac833f415d87
diff --git a/docs/my-website/docs/proxy/oauth2.md b/docs/my-website/docs/proxy/oauth2.mdindex 668004349c9..ec076d8fae3 100644--- a/docs/my-website/docs/proxy/oauth2.md+++ b/docs/my-website/docs/proxy/oauth2.md@@ -2,6 +2,12 @@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))++:::+## Usage1. Set env vars:diff --git a/litellm/proxy/auth/oauth2_check.py b/litellm/proxy/auth/oauth2_check.pyindex 92c18ad5f44..ed5a3e26b13 100644--- a/litellm/proxy/auth/oauth2_check.py+++ b/litellm/proxy/auth/oauth2_check.py@@ -21,6 +21,14 @@ async def check_oauth2_token(token: str) -> UserAPIKeyAuth:from litellm._logging import verbose_proxy_loggerfrom 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)# Get the token info endpoint from environment variablediff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.pyindex f947b6fb718..758539f98b4 100644--- a/litellm/proxy/auth/user_api_key_auth.py+++ b/litellm/proxy/auth/user_api_key_auth.py@@ -201,6 +201,14 @@ async def user_api_key_auth(if general_settings.get("enable_oauth2_auth", False) is True:# return UserAPIKeyAuth object# 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)if general_settings.get("enable_jwt_auth", False) is True: