Adds ComfyUI support to Open-WebUI with intelligent workflow selection based on the number of input images.
Features
✅Text-to-image: Generate images from text prompts only ✅Image-to-image: Transform a single input image based on prompts ✅Image fusion: Blend two images together with prompt guidance ✅Automatic workflow selection: System automatically picks the right workflow ✅WebSocket communication: Real-time generation status ✅Image upload: Seamlessly upload images to ComfyUI server
2+ input images → fusion2imgs workflow (uses first 2)
Configuration
Requires ComfyUI running with:
Fal API Flux Dev custom node installed
WebSocket enabled (default: ws://127.0.0.1:8188)
Server accessible from Open-WebUI backend
API Changes
No breaking changes. Extends existing /api/v1/images/generations endpoint with:
input_images: Optional list of file IDs for img2img/fusion
Testing
Text-to-image generation
Image-to-image (needs file upload testing)
Image fusion (needs file upload testing)
Example Usage
Text-to-image:
POST/api/v1/images/generations{"prompt":"a cute cat sitting on a chair","size":"1024x1024","n":1}---<sub>🔄ThisissuerepresentsaGitHubPullRequest.ItcannotbemergedthroughGiteaduetoAPIlimitations.</sub>
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/18322
**Author:** [@PerryPAN219](https://github.com/PerryPAN219)
**Created:** 10/14/2025
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `feat/perry-comfyui-exploration`
---
### 📝 Commits (2)
- [`3e95e7c`](https://github.com/open-webui/open-webui/commit/3e95e7c40d7039a50462ad56a53f2ec1d9c4f268) Scaffold Setup, setup guide and updated docker-compose configuration:
- [`529ac9a`](https://github.com/open-webui/open-webui/commit/529ac9a6870522e7ae4ebce3d31ae9188aa6522b) feat: Add ComfyUI integration with automatic workflow selection
### 📊 Changes
**12 files changed** (+1221 additions, -168 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/config.py` (+13 -0)
📝 `backend/open_webui/env.py` (+1 -0)
📝 `backend/open_webui/routers/images.py` (+48 -34)
📝 `backend/open_webui/utils/images/comfyui.py` (+230 -121)
➕ `backend/open_webui/utils/images/comfyui_uploader.py` (+171 -0)
➕ `backend/open_webui/utils/images/templates/__init__.py` (+50 -0)
➕ `backend/open_webui/utils/images/templates/fusion2imgs.py` (+139 -0)
➕ `backend/open_webui/utils/images/templates/img2img.py` (+93 -0)
➕ `backend/open_webui/utils/images/templates/text2img.py` (+58 -0)
➕ `backend/open_webui/utils/images/workflow_selector.py` (+139 -0)
📝 `docker-compose.yaml` (+24 -13)
➕ `setupguide.md` (+255 -0)
</details>
### 📄 Description
## 🎨 ComfyUI Integration
### Overview
Adds ComfyUI support to Open-WebUI with intelligent workflow selection based on the number of input images.
### Features
✅ **Text-to-image**: Generate images from text prompts only
✅ **Image-to-image**: Transform a single input image based on prompts
✅ **Image fusion**: Blend two images together with prompt guidance
✅ **Automatic workflow selection**: System automatically picks the right workflow
✅ **WebSocket communication**: Real-time generation status
✅ **Image upload**: Seamlessly upload images to ComfyUI server
### Architecture
#### New Modules
backend/open_webui/utils/images/
backend/open_webui/
├── routers/
│ └── images.py
└── utils/images/
├── comfyui.py
├── comfyui_uploader.py
├── workflow_selector.py
└── templates/
├── __init__.py
├── text2img.py
├── img2img.py
└── fusion2imgs.py
#### Workflow Selection Logic
- **0 input images** → `text2img` workflow
- **1 input image** → `img2img` workflow
- **2+ input images** → `fusion2imgs` workflow (uses first 2)
### Configuration
Requires ComfyUI running with:
- Fal API Flux Dev custom node installed
- WebSocket enabled (default: `ws://127.0.0.1:8188`)
- Server accessible from Open-WebUI backend
### API Changes
No breaking changes. Extends existing `/api/v1/images/generations` endpoint with:
- `input_images`: Optional list of file IDs for img2img/fusion
### Testing
- [x] Text-to-image generation
- [ ] Image-to-image (needs file upload testing)
- [ ] Image fusion (needs file upload testing)
### Example Usage
**Text-to-image:**
```json
POST /api/v1/images/generations
{
"prompt": "a cute cat sitting on a chair",
"size": "1024x1024",
"n": 1
}
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/18322
Author: @PerryPAN219
Created: 10/14/2025
Status: ❌ Closed
Base:
main← Head:feat/perry-comfyui-exploration📝 Commits (2)
3e95e7cScaffold Setup, setup guide and updated docker-compose configuration:529ac9afeat: Add ComfyUI integration with automatic workflow selection📊 Changes
12 files changed (+1221 additions, -168 deletions)
View changed files
📝
backend/open_webui/config.py(+13 -0)📝
backend/open_webui/env.py(+1 -0)📝
backend/open_webui/routers/images.py(+48 -34)📝
backend/open_webui/utils/images/comfyui.py(+230 -121)➕
backend/open_webui/utils/images/comfyui_uploader.py(+171 -0)➕
backend/open_webui/utils/images/templates/__init__.py(+50 -0)➕
backend/open_webui/utils/images/templates/fusion2imgs.py(+139 -0)➕
backend/open_webui/utils/images/templates/img2img.py(+93 -0)➕
backend/open_webui/utils/images/templates/text2img.py(+58 -0)➕
backend/open_webui/utils/images/workflow_selector.py(+139 -0)📝
docker-compose.yaml(+24 -13)➕
setupguide.md(+255 -0)📄 Description
🎨 ComfyUI Integration
Overview
Adds ComfyUI support to Open-WebUI with intelligent workflow selection based on the number of input images.
Features
✅ Text-to-image: Generate images from text prompts only
✅ Image-to-image: Transform a single input image based on prompts
✅ Image fusion: Blend two images together with prompt guidance
✅ Automatic workflow selection: System automatically picks the right workflow
✅ WebSocket communication: Real-time generation status
✅ Image upload: Seamlessly upload images to ComfyUI server
Architecture
New Modules
backend/open_webui/utils/images/
backend/open_webui/
├── routers/
│ └── images.py
└── utils/images/
├── comfyui.py
├── comfyui_uploader.py
├── workflow_selector.py
└── templates/
├── __init__.py
├── text2img.py
├── img2img.py
└── fusion2imgs.py
Workflow Selection Logic
text2imgworkflowimg2imgworkflowfusion2imgsworkflow (uses first 2)Configuration
Requires ComfyUI running with:
ws://127.0.0.1:8188)API Changes
No breaking changes. Extends existing
/api/v1/images/generationsendpoint with:input_images: Optional list of file IDs for img2img/fusionTesting
Example Usage
Text-to-image: