ComfyUI
This tutorial is a community contribution and is not supported by the Open WebUI team. It serves only as a demonstration on how to customize Open WebUI for your specific use case. Want to contribute? Check out the contributing tutorial.
ComfyUI is a powerful and modular node-based GUI for Stable Diffusion. It gives users a high degree of control over the image generation process. Learn more or download it from its GitHub page.
To run ComfyUI and make it accessible to Open WebUI, you must start it with the --listen flag to bind to 0.0.0.0. This allows it to accept connections from other computers on your network.
Once running, the ComfyUI interface will be available at http://<your_comfyui_ip>:8188.

Connecting ComfyUI to Open WebUI
Since Open WebUI typically runs inside Docker, the container has to reach the host-based ComfyUI application via host.docker.internal.
- Host Binding Check: Ensure ComfyUI is running with the
--listenflag so it binds to0.0.0.0. - Firewall Check: If the host firewall (UFW) is active, ensure port 8188 is allowed (
sudo ufw allow 8188/tcp). - Linux native Docker: Without Docker Desktop, map the host gateway when you start the Open WebUI container by adding
--add-host=host.docker.internal:host-gatewayto thedocker runcommand.
A ComfyUI connection holds one workflow for generating images and one for editing them. Under Capabilities in the connection, Generate becomes available once a generation workflow is uploaded and Edit once an edit workflow is uploaded.
Image Prompt Generation
This feature uses a language model to automatically generate more detailed and creative prompts based on your initial input, which can lead to better image results. It only applies to Legacy function calling; in the default Native mode the model writes the prompt itself when it calls the tool.
The Image Prompt Generation toggle is in the Legacy section of Settings > Images & Videos (admin section).
To customize the prompt template used for generation, go to Settings > Interface (admin section), in the Generation section.
Create Image (Image Generation)
-
In Open WebUI, go to Settings > Images & Videos (admin section) and switch on Image Generation.
-
Add a connection and set Connection Type to ComfyUI.
-
In URL, enter the address of your running ComfyUI instance (for example
http://host.docker.internal:8188/) and click the verify icon next to it. A success message should appear. Open WebUI also opens a WebSocket to/wson this address, so any proxy in front of ComfyUI must pass WebSocket upgrades. -
If your ComfyUI instance requires an API key, enter it in the key field.
-
Export the workflow from ComfyUI. In the ComfyUI interface, click the ComfyUI logo at the top left and click Settings. Search for and toggle on the "Dev Mode" option with a description that states "Enable dev mode options (API save, etc.)".

Load the image generation workflow you want to use, then click the "Export (API)" button in the File sub-menu after clicking the ComfyUI logo, name the file and download it.

-
Upload it. In Open WebUI, click Upload in the Generation Workflow section and select the JSON file you just downloaded.
-
Map the workflow nodes. After the workflow is imported, map the node IDs from your workflow to the corresponding fields in Open WebUI. Each parameter has two fields:
- Key (left field): The input parameter name in the workflow (e.g.,
text,ckpt_name,seed) - Node Ids (right field): The comma-separated node ID(s) that contain this input
The UI displays six configurable parameters for image generation:
Parameter Default Key Required Description Prompt* textYes Positive prompt text Model ckpt_nameNo Checkpoint model name Width widthNo Output image width Height heightNo Output image height Steps stepsNo Sampling steps Seed seedNo Random seed for reproducibility Only the prompt node ID is required. You can find the node ID by clicking on a node in ComfyUI and viewing its details.
Open WebUI returns the images from the workflow's Save Image, Save Image (Advanced), Save Animated WEBP, Save Animated PNG and Preview Image nodes. Animated images stay animated in the chat.
infoYou may need to adjust a
Keyto match a node in your workflow. For example, the defaultseedkey might need to be changed tonoise_seeddepending on your workflow's structure.tipSome workflows, such as ones that use any of the Flux models, need several node IDs for one entry. Separate them with commas (e.g.,
1or1, 2). - Key (left field): The input parameter name in the workflow (e.g.,
-
Leave Model IDs empty to use the model set in the workflow, or add model names to offer them. The suggested names come from the last verify: from the node mapped as Model (its first input whose name contains
_name, such asckpt_nameorunet_name), or from the CheckpointLoaderSimple checkpoints when no Model node is mapped, so verify again after mapping the nodes. Under Advanced, Image Size and Steps are optional defaults. Without an Image Size, ComfyUI receives 512x512. A mapped Seed node gets a new random seed on every request. -
Click Access, choose who may use the connection, and click Save. Without a grant, only admins can use the connection.

Messages have no "Generate Image" button. Generation happens from the chat itself: switch Image on in the + menu of the message input, then ask for the image. See Usage for the conditions that have to be met and for a community action that adds such a button.
Edit Image
Open WebUI also supports image editing through ComfyUI, allowing you to modify existing images.
-
In Settings > Images & Videos (admin section), switch Image Edit on.
-
In the Edit Workflow section of the same connection, upload a workflow designed for image editing, exported the same way as the generation workflow.
-
Map the workflow nodes. Image editing has five parameters with different defaults than generation:
Parameter Default Key Required Description Image* imageYes Input image to edit Prompt* promptYes Edit prompt text Model unet_nameNo Diffusion model name Width widthNo Output image width Height heightNo Output image height For edits with several input images, list one LoadImage node ID per image in the Image row, separated by commas. Each image goes to one node ID in order, and images beyond the number of IDs are dropped.
Edit Image Size under Advanced sets the output size.

Deeper Dive: Mapping ComfyUI Nodes to Open WebUI
Understanding the node ID mapping is often the biggest hurdle in integrating ComfyUI with an external service like Open WebUI. Integrating ComfyUI via API requires mapping Open WebUI's generic controls (e.g., "Model," "Width," "Prompt") to specific node inputs within your static ComfyUI workflow JSON.
Mapping Workflow Nodes to Open WebUI
The node mapping under each workflow lets you map generic controls to specific node inputs in your static ComfyUI workflow JSON. Each row has two fields:
| Field | Description | Example |
|---|---|---|
| Key (left) | The input parameter name from the node's inputs block | text, ckpt_name, seed |
| Node Ids (right) | Comma-separated node IDs to target | 6 or 1, 2, 3 |
Identifying Node IDs and Input Keys in ComfyUI
Before configuring Open WebUI, you must examine your exported workflow JSON files directly in a text editor. The Node ID is the unique number ComfyUI uses to identify the node in the JSON structure. The top-level keys in the JSON object are the node IDs.
Identify the Input Key (The Parameter Name)
The Key is the exact parameter name within that node's JSON structure that you need to change (e.g., seed, width, ckpt_name).
- Examine the JSON: Look at your API workflow JSON (
workflow_api.json). - Find the Node ID: Locate the section corresponding to the node's ID (e.g.,
"37"). - Identify the Key: Within the
"inputs"block, find the variable you want to control.
Example: CheckpointLoaderSimple Node (ID 37)
"37": {
"inputs": {
"ckpt_name": "qwen_image_fp8_e4m3fn.safetensors"
},
"class_type": "CheckpointLoaderSimple",
"_meta": {
"title": "Load Checkpoint"
}
},Example: KSampler Node (ID 3)
"3": {
"inputs": {
"seed": 42,
"steps": 20,
"cfg": 8.0,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1.0
},
"class_type": "KSampler",
"_meta": {
"title": "KSampler"
}
},Default Key Values by Task Type
Image Generation:
- Prompt:
text - Model:
ckpt_name - Width:
width - Height:
height - Steps:
steps - Seed:
seed
Image Editing:
- Image:
image - Prompt:
prompt - Model:
unet_name - Width:
width - Height:
height
Example: Mapping KSampler Seed
Let's say you want to control the seed in your KSampler node, which has an ID of 3. In the seed row of the node mapping:
| Key | Node Ids |
|---|---|
seed | 3 |
Handling Multiple Node IDs
If multiple nodes need the same value (e.g., seed applied to multiple samplers), provide comma-separated IDs:
| Key | Node Ids |
|---|---|
seed | 3, 15, 22 |
Handling Complex/Multimodal Nodes (Qwen Example)
For specialized nodes, the Key may not be a simple text.
| Parameter | Key | Node Ids | Note |
|---|---|---|---|
| Prompt | text or prompt | 76 | Depends on node type (CLIPTextEncode vs TextEncodeQwen) |
| Model | ckpt_name | 37 | Used for CheckpointLoaderSimple |
| Model | unet_name | varies | Used for UNETLoader in some workflows |
| Image Input | image | 78 | The key passes the filename to the LoadImage node |
Troubleshooting Mismatch Errors
If ComfyUI stalls or gives a validation error, consult the log and the JSON structure:
| Error Type | Cause & Debugging | Solution |
|---|---|---|
Value not in list: ckpt_name: 'xyz.safetensors' | You mapped the correct node ID (e.g., 37), but the value being passed (e.g., xyz.safetensors) is not a valid model name for that node type (e.g., accidentally sending a VAE model to a checkpoint loader). | Correct the model name set in Open WebUI for either image generation or editing, ensuring both model names match the type of model the ComfyUI node is expecting. |
Missing input <key> | Your workflow requires an input (e.g., cfg or sampler_name), but Open WebUI did not send a value because the field was not mapped. | Either hardcode the value in the workflow JSON, or map the required input key to the correct node ID. |
By meticulously matching the Node ID and the specific Key, you ensure Open WebUI correctly overwrites the default values in your workflow JSON before submitting the prompt to ComfyUI.
Example Setup: Qwen Image Generation and Editing
This section provides a supplementary guide on setting up the Qwen models for both image generation and editing.
Qwen Image Generation
Model Download
- Diffusion Model: qwen_image_fp8_e4m3fn.safetensors
- Text Encoder: qwen_2.5_vl_7b_fp8_scaled.safetensors
- VAE: qwen_image_vae.safetensors
Model Storage Location
ComfyUI/
├── models/
│ ├── diffusion_models/
│ │ └── qwen_image_fp8_e4m3fn.safetensors
│ ├── vae/
│ │ └── qwen_image_vae.safetensors
│ └── text_encoders/
│ └── qwen_2.5_vl_7b_fp8_scaled.safetensors
Workflow Node Mapping for Qwen Generation
| Parameter | Key | Node Ids |
|---|---|---|
| Prompt | prompt | (depends on your workflow) |
| Model | ckpt_name | (checkpoint loader node ID) |
Qwen Image Editing
Model Download
- Diffusion Model: qwen_image_edit_fp8_e4m3fn.safetensors
- Text Encoder: qwen_2.5_vl_7b_fp8_scaled.safetensors
- VAE: qwen_image_vae.safetensors
Model Storage Location
ComfyUI/
├── models/
│ ├── diffusion_models/
│ │ └── qwen_image_edit_fp8_e4m3fn.safetensors
│ ├── vae/
│ │ └── qwen_image_vae.safetensors
│ └── text_encoders/
│ └── qwen_2.5_vl_7b_fp8_scaled.safetensors
Workflow Node Mapping for Qwen Editing
| Parameter | Key | Node Ids |
|---|---|---|
| Image | image | (load image node ID) |
| Prompt | prompt | (text encoder node ID) |
| Model | unet_name | (UNET loader node ID) |
Example Setup: FLUX.1 Image Generation
This section provides a supplementary guide on setting up the FLUX.1 models for image generation.
FLUX.1 Dev
Model Download
- Diffusion Model: flux1-dev.safetensors
- Text Encoder 1: clip_l.safetensors
- Text Encoder 2: t5xxl_fp16.safetensors (Recommended when your VRAM is greater than 32GB)
- VAE: ae.safetensors
Model Storage Location
ComfyUI/
├── models/
│ ├── diffusion_models/
│ │ └── flux1-dev.safetensors
│ ├── vae/
│ │ └── ae.safetensors
│ └── text_encoders/
│ ├── clip_l.safetensors
│ └── t5xxl_fp16.safetensors
FLUX.1 Schnell
Model Download
- Diffusion Model: flux1-schnell.safetensors
- Text Encoder 1: clip_l.safetensors
- Text Encoder 2: t5xxl_fp8_e4m3fn.safetensors (Recommended when your VRAM is greater than 32GB)
- VAE: ae.safetensors
Model Storage Location
ComfyUI/
├── models/
│ ├── diffusion_models/
│ │ └── flux1-schnell.safetensors
│ ├── vae/
│ │ └── ae.safetensors
│ └── text_encoders/
│ ├── clip_l.safetensors
│ └── t5xxl_fp8_e4m3fn.safetensors
Configuring with SwarmUI
SwarmUI utilizes ComfyUI as its backend. In order to get Open WebUI to work with SwarmUI you will have to append ComfyBackendDirect to the connection's URL. Additionally, you will want to setup SwarmUI with LAN access. After aforementioned adjustments, setting up SwarmUI to work with Open WebUI will be the same as the steps for ComfyUI image generation outlined above.
SwarmUI API URL
The address you will input as the URL will look like: http://<your_swarmui_address>:7801/ComfyBackendDirect