BerriAI/litellm · error · ValueError
OAUTH_TOKEN_INFO_ENDPOINT environment variable is not set
Error message
OAUTH_TOKEN_INFO_ENDPOINT environment variable is not set
What it means
Oauth2 token validation needs the token-info introspection endpoint URL from OAUTH_TOKEN_INFO_ENDPOINT; the premium gate passed but the deployment never configured where to introspect tokens, so validation cannot run.
Source
Thrown at litellm/proxy/auth/oauth2_check.py:149
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")
client: Final = get_async_httpx_client(llm_provider=httpxSpecialProvider.Oauth2Check)
# Determine if this is an introspection endpoint (requires POST) or token info endpoint (uses GET)
is_introspection_endpoint: Final = Oauth2Handler._is_introspection_endpoint(
token_info_endpoint=token_info_endpoint,
oauth_client_id=oauth_client_id,
oauth_client_secret=oauth_client_secret,
)
try:
if is_introspection_endpoint:
# OAuth2 Token Introspection (RFC 7662) - requires POST with form data
verbose_proxy_logger.debug("Using OAuth2 introspection endpoint (POST)")
headers, data = Oauth2Handler._prepare_introspection_request(
token=token,
oauth_client_id=oauth_client_id,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set the OAUTH_TOKEN_INFO_ENDPOINT environment variable to your provider's token introspection/userinfo endpoint.
Example fix
export OAUTH_TOKEN_INFO_ENDPOINT=https://your-idp.example.com/oauth2/introspect
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/auth/oauth2_check.py:149 when the library encounters an invalid state.
Common situations: OAuth2 token validation is enabled but the token info endpoint env var is missing.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/8970c5ba5c44253c.
Report an issue: GitHub.