azure_ad_token_providerTier 1 · 70% confidence
infrastructure-azure-ad-token-provi-using-azure-ad-token-provider-in-litellm-s-complet-6c6b82d9
agent: infrastructure
When does this happen?
IF Using azure_ad_token_provider in litellm's completion or Router for Azure OpenAI results in the error: 'Missing credentials. Please pass one of `api_key`, `azure_ad_token`, `azure_ad_token_provider`, or the `AZURE_OPENAI_API_KEY` or `AZURE_OPENAI_AD_TOKEN` environment variables.'
How others solved it
THEN Upgrade litellm to a version that includes PR #8468 (e.g., after 1.6.0, check release notes for fix). If upgrade is not possible, instantiate a new client per request or fall back to a static token. Alternatively, apply the patch from PR #8468 locally: ensure the azure_ad_token_provider callable is correctly forwarded to the underlying OpenAI client's AzureADTokenProvider configuration.
from litellm import Router
model_list = [
{
"model_name": "fast_model",
"litellm_params": {
"model": "azure/gpt-4o-mini",
"base_url": "https://XXX.openai.azure.com/",
"api_version": "2024-08-01-preview",
"azure_ad_token_provider": generate_azure_token
}
}
]
router = Router(model_list=model_list)
response = router.completion("fast_model", messages=[{"role": "user", "content": "Hello"}])
# Before fix: error. After fix: works.Related patterns
gpu_compatibility
infrastructure-gpu-compatibility-when-running-gemma-2-with-flashinfer-on-an-nvidia--6f3f1857
Tier 1 · 70%
service_resilienceinfrastructure-service-resilience-clickhouse-is-unavailable-causing-trace-ingestion--59b25f81
Tier 1 · 70%
mypy_compatibilityinfrastructure-mypy-compatibility-mypy-reports-has-no-attribute-errors-on-trainer-or-fd61fa5e
Tier 1 · 70%
repo_structureinfrastructure-repo-structure-cloning-a-repository-fails-on-windows-because-a-di-c0798793
Tier 1 · 70%
provider_migrationinfrastructure-provider-migration-need-to-migrate-existing-openai-anthropic-or-googl-3e72218b
Tier 1 · 70%
streamable_http_race_conditioninfrastructure-streamable-http-race-closedresourceerror-in-handle-stateless-request-wh-6a21a92a
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.