AI & LLM Tools

Connect ComfyUI to Open WebUI: Integration Guide

J
James Eriksson
··14 min read
Integrate ComfyUI with Open WebUI for unified chat-and-image generation: node ID mapping, GPU requirements, Docker networking, and troubleshooting tips.
TL;DR
  • ComfyUI is a node-based image generator with 144.9k GitHub stars offering precise control over generation pipelines.
  • Connecting it to Open WebUI (157.7k stars) adds unified chat-and-image generation to a self-hosted LLM interface.
  • The integration requires exporting a ComfyUI workflow as JSON and mapping node IDs to Open WebUI parameters in the admin panel.
  • You need a GPU with at least 12 GB VRAM to run both tools together without major performance issues.
  • Troubleshooting usually involves checking the base URL, verifying the --listen flag on ComfyUI, and confirming port access.

ComfyUI is a node-based image generator that produces high-quality images with total control over every step. Open WebUI is a browser interface for language models with 157.7k GitHub stars. Connecting them gives you unified chat-and-image generation on your own hardware, keeping all workflows private. This guide walks you through the integration: prerequisites, configuration, node mapping, and troubleshooting.

What Is ComfyUI and Why Connect It to Open WebUI?

ComfyUI is a node-based image generation engine. Instead of clicking buttons in a web form, you build workflows by connecting boxes together: a prompt node feeds into a sampler node, which feeds into the KSampler that controls generation parameters. With 144.9k GitHub stars, it's the most popular node-based workflow tool for image generation. It's more complex than standard web interfaces, but it gives you total control over every step of the image generation pipeline.

Open WebUI is a browser interface for language models. When you connect ComfyUI to it, you get unified chat-and-image generation in one interface: ask a question, get an answer, then ask the model to describe an image, click a button, and generate it using ComfyUI.

Why integrate them instead of running them separately? First: workflow control. ComfyUI's node interface is precise but fiddly. Integrating it with Open WebUI lets you use the model to write the prompts and then generate images without switching windows. Second: privacy. Both run on your own hardware. Your prompts, images, and workflows never leave your network. Third: unified history. Every conversation and image lives in Open WebUI's database. You can trace which prompt generated which image months later. If you care about keeping your data private, this is the right approach compared to cloud image generation services.

The integration is not automatic. You have to manually connect ComfyUI (port 8188 by default) to Open WebUI (port 3000 or 8080), upload a workflow JSON file, and map the node IDs in ComfyUI to parameters in Open WebUI. This guide covers all of it, step by step.

Prerequisites: What You Need Before Starting

Before you start, have these things ready.

ComfyUI installed and running. Install it from the official GitHub repo. On Linux: clone the repo, install Python 3.10 or later, run pip install -r requirements.txt. On Windows: download the portable build or clone and use a Python virtual environment. On macOS: same process as Linux, but check for Apple Silicon support (you want the ARM64 build if you have an M1/M2/M3 Mac).

Start ComfyUI with the --listen flag:

python main.py --listen

By default, ComfyUI only listens on localhost (127.0.0.1), so Open WebUI can't reach it from another container or network. The flag opens it to all interfaces on port 8188.

Open WebUI installed and running. Run it via Docker, pip, or the desktop app. If you're using Docker, Open WebUI typically runs on port 8080 inside the container. If running via pip, it listens on port 3000 by default. Both tools must be running before you attempt the integration.

Model files in ComfyUI. ComfyUI doesn't come with model files. Create a models/ directory in your ComfyUI folder, then download: a checkpoint (e.g., sd-v1-5-pruned.safetensors from Hugging Face) to models/checkpoints/, a VAE (e.g., vae-ft-mse-840000.ckpt) to models/vae/, and any LoRAs to models/loras/. ComfyUI scans these directories on startup.

GPU with enough VRAM. ComfyUI and Open WebUI together consume GPU memory. An RTX 4070 (12 GB VRAM) is tight but workable. An RTX 4080 (16 GB) or RTX 6000 (24 GB) is comfortable. If you run both tools on one GPU, expect memory pressure. For comfort, aim for 24 GB or run them on separate GPUs. CPU-only is possible but generation takes minutes instead of seconds.

