@@ -1100,7 +1100,10 @@ def make_sync_azure_httpx_request(
11001100 )
11011101
11021102 def create_azure_base_url (
1103- self , azure_client_params : dict , model : Optional [str ]
1103+ self ,
1104+ azure_client_params : dict ,
1105+ model : Optional [str ],
1106+ base_model : Optional [str ] = None ,
11041107 ) -> str :
11051108 from litellm .llms .azure_ai .image_generation import (
11061109 AzureFoundryFluxImageGenerationConfig ,
@@ -1116,8 +1119,7 @@ def create_azure_base_url(
11161119 if model is None :
11171120 model = ""
11181121
1119- # MAI image models: /mai/v1/images/generations (serverless Azure AI)
1120- if AzureFoundryMAIImageGenerationConfig .is_mai_model (model ):
1122+ if AzureFoundryMAIImageGenerationConfig .is_mai_model (base_model or model ):
11211123 return AzureFoundryMAIImageGenerationConfig .get_mai_image_generation_url (
11221124 api_base = api_base ,
11231125 api_version = api_version ,
@@ -1164,10 +1166,10 @@ async def aimage_generation(
11641166 if api_base .endswith ("/" ):
11651167 api_base = api_base .rstrip ("/" )
11661168 api_version : str = azure_client_params .get ("api_version" , "" )
1167- # Use the deployment name (model) for URL construction, not the base_model from data
11681169 img_gen_api_base = self .create_azure_base_url (
11691170 azure_client_params = azure_client_params ,
11701171 model = model or data .get ("model" , "" ),
1172+ base_model = data .get ("model" , "" ),
11711173 )
11721174
11731175 ## LOGGING
@@ -1296,9 +1298,10 @@ def image_generation(
12961298 if aimg_generation is True :
12971299 return self .aimage_generation (data = data , input = input , logging_obj = logging_obj , model_response = model_response , api_key = api_key , client = client , azure_client_params = azure_client_params , timeout = timeout , headers = headers , model = model ) # type: ignore
12981300
1299- # Use the deployment name (model) for URL construction, not the base_model from data
13001301 img_gen_api_base = self .create_azure_base_url (
1301- azure_client_params = azure_client_params , model = model
1302+ azure_client_params = azure_client_params ,
1303+ model = model ,
1304+ base_model = base_model ,
13021305 )
13031306
13041307 ## LOGGING
0 commit comments