From 4c2e5c93e9287479f56f780708656136849ccaee Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 20 Dec 2025 17:56:46 +0400 Subject: [PATCH] refac: gpt-image support --- backend/open_webui/routers/images.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/routers/images.py b/backend/open_webui/routers/images.py index 6003f641b..ed4348414 100644 --- a/backend/open_webui/routers/images.py +++ b/backend/open_webui/routers/images.py @@ -195,12 +195,12 @@ async def update_config( set_image_model(request, form_data.IMAGE_GENERATION_MODEL) if ( form_data.IMAGE_SIZE == "auto" - and form_data.IMAGE_GENERATION_MODEL != "gpt-image-1" + and not form_data.IMAGE_GENERATION_MODEL.startswith("gpt-image") ): raise HTTPException( status_code=400, detail=ERROR_MESSAGES.INCORRECT_FORMAT( - " (auto is only allowed with gpt-image-1)." + " (auto is only allowed with gpt-image models)." ), ) @@ -379,6 +379,7 @@ def get_models(request: Request, user=Depends(get_verified_user)): {"id": "dall-e-2", "name": "DALL·E 2"}, {"id": "dall-e-3", "name": "DALL·E 3"}, {"id": "gpt-image-1", "name": "GPT-IMAGE 1"}, + {"id": "gpt-image-1.5", "name": "GPT-IMAGE 1.5"}, ] elif request.app.state.config.IMAGE_GENERATION_ENGINE == "gemini": return [ @@ -563,7 +564,9 @@ async def image_generations( ), **( {} - if "gpt-image-1" in request.app.state.config.IMAGE_GENERATION_MODEL + if request.app.state.config.IMAGE_GENERATION_MODEL.startswith( + "gpt-image" + ) else {"response_format": "b64_json"} ), **( @@ -866,7 +869,7 @@ async def image_edits( **({"size": size} if size else {}), **( {} - if "gpt-image-1" in request.app.state.config.IMAGE_EDIT_MODEL + if request.app.state.config.IMAGE_EDIT_MODEL.startswith("gpt-image") else {"response_format": "b64_json"} ), }