ComfyUI: Node-Based Stable Diffusion Interface
ComfyUI is the most powerful GUI and backend for Stable Diffusion. Unlike simple text-to-image tools, ComfyUI lets you build complex workflows using a visual node editor — chain models, control nets, upscalers, and custom logic.
How ComfyUI Works
Every workflow is a graph of nodes. Each node does one thing: load a model, encode text, sample, decode, save. Connect them visually and you have a complete image generation pipeline.
The Free API
ComfyUI exposes a WebSocket + REST API:
import json
import urllib.request
import websocket
SERVER = "127.0.0.1:8188"
# Queue a workflow
def queue_prompt(workflow):
data = json.dumps({"prompt": workflow}).encode("utf-8")
req = urllib.request.Request(
f"http://{SERVER}/prompt",
data=data,
headers={"Content-Type": "application/json"}
)
return json.loads(urllib.request.urlopen(req).read())
# Get generation history
def get_history(prompt_id):
resp = urllib.request.urlopen(f"http://{SERVER}/history/{prompt_id}")
return json.loads(resp.read())
# Download generated image
def get_image(filename, subfolder, folder_type):
params = f"?filename={filename}&subfolder={subfolder}&type={folder_type}"
resp = urllib.request.urlopen(f"http://{SERVER}/view{params}")
return resp.read()
# REST API endpoints
curl http://localhost:8188/system_stats
curl http://localhost:8188/object_info # All available nodes
curl http://localhost:8188/queue # Current queue status
curl -X POST http://localhost:8188/interrupt # Cancel current gen
Key Features
- Node-based workflow — visual programming for AI
- ControlNet — guide generation with poses, edges, depth maps
- LoRA/LyCORIS — fine-tuned style models
- Upscaling — Real-ESRGAN, Ultimate SD Upscale
- Inpainting — selective image editing
- Video — AnimateDiff, SVD workflows
- Custom nodes — 1000+ community extensions
Real-World Use Case
A game studio needed to generate 500 character portraits with consistent style. ComfyUI workflow: SDXL base -> ControlNet (pose) -> LoRA (art style) -> face fix -> upscale. Run via API in batch mode. 500 images in 4 hours, consistent quality.
Quick Start
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
pip install -r requirements.txt
python main.py --listen 0.0.0.0
# Open http://localhost:8188
Resources
Need automated AI data collection? Check out my scraping actors on Apify or email spinov001@gmail.com for custom AI automation.
Top comments (0)