BerriAI/litellm · error · ValueError
Missing Mistral API Key - A call is being made to Mistral…
Error message
Missing Mistral API Key - A call is being made to Mistral but no key is set either in the environment variables or via params
What it means
Error "Missing Mistral API Key - A call is being made to Mistral but no key is set either in the environment variables or via params" thrown in BerriAI/litellm.
Solutions
- Set MISTRAL_API_KEY in the environment, or pass api_key='...' to the OCR call.
When it happens
Trigger: Thrown at litellm/llms/mistral/ocr/transformation.py:108 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/bca8e1bf6eaa1020.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/mistral/ocr/transformation.py:108
def validate_environment(
self,
headers: dict,
model: str,
api_key: str | None = None,
api_base: str | None = None,
litellm_params: dict | None = None,
**kwargs,
) -> dict:
"""
Validate environment and return headers for Mistral OCR.
"""
# Get API key from environment if not provided
if api_key is None:
api_key = get_secret_str(MISTRAL_OCR_API_KEY_ENV_VAR)
if api_key is None:
raise ValueError(
"Missing Mistral API Key - A call is being made to Mistral but no key is set either in the environment variables or via params"
)
headers = {
"Authorization": f"Bearer {api_key}",
**headers,
}
# Don't set Content-Type for multipart/form-data - httpx will handle it
return headers
def get_complete_url(
self,
api_base: str | None,
model: str,
optional_params: dict,
litellm_params: dict | None = None,View on GitHub (pinned to 77b7c6c40c)