diff --git a/litellm/proxy/image_endpoints/endpoints.py b/litellm/proxy/image_endpoints/endpoints.py index 16aa8f1657..a1453e10db 100644 --- a/litellm/proxy/image_endpoints/endpoints.py +++ b/litellm/proxy/image_endpoints/endpoints.py @@ -215,9 +215,11 @@ async def image_generation( async def image_edit_api( request: Request, fastapi_response: Response, - image: List[UploadFile] = File(...), - mask: Optional[List[UploadFile]] = File(None), user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), + image: Optional[List[UploadFile]] = File(None), + image_array: Optional[List[UploadFile]] = File(None, alias="image[]"), + mask: Optional[List[UploadFile]] = File(None), + mask_array: Optional[List[UploadFile]] = File(None, alias="mask[]"), model: Optional[str] = None, ): """ @@ -233,6 +235,18 @@ async def image_edit_api( -F 'prompt=Create a studio ghibli image of this' ``` """ + if image is not None and image_array is not None: + raise HTTPException(status_code=422, detail="Cannot specify both 'image' and 'image[]'") + if mask is not None and mask_array is not None: + raise HTTPException(status_code=422, detail="Cannot specify both 'mask' and 'mask[]'") + if image is None and image_array is not None: + image = image_array + if mask is None and mask_array is not None: + mask = mask_array + + if image is None: + raise HTTPException(status_code=422, detail="Field required: image") + from litellm.proxy.proxy_server import ( _read_request_body, general_settings,