{"record":{"id":"82f8c33bcf2af705","repo":"BerriAI/litellm","slug":"missing-azure-ai-api-key-a-call-is-being-made-to","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/ocr/transformation.py","lineNumber":57,"sourceCode":"        self,\n        headers: dict,\n        model: str,\n        api_key: str | None = None,\n        api_base: str | None = None,\n        litellm_params: dict | None = None,\n        **kwargs,\n    ) -> dict:\n        \"\"\"\n        Validate environment and return headers for Azure AI OCR.\n\n        Azure AI uses Bearer token authentication with AZURE_AI_API_KEY.\n        \"\"\"\n        # Get API key from environment if not provided\n        if api_key is None:\n            api_key = get_secret_str(AZURE_AI_OCR_API_KEY_ENV_VAR)\n\n        if api_key is None:\n            raise ValueError(\n                \"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\"\n            )\n\n        # Validate API base is provided\n        if api_base is None:\n            api_base = get_secret_str(\"AZURE_AI_API_BASE\")\n\n        if api_base is None:\n            raise ValueError(\n                \"Missing Azure AI API Base - Set AZURE_AI_API_BASE environment variable or pass api_base parameter\"\n            )\n\n        headers = {\n            \"Authorization\": f\"Bearer {api_key}\",\n            \"Content-Type\": \"application/json\",\n            **headers,\n        }\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure_ai/ocr/transformation.py#L39-L75","documentation":"Error \"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\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/ocr/transformation.py:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set AZURE_AI_API_KEY or pass api_key."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}