BerriAI/litellm · error · ValueError
Oauth2 token validation is only available for premium usersY
Error message
Oauth2 token validation is only available for premium usersYou must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. Pricing: https://www.litellm.ai/#pricing
What it means
Error "Oauth2 token validation is only available for premium usersYou must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. Pricing: https://www.litellm.ai/#pricing" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/auth/oauth2_check.py:132
"""
Makes a request to the token introspection endpoint to validate the OAuth2 token.
This function implements OAuth2 token introspection according to RFC 7662.
It supports both generic token info endpoints (GET) and OAuth2 introspection endpoints (POST).
Args:
token (str): The OAuth2 token to validate.
Returns:
UserAPIKeyAuth: If the token is valid, containing user information.
Raises:
ValueError: If the token is invalid, the request fails, or the token info endpoint is not set.
"""
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=[set=%s]", token is not None)
# Get the token info endpoint from environment variable
token_info_endpoint: Final = os.getenv("OAUTH_TOKEN_INFO_ENDPOINT")
user_id_field_name: Final = os.environ.get("OAUTH_USER_ID_FIELD_NAME", "sub")
user_role_field_name: Final = os.environ.get("OAUTH_USER_ROLE_FIELD_NAME", "role")
user_team_id_field_name: Final = os.environ.get("OAUTH_USER_TEAM_ID_FIELD_NAME", "team_id")
# OAuth2 client credentials for introspection endpoint authentication
oauth_client_id: Final = os.environ.get("OAUTH_CLIENT_ID")
oauth_client_secret: Final = os.environ.get("OAUTH_CLIENT_SECRET")
if not token_info_endpoint:
raise ValueError("OAUTH_TOKEN_INFO_ENDPOINT environment variable is not set")
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set the LITELLM_LICENSE environment variable to your LiteLLM Enterprise license key.
- Obtain a 7-day trial key at https://www.litellm.ai/enterprise#trial and set it as LITELLM_LICENSE.
- Remove OAuth2 token validation config if you do not have an Enterprise license.
Example fix
export LITELLM_LICENSE=<your-enterprise-key>
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/auth/oauth2_check.py:132 when the library encounters an invalid state.
Common situations: OAuth2 token validation was configured on a proxy running without a LiteLLM Enterprise license.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/7b54469d7f376aff.
Report an issue: GitHub.