{"record":{"id":"8cfdd0bb978cb242","repo":"BerriAI/litellm","slug":"azure-ai-api-key-is-required-for-model-model-se","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/flux2_transformation.py","lineNumber":77,"sourceCode":"    def use_multipart_form_data(self) -> bool:\n        \"\"\"FLUX 2 uses JSON requests, not multipart/form-data.\"\"\"\n        return False\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        \"\"\"\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,\n                \"Content-Type\": \"application/json\",\n            }\n        )\n        return headers\n\n    def transform_image_edit_request(\n        self,\n        model: str,\n        prompt: str | None,\n        image: FileTypes | None,\n        image_edit_optional_request_params: dict,\n        litellm_params: GenericLiteLLMParams,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure_ai/image_edit/flux2_transformation.py#L59-L95","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/flux2_transformation.py:77 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"}