litellm/litellm/proxy_auth/__init__.py
Cesar Garcia b33e1e8019
feat(sdk): add proxy_auth for auto OAuth2/JWT token management (#20238)
Adds litellm.proxy_auth to automatically obtain and refresh OAuth2/JWT
tokens when connecting to LiteLLM Proxy or any OAuth2-protected endpoint.

- Add ProxyAuthHandler for token lifecycle (obtain, cache, refresh)
- Add AzureADCredential wrapper for azure-identity credentials
- Add GenericOAuth2Credential for any OAuth2 provider (Okta, Auth0, etc)
- Auto-inject Authorization headers in completion() and embedding()

Closes #19834
2026-02-02 22:04:08 -08:00

31 lines
663 B
Python

"""
Proxy Authentication module for LiteLLM SDK.
This module provides OAuth2/JWT token management for authenticating
with LiteLLM Proxy or any OAuth2-protected endpoint.
Usage:
from litellm.proxy_auth import AzureADCredential, ProxyAuthHandler
litellm.proxy_auth = ProxyAuthHandler(
credential=AzureADCredential(),
scope="api://my-proxy/.default"
)
"""
from .credentials import (
AccessToken,
TokenCredential,
AzureADCredential,
GenericOAuth2Credential,
ProxyAuthHandler,
)
__all__ = [
"AccessToken",
"TokenCredential",
"AzureADCredential",
"GenericOAuth2Credential",
"ProxyAuthHandler",
]