{"record":{"id":"304809156449e680","repo":"BerriAI/litellm","slug":"azure-ai-api-key-is-required-for-model-model-se-304809","errorCode":null,"errorMessage":"Azure AI API key is required for model {model}. Set AZURE_AI_API_KEY environment variable or pass api_key parameter.","messagePattern":"Azure AI API key is required for model (.+?)\\. Set AZURE_AI_API_KEY environment variable or pass api_key parameter\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/image_edit/transformation.py","lineNumber":38,"sourceCode":"    with image files and prompt.\n    \"\"\"\n\n    def validate_environment(\n        self,\n        headers: dict,\n        model: str,\n        api_key: str | None = None,\n        litellm_params: dict | None = None,\n        api_base: str | None = None,\n    ) -> dict:\n        \"\"\"\n        Validate Azure AI Foundry environment and set up authentication\n        Uses Api-Key header format\n        \"\"\"\n        api_key = AzureFoundryModelInfo.get_api_key(api_key)\n\n        if not api_key:\n            raise ValueError(\n                f\"Azure AI API key is required for model {model}. Set AZURE_AI_API_KEY environment variable or pass api_key parameter.\"\n            )\n\n        headers.update(\n            {\n                \"Api-Key\": api_key,  # Azure AI Foundry uses Api-Key header format\n            }\n        )\n        return headers\n\n    def get_complete_url(\n        self,\n        model: str,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:\n        \"\"\"\n        Constructs a complete URL for Azure AI Foundry image edits API request.","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure_ai/image_edit/transformation.py#L20-L56","documentation":"Error \"Azure AI API key is required for model {model}. Set AZURE_AI_API_KEY environment variable or pass api_key parameter.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/image_edit/transformation.py:38 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":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}