BerriAI/litellm · error · ValueError
Missing Azure AI API Base - Set AZURE_AI_API_BASE…
Error message
Missing Azure AI API Base - Set AZURE_AI_API_BASE environment variable or pass api_base parameter
What it means
Error "Missing Azure AI API Base - Set AZURE_AI_API_BASE environment variable or pass api_base parameter" thrown in BerriAI/litellm.
Solutions
- Set AZURE_AI_API_BASE or pass api_base.
When it happens
Trigger: Thrown at litellm/llms/azure_ai/ocr/transformation.py:66 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/8459c79d173e7fb7.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/azure_ai/ocr/transformation.py:66
Validate environment and return headers for Azure AI OCR.
Azure AI uses Bearer token authentication with AZURE_AI_API_KEY.
"""
# Get API key from environment if not provided
if api_key is None:
api_key = get_secret_str(AZURE_AI_OCR_API_KEY_ENV_VAR)
if api_key is None:
raise ValueError(
"Missing Azure AI API Key - A call is being made to Azure AI but no key is set either in the environment variables or via params"
)
# Validate API base is provided
if api_base is None:
api_base = get_secret_str("AZURE_AI_API_BASE")
if api_base is None:
raise ValueError(
"Missing Azure AI API Base - Set AZURE_AI_API_BASE environment variable or pass api_base parameter"
)
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
**headers,
}
return headers
def get_complete_url(
self,
api_base: str | None,
model: str,
optional_params: dict,
litellm_params: dict | None = None,
**kwargs,View on GitHub (pinned to 77b7c6c40c)