{"record":{"id":"6457ae9c13fba55b","repo":"BerriAI/litellm","slug":"api-base-is-required-for-azure-ai-mai-image-genera","errorCode":null,"errorMessage":"api_base is required for Azure AI MAI image generation","messagePattern":"api_base is required for Azure AI MAI image generation","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/image_generation/mai_transformation.py","lineNumber":29,"sourceCode":"from litellm.utils import convert_to_model_response_object\n\nif TYPE_CHECKING:\n    from litellm.litellm_core_utils.logging import Logging as LiteLLMLoggingObj\n\n\nclass AzureFoundryMAIImageGenerationConfig(BaseImageGenerationConfig):\n    \"\"\"Azure AI Foundry MAI image generation (e.g. MAI-Image-2.5).\"\"\"\n\n    DEFAULT_WIDTH = 1024\n    DEFAULT_HEIGHT = 1024\n\n    @staticmethod\n    def get_mai_image_generation_url(\n        api_base: str | None,\n        api_version: str | None,\n    ) -> str:\n        if api_base is None:\n            raise ValueError(\"api_base is required for Azure AI MAI image generation\")\n\n        api_version = api_version or \"preview\"\n        path, separator, query = api_base.partition(\"?\")\n        path = path.rstrip(\"/\")\n\n        if \"/mai/\" in path:\n            prefix, _, _ = path.partition(\"/images/\")\n            path = f\"{prefix}/images/generations\"\n        else:\n            path = f\"{path}/mai/v1/images/generations\"\n\n        if separator:\n            return f\"{path}?{query}\"\n        return f\"{path}?api-version={api_version}\"\n\n    @staticmethod\n    def get_mai_image_edit_url(\n        api_base: str | None,","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure_ai/image_generation/mai_transformation.py#L11-L47","documentation":"Error \"api_base is required for Azure AI MAI image generation\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/image_generation/mai_transformation.py:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass api_base for the Azure AI MAI image generation call."],"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-15T17:31:12.345Z"}