Port access and firewall rules. Make sure your server allows traffic on port 8188 (ComfyUI) and port 3000/8080 (Open WebUI). If they're behind a firewall or on different machines, you'll need to open those ports or use host-level networking.

Step 1: Prepare ComfyUI for API Access

ComfyUI normally runs with a visual node editor. To wire it to Open WebUI, you need to export a workflow as JSON in API format.

Open the ComfyUI web UI. In a browser, go to your ComfyUI instance (default: localhost:8188, or your server's IP:8188 if running remotely). You'll see a canvas with nodes on the left, the workflow in the center, and a menu on the right.

Create or load a workflow. For your first integration, build a simple text-to-image workflow: drag a "Load Checkpoint" node to the canvas (searches for model files in the checkpoints folder), add a "CLIP Text Encode" node for the positive prompt, add another "CLIP Text Encode" node for the negative prompt, add a "KSampler" node (the main image generator), add a "VAE Decode" node to convert the latent image to RGB, and add a "Save Image" node to write the output to disk. Connect them: checkpoint output to sampler input; sampler output to VAE decode input; VAE output to save image. ComfyUI workflows are modular, so you can use different node combinations. The key is that each node has a numeric ID (you'll see a number in the top-left corner of each node).

Enable Dev Mode. In the ComfyUI UI, look for a "Dev Mode" toggle (usually top-right, or in Settings). Turn it on. This unlocks the "Export (API)" button.

Export the workflow as API format. Right-click the canvas and select "Export (API)" or use the menu. This downloads a JSON file. Save it as my-workflow.json.

Note the node IDs. Open the JSON file in a text editor. You'll see entries like:

{
  "1": {
    "inputs": { "ckpt_name": "sd-v1-5-pruned.safetensors" },
    "class_type": "CheckpointLoaderSimple"
  },
  "2": {
    "inputs": { "text": "a cat sitting on a desk" },
    "class_type": "CLIPTextEncode"
  },
  "3": {
    "inputs": { "seed": 0, "steps": 20, "cfg": 7.0 },
    "class_type": "KSampler"
  }
}

The numbers at the top level (1, 2, 3) are the node IDs. You'll map these to Open WebUI parameters in Step 3.

Step 2: Configure Open WebUI Admin Settings

Now you need to tell Open WebUI where ComfyUI is and how to use it.

Log in as admin. Create an admin account on first login. Use that account and navigate to the Admin Panel (profile icon Settings or look for admin link).

Find the Images settings. Navigate to Admin Panel Settings Images. Here you'll see options for image generation:

  • Image Generation (toggle): Turn this ON.
  • Image Generation Engine (dropdown): Select "comfyui".

Enter the ComfyUI base URL. In the "ComfyUI Base URL" field, enter the address where ComfyUI is running:

  • If ComfyUI and Open WebUI are on the same machine: use localhost:8188
  • If they're in Docker containers on the same host: use the Docker host gateway on macOS/Windows (host.docker.internal:8188), or the container IP on Linux (check with docker inspect <container-id>)
  • If they're on different machines on your network: use the server IP on port 8188

Upload the workflow JSON. Below the URL field, there's a file upload box. Click it and select the my-workflow.json you exported in Step 1.

Save and test the connection. Click Save. Open WebUI will attempt to contact ComfyUI. If it succeeds, you'll see a "Connection successful" message. If it fails, check that ComfyUI is running, the port is correct, and the --listen flag is active.

Step 3: Map ComfyUI Node IDs to Open WebUI Parameters

This step is where most integrations fail. Open WebUI needs to know which ComfyUI node IDs correspond to which parameters.

Understand what you're mapping. When you ask Open WebUI to generate an image, it needs to insert the prompt text into the right node (usually a "CLIP Text Encode" for positive prompt), insert the negative prompt into another node, set the image width/height (usually in a "Latent Image" node), set the sampler algorithm and step count (usually in "KSampler"), and optionally set the seed. Open WebUI can't guess which nodes do what. You have to tell it explicitly.

Open the workflow JSON and find the node IDs. Open your exported my-workflow.json in a text editor. Look for each node and its class_type:

Example:

{
  "1": { "class_type": "CheckpointLoaderSimple",... },
  "2": { "class_type": "CLIPTextEncode", "inputs": { "text": "" },... },
  "3": { "class_type": "CLIPTextEncode", "inputs": { "text": "" },... },
  "4": { "class_type": "KSampler", "inputs": { "seed": 0, "steps": 20, "cfg": 7.0 },... },
  "5": { "class_type": "LatentImage", "inputs": { "width": 512, "height": 512 },... }
}

From this, you'd note: Node 2 (positive prompt), Node 3 (negative prompt), Node 4 (sampler with seed), Node 5 (image size).

Return to Open WebUI and fill in the node mapping fields. In Admin Panel Settings Images, after uploading the workflow, you should see fields for Prompt Node ID, Negative Prompt Node ID, Width Node ID / Height Node ID, Sampler Node ID, and Seed Node ID. Enter these IDs exactly as they appear in the JSON.

Test with a simple workflow first. Start with a minimal workflow (prompt sampler VAE decode save). Complex workflows will cause issues until you understand the mapping.

Save and move on. Once you've filled in all the node IDs, save. You're ready to test.

Step 4: Test and Generate Your First Image

Now generate your first image to confirm everything works.

Open a chat in Open WebUI. Go to the chat interface (not Admin Panel).

Ask for a prompt. Type a request like "Generate a prompt for an image of a sunset over the ocean." Let the language model generate a detailed prompt. Copy it.

Click the image generation button. Paste the prompt you just generated (or write your own). Click "Generate." ComfyUI should start executing the workflow. In ComfyUI's web UI (still open in another browser tab), you'll see the nodes light up as they execute: Checkpoint loader starts, prompt gets encoded, KSampler runs and shows a progress bar, VAE decoder finishes, save image writes the output.

This usually takes 10-60 seconds depending on your GPU and step count.

Check the result. If successful, the image appears in Open WebUI's chat. You can click it to view full size, and Open WebUI logs the prompt and settings used.

If it fails, check the error. Common errors:

  • "Connection refused": ComfyUI is not running or the base URL is wrong. Restart ComfyUI with --listen.
  • "Node ID not found": You mapped an incorrect node ID in Step 3. Verify the JSON.
  • "CUDA out of memory": Your GPU ran out of VRAM. Reduce step count, reduce image size, or enable model offloading.
  • "Model file not found": The checkpoint or VAE referenced in your workflow doesn't exist. Download and place it correctly.

Generate a few more images to confirm stability. If they all work, move to troubleshooting.

Troubleshooting Common Integration Issues

Even when you follow all the steps, things break. Here's what to do.

Connection refused on port 8188. This means Open WebUI can't reach ComfyUI. Verify: ComfyUI is running (open your ComfyUI instance in a browser). You used the --listen flag (restart with python main.py --listen if not). The base URL is correct (if using Docker on Linux, use the container IP, not host.docker.internal). No firewall is blocking port 8188 (run lsof -i :8188 on Linux/macOS or netstat -ano | findstr :8188 on Windows).

Node ID mapping errors. ComfyUI tries to set a node ID that doesn't exist. This means: You copied the wrong node ID from the JSON (re-export and double-check the class_type values). The workflow structure changed (re-export after editing). You're using a workflow variant (img2img vs txt2img) with different node types (stick with text-to-image for the first integration).

Model loading failures. ComfyUI says "Model 'sd-v1-5-pruned.safetensors' not found": The model file doesn't exist in the right folder (check that models/checkpoints/ contains the file and the filename matches exactly). The model is corrupted (try re-downloading). You're out of disk space (check df -h on Linux or disk usage on Windows).

Image generation takes too long or times out. You set too many steps in KSampler (reduce to 20-30 for testing). Your GPU is slow or CPU fallback is active (check if "cuda" or "rocm" appear in ComfyUI's startup logs). Your model is huge (SDXL takes longer; use a smaller model or enable model offloading).

Multi-user permissions: some users can't generate images. By default, only the admin account can trigger image generation. To allow other users: Go to Admin Panel Settings Images and look for "Allow all users to generate images" toggle. If no toggle exists, only admins can generate (a security choice to limit GPU usage).

Managing Permissions and Next Steps

Once your integration works, consider scaling it.

User permissions. By default, image generation is admin-only. Newer Open WebUI builds may have a "user roles" system. If you're running an older version, consider upgrading to get finer-grained controls.

Multiple workflows. Right now you've uploaded one workflow. To switch workflows, you'd have to re-upload a different JSON file and update the node IDs. A workaround: design one flexible workflow in ComfyUI that uses conditional nodes to switch behaviors based on input.

Scaling and optimization. As usage grows: Monitor VRAM usage (enable model offloading if needed). Batch generations (ComfyUI queues multiple requests; Open WebUI handles this). Run ComfyUI on separate hardware (if your LLM inference and image generation compete for GPU, split them across machines).

Next steps. After you've confirmed everything works, explore Open WebUI's other features: web search, prompt engineering, model switching. Learn ComfyUI workflows more deeply; the node system is powerful. If you want managed hosting instead of DIY setup, Opsily handles all of this infrastructure for you.

Frequently Asked Questions

Do I need to log in to generate images with ComfyUI in Open WebUI?

Yes. Open WebUI requires authentication. Create an account, log in, and then access the image generation feature from the chat interface. By default, image generation is admin-only, so the first user to register becomes admin. Other users need admin permission to enable image generation (see the "Managing Permissions" section).

Can I use multiple ComfyUI workflows in one Open WebUI instance?

Not through the standard UI. Open WebUI accepts one uploaded workflow JSON file per installation. If you need to switch between workflows (e.g., text-to-image vs. image-to-image), you'd manually re-upload a different JSON and update the node IDs. A workaround: design one flexible workflow that uses conditional nodes to switch behaviors.

What if ComfyUI and Open WebUI are on different machines?

You can run them on separate servers. Use the full IP address in the base URL. Make sure the ComfyUI server has the --listen flag active and port 8188 is open to traffic from the Open WebUI machine. Use a firewall rule or VPN if you don't want the port exposed on the public internet.

Does the integration work with custom ComfyUI nodes?

Yes, as long as the custom nodes follow ComfyUI's API. The node mapping works the same way: find the node ID in the JSON and tell Open WebUI which IDs to use. Some community nodes are complex (e.g., sampler replacements, advanced encoders). If the custom node doesn't fit the standard input/output pattern, you may need to adjust the workflow or mapping.

Can I generate images without Open WebUI's chat feature?

Not directly through the integration. Open WebUI's image generation is chat-aware: it reads your message, the model adds context, and generates an image. If you want to run ComfyUI standalone, you can use ComfyUI's web UI directly or call its API with curl/Python. Integrated image generation always goes through the Open WebUI chat.

What GPU do I need for both ComfyUI and Open WebUI?

An RTX 4070 (12 GB) is the minimum. If you run LLM inference and image generation on the same GPU, they'll compete for VRAM. A single large model uses 8-12 GB, and ComfyUI typically needs 4-8 GB. For comfort, aim for 24 GB (RTX 6000, A6000) or run them on separate GPUs. CPU-only is possible but generation takes minutes instead of seconds.

How do I update ComfyUI or Open WebUI without breaking the integration?

ComfyUI updates are usually backward-compatible. Git pull new code, restart ComfyUI with python main.py --listen and it should work. Open WebUI updates may change the admin panel layout, but the API is stable. Before updating either, back up your workflow JSON and note your node IDs. After updating, test image generation and confirm the node mapping still works.

The Bottom Line

ComfyUI's node interface gives you precise control over image generation. Open WebUI's chat brings that power to a browser interface for your own LLM. The integration requires exporting a workflow JSON, uploading it to Open WebUI, and mapping node IDs. Once done, you get unified chat-and-image generation on your own hardware with zero third-party access to your data.

The most common mistakes are wrong base URLs (Docker networking trips people up), unmapped or incorrectly mapped node IDs (re-check your JSON), and VRAM exhaustion (add more GPU memory or reduce image sizes). Troubleshooting usually means checking ports, verifying the --listen flag, and re-exporting the workflow if nodes are missing. If managing this infrastructure yourself isn't worth the time, check Opsily's managed Open WebUI hosting.

Self-hosted AI image generation
Connect ComfyUI to Open WebUI and generate images on your own hardware with no third-party access to your data.
Get Started Free

Ready to self-host your own apps?

One server. Multiple apps. No per-app fees.

Get started →