ComfyUI Workflows: Beginner to Advanced Guide to Nodes, Models and Ready-to-Run Graphs
A practical ComfyUI tutorial and workflow library for anyone learning node-based Stable Diffusion, SDXL, Flux and video diffusion workflows. It explains what every core node does, where each model file goes, how to build the common graphs (txt2img, img2img, inpainting, LoRA, ControlNet, hires fix, upscaling, video), and how to run workflows from Python through the ComfyUI API. It ships tested API-format workflow JSON files and a small standard-library client.
Who it is for: beginners who opened ComfyUI and saw spaghetti, and intermediate users who want to understand why a graph works so they can build their own.
Last reviewed: December 2026. ComfyUI moves fast: new model families get native support every few months and node names occasionally change. When something here disagrees with your install, the official docs and the built-in Template Library win.
Table of Contents
- What ComfyUI is
- Install options
- Model files and where they go
- The interface in five minutes
- Core concepts: how diffusion maps to nodes
- Core node reference
- Workflow 1: Text to image
- Workflow 2: Image to image
- Workflow 3: Inpainting and outpainting
- Workflow 4: LoRA
- Workflow 5: ControlNet
- Workflow 6: Hires fix (two-pass)
- Workflow 7: Upscaling with a model
- Workflow 8: Flux and other newer image models
- Workflow 9: Video generation
- Settings cheat sheet
- Prompting tips for diffusion models
- Running workflows from Python (API)
- Custom nodes: useful packs and safety
- Performance and VRAM
- Troubleshooting
- Best picks: which model family for which job
- Workflow organization tips
- Training your own LoRA (overview)
- Running ComfyUI in the cloud
- FAQ
- Where to go next
- Glossary
- Resources
- Repository layout
- Contributing
- License
- More free resources
What ComfyUI is
ComfyUI is an open-source, node-based interface and engine for diffusion models. Instead of a form with sliders, you connect nodes into a graph: load a model, encode a prompt, sample, decode, save. Benefits:
- You see the whole pipeline. Nothing is hidden behind presets.
- Workflows are files. Save a graph as JSON, share it, version it. Images saved by ComfyUI embed the workflow in PNG metadata, so dragging an output image back into ComfyUI restores the graph that made it.
- Only changed parts re-run. If you change only the seed, ComfyUI reuses cached outputs of nodes upstream that did not change.
- It runs many model families: Stable Diffusion 1.x and 2.x, SDXL, SD3.x, Flux, and a growing list of video, audio and 3D models, plus thousands of community custom nodes.
Install options
| Option | Best for | Notes |
|---|---|---|
| ComfyUI Desktop | Windows and macOS users who want an installer | Download from comfy.org; bundles Python and the manager |
| Portable build (Windows) | NVIDIA users on Windows who want a self-contained folder | 7z archive from the GitHub releases page; run the .bat file |
| Manual install | Linux, AMD, developers | Clone the repo, install PyTorch for your GPU, then requirements |
| comfy-cli | Scripted installs, servers | comfy-cli: pip install comfy-cli, then comfy install and comfy launch |
Manual install outline (check the manual install page for the exact PyTorch command for your GPU, which changes with CUDA and ROCm versions):
python3 -m venv comfy-venv && source comfy-venv/bin/activate
git clone https://github.com/Comfy-Org/ComfyUI.git
cd ComfyUI
# install the PyTorch build for your hardware first (see docs), then:
pip install -r requirements.txt
python main.py # serves the UI at http://127.0.0.1:8188
Useful launch flags (run python main.py --help for the full list in your version):
| Flag | Effect |
|---|---|
--listen 0.0.0.0 |
Accept connections from other machines (put it behind auth or a VPN) |
--port 8189 |
Change the port (default 8188) |
--lowvram / --novram |
Offload more aggressively for small GPUs |
--cpu |
Run on CPU (very slow, but works) |
--output-directory PATH |
Save images somewhere else |
--extra-model-paths-config FILE |
Load models from additional folders (see extra_model_paths.yaml.example in the repo) |
Hardware reality check: SD 1.5 runs on 4 GB VRAM, SDXL is comfortable from 8 GB, Flux-class and video models want 12 to 24 GB or more unless you use quantized (for example GGUF or FP8) variants and offloading. Apple silicon works through PyTorch’s MPS backend and is slower than a comparable NVIDIA GPU.
Model files and where they go
Everything lives under ComfyUI/models/. Putting a file in the wrong folder is the number one beginner problem: the loader’s dropdown simply will not list it.
| Folder | What goes there | Loaded by |
|---|---|---|
checkpoints/ |
All-in-one model files (UNet/DiT + text encoder + VAE), for example SD 1.5 and SDXL checkpoints | Load Checkpoint (CheckpointLoaderSimple) |
diffusion_models/ (older name unet/) |
Diffusion model weights only (Flux, video models, many newer models) | Load Diffusion Model (UNETLoader) |
text_encoders/ (older name clip/) |
Text encoders (CLIP-L, CLIP-G, T5-XXL, and the LLM-based encoders newer models use) | Load CLIP, DualCLIPLoader, and similar |
vae/ |
Standalone VAEs | Load VAE |
loras/ |
LoRA and LyCORIS files | Load LoRA |
controlnet/ |
ControlNet and T2I-adapter models | Load ControlNet Model |
upscale_models/ |
ESRGAN-family upscalers (.pth, .safetensors) |
Load Upscale Model |
embeddings/ |
Textual inversion embeddings | Referenced in prompt text as embedding:name |
clip_vision/ |
Image encoders for image prompting and some video models | Load CLIP Vision |
File format advice:
- Prefer
.safetensors. Older.ckptand.ptfiles are pickle-based and can execute code when loaded. - Download models from the original publisher or well-known hubs (Hugging Face, Civitai) and read the model card for license and recommended settings.
- Check that a LoRA or ControlNet matches the base model family (SD 1.5 vs SDXL vs Flux). Mismatches either error or silently do nothing.
After adding files, press R in the UI (refresh) or reload the page so dropdowns update.
The interface in five minutes
| Action | How |
|---|---|
| Add a node | Double-click the empty canvas and type its name |
| Connect | Drag from an output dot to a matching input dot (colors show types) |
| Run (queue) | Ctrl+Enter (or the Run / Queue button) |
| Save workflow | Ctrl+S; export as JSON from the workflow menu |
| Load a workflow | Drag a .json file, or a PNG made by ComfyUI, onto the canvas |
| Bypass a node | Select it and press Ctrl+B (data passes through) |
| Mute a node | Ctrl+M (node and its dependents are skipped) |
| Group nodes | Select, right-click, “Add Group For Selected Nodes” |
| Convert a widget to an input | Drag a link onto the widget (newer versions), or right-click the node |
| Templates | Workflow menu > Browse Templates: official starting graphs per model family |
Input types are color coded: MODEL, CLIP, VAE, CONDITIONING, LATENT, IMAGE, MASK and so on. You can only connect matching types, which makes the graph self-documenting once you know the types.
Core concepts: how diffusion maps to nodes
A latent diffusion model generates an image by starting from noise in a compressed latent space and removing noise step by step, guided by your prompt. Every basic graph is that idea, drawn as nodes:
[Load Checkpoint] ──MODEL──────────────────────────────┐
│ ──CLIP──► [CLIP Text Encode +] ──CONDITIONING─┤
│ ──CLIP──► [CLIP Text Encode -] ──CONDITIONING─┤
│ ▼
│ [Empty Latent Image] ──► [KSampler] ──LATENT──► [VAE Decode] ──IMAGE──► [Save Image]
└──VAE───────────────────────────────────────────────────────────────▲
| Concept | Node | What it means |
|---|---|---|
| Model | MODEL output of a loader | The denoising network (UNet or DiT) |
| Text encoder | CLIP output, CLIP Text Encode |
Turns your prompt into conditioning vectors |
| Conditioning | CONDITIONING | The guidance signal: positive (what you want), negative (what to avoid) |
| Latent | LATENT | The compressed image the model works on (for SD-family VAEs, 8x smaller per side than the final image) |
| VAE | VAE, VAE Decode / VAE Encode |
Converts between latents and pixels |
| Sampler | KSampler |
Runs the denoising loop |
| Seed | KSampler seed |
Picks the starting noise; same seed + same settings = same image |
| Steps | KSampler steps |
Number of denoising iterations |
| CFG | KSampler cfg |
How strongly to follow the prompt vs. an unconditioned prediction |
| Sampler / scheduler | sampler_name, scheduler |
The numerical method and the noise schedule across steps |
| Denoise | KSampler denoise |
Fraction of the schedule to run: 1.0 = start from pure noise; lower = keep more of the input latent |
Core node reference
| Node (display name) | class_type |
Inputs | Outputs |
|---|---|---|---|
| Load Checkpoint | CheckpointLoaderSimple |
ckpt_name |
MODEL, CLIP, VAE |
| Load Diffusion Model | UNETLoader |
unet_name, weight_dtype |
MODEL |
| Load VAE | VAELoader |
vae_name |
VAE |
| CLIP Text Encode (Prompt) | CLIPTextEncode |
text, clip |
CONDITIONING |
| Empty Latent Image | EmptyLatentImage |
width, height, batch_size |
LATENT |
| KSampler | KSampler |
model, positive, negative, latent_image, seed, steps, cfg, sampler_name, scheduler, denoise |
LATENT |
| KSampler (Advanced) | KSamplerAdvanced |
as above plus add_noise, start_at_step, end_at_step, return_with_leftover_noise |
LATENT |
| VAE Decode | VAEDecode |
samples, vae |
IMAGE |
| VAE Encode | VAEEncode |
pixels, vae |
LATENT |
| VAE Encode (for Inpainting) | VAEEncodeForInpaint |
pixels, vae, mask, grow_mask_by |
LATENT |
| Load Image | LoadImage |
image (file in input/) |
IMAGE, MASK (from alpha) |
| Save Image | SaveImage |
images, filename_prefix |
(writes to output/) |
| Preview Image | PreviewImage |
images |
(temporary preview) |
| Load LoRA | LoraLoader |
model, clip, lora_name, strength_model, strength_clip |
MODEL, CLIP |
| Load ControlNet Model | ControlNetLoader |
control_net_name |
CONTROL_NET |
| Apply ControlNet | ControlNetApplyAdvanced |
positive, negative, control_net, image, strength, start_percent, end_percent |
positive, negative |
| Upscale Latent By | LatentUpscaleBy |
samples, upscale_method, scale_by |
LATENT |
| Load Upscale Model | UpscaleModelLoader |
model_name |
UPSCALE_MODEL |
| Upscale Image (using Model) | ImageUpscaleWithModel |
upscale_model, image |
IMAGE |
| Upscale Image By | ImageScaleBy |
image, upscale_method, scale_by |
IMAGE |
| Pad Image for Outpainting | ImagePadForOutpaint |
image, left, top, right, bottom, feathering |
IMAGE, MASK |
| Conditioning (Combine) | ConditioningCombine |
two CONDITIONING | CONDITIONING |
| Conditioning (Set Area) | ConditioningSetArea |
conditioning, area and strength | CONDITIONING |
The class_type column is what you see in API-format JSON and what you search for in code.
Workflow 1: Text to image
File: workflows/txt2img_sdxl.api.json
Graph: Load Checkpoint → two CLIP Text Encode nodes (positive, negative) → Empty Latent Image (1024×1024) → KSampler → VAE Decode → Save Image.
Starting settings for SDXL base: 25 to 35 steps, CFG 5 to 8, dpmpp_2m + karras, denoise 1.0, sizes near one megapixel.
How to iterate efficiently:
- Fix the seed while you tune the prompt, so changes come from the prompt and not the noise.
- Set
batch_sizeto 4 for exploration, then lock a good seed and refine. - Change one setting at a time. Steps beyond ~35 rarely help SDXL; CFG above ~9 often burns colors.
Workflow 2: Image to image
File: workflows/img2img_sdxl.api.json
Swap Empty Latent Image for Load Image → VAE Encode, and set denoise below 1.0.
| Denoise | Result |
|---|---|
| 0.2 to 0.35 | Light touch-up, keeps composition and most details |
| 0.4 to 0.6 | Restyle (photo to painting) while keeping layout |
| 0.7 to 0.85 | Loose reinterpretation; only rough composition survives |
| 1.0 | Input is ignored (same as txt2img) |
Resize the input to the model’s native resolution range first (for example with Upscale Image / ImageScale). Encoding a 4000-pixel photo into SDXL wastes memory and produces repeated subjects.
Workflow 3: Inpainting and outpainting
File: workflows/inpaint_sdxl.api.json
Inpainting regenerates only a masked area.
- Load the image. In the
Load Imagenode, right-click and open the mask editor; paint the area to change. The painted area becomes the MASK output (transparent pixels in a PNG work too). - Use
VAE Encode (for Inpainting)with the image, VAE and mask.grow_mask_by(6 to 12 pixels) softens seams. - Keep denoise at 1.0 with this node; it clears the masked area before sampling.
- Prompt for what should appear in the masked area, not the whole scene.
For subtle edits (change a color, keep shape), an alternative is plain VAE Encode + Set Latent Noise Mask with denoise 0.4 to 0.7, which keeps the original content as a starting point. Dedicated inpainting checkpoints give cleaner edges than base models.
Outpainting extends the canvas: Pad Image for Outpainting adds pixels on chosen sides and returns a mask of the new area, which you feed into the inpainting graph above. Extend in steps of 128 to 256 pixels for coherent results.
Workflow 4: LoRA
File: workflows/txt2img_lora_sdxl.api.json
A LoRA is a small add-on that adjusts a base model toward a style, character or concept. Insert Load LoRA between the checkpoint and everything that uses MODEL and CLIP:
Load Checkpoint ─MODEL─► Load LoRA ─MODEL─► KSampler
─CLIP──► ─CLIP──► CLIP Text Encode (both)
- Typical strengths: 0.6 to 1.0. Start at 0.8. Above 1.0 often over-cooks.
- Many LoRAs need a trigger word in the prompt; check the model page.
- Chain several
Load LoRAnodes for multiple LoRAs and lower each strength. - Use
LoraLoaderModelOnlywhen a LoRA should not touch the text encoder, or for models whose LoRAs only target the diffusion model.
Workflow 5: ControlNet
File: workflows/controlnet_sdxl.api.json
ControlNet constrains composition with a control image: edges (canny), depth, pose, line art, scribbles and more.
- Produce the control image. Preprocessors (canny, depth estimators, pose detectors) come from custom node packs such as comfyui_controlnet_aux, or you can make an edge map in any image editor.
Load ControlNet Model(matching your base model family).Apply ControlNettakes the positive and negative conditioning plus the control image and returns new conditioning for the KSampler.
| Parameter | Effect | Start with |
|---|---|---|
strength |
How strictly to follow the control | 0.5 to 0.8 |
start_percent |
When control begins (0 = from the first step) | 0.0 |
end_percent |
When control stops; ending early frees details | 0.6 to 0.9 |
Several ControlNets can be chained (pose + depth); lower each strength when combining.
Workflow 6: Hires fix (two-pass)
File: workflows/hires_fix_sdxl.api.json
Generating directly at high resolution makes models duplicate subjects. Instead:
- Sample at native resolution (832×1216 here).
Upscale Latent By1.5×.- Second
KSamplerwith denoise 0.35 to 0.5 and fewer steps to add detail. - Decode and save.
Variant with better quality: decode after pass 1, upscale the image with an upscale model, re-encode with VAE Encode, then run pass 2. Pixel-space upscaling avoids the blur some latent upscale methods introduce.
Workflow 7: Upscaling with a model
File: workflows/upscale_model.api.json
Load Upscale Model + Upscale Image (using Model) runs an ESRGAN-family network (usually 4×). The example then scales by 0.5 to get a clean 2× result.
- Find upscalers and comparisons at OpenModelDB. Put files in
models/upscale_models/and replace themodel_namein the JSON with your file. - Pure model upscaling sharpens but does not invent detail. For “creative” upscaling, follow it with a low-denoise (0.2 to 0.35) diffusion pass, tiled if the image is large (tiled diffusion and tiled VAE nodes exist in core and in custom packs).
Workflow 8: Flux and other newer image models
Newer models (Flux, SD3.x, and later families) usually ship as separate files: diffusion model, one or more text encoders, and a VAE. The graph changes accordingly:
[Load Diffusion Model] ─MODEL───────────────────────────────► [KSampler or custom sampler nodes]
[DualCLIPLoader (clip_l + t5xxl, type "flux")] ─CLIP─► [CLIP Text Encode] ─► [FluxGuidance] ─► positive
[Load VAE (ae.safetensors)] ─VAE─► [VAE Decode]
Points that trip people up:
- FLUX.1 [dev] is guidance-distilled: set KSampler
cfgto 1.0 and control prompt adherence with theFluxGuidancenode (around 3.5 is a common start). Negative prompts have no effect at CFG 1. - FLUX.1 [schnell] is designed for very few steps (around 4).
- Files: diffusion model in
diffusion_models/, text encoders intext_encoders/, VAE invae/. Some publishers also provide single-file checkpoints that load withLoad Checkpoint. - Low VRAM: use FP8 or GGUF-quantized weights (GGUF via ComfyUI-GGUF).
- Check each model’s license on its model page; some allow only non-commercial use of the weights.
The fastest correct way to start with any new family: open Browse Templates, pick the model, and let ComfyUI show which files to download. The official examples page also has drag-and-drop workflows per model.
Workflow 9: Video generation
ComfyUI supports several open video model families natively, including Wan (2.1 and 2.2), LTX-Video and LTX-2, and HunyuanVideo, with official tutorials on docs.comfy.org. Typical graph:
model loaders (diffusion model, text encoder, VAE, sometimes CLIP vision)
─► text encode (+ start image for image-to-video)
─► empty video latent (width, height, frame count)
─► sampler
─► VAE decode (frames)
─► save as video / animated WEBP
Practical guidance:
- Start from the official template for your model; video graphs have model-specific nodes and settings.
- Frame count and resolution dominate cost. Test at low resolution and few frames, then scale up a known-good seed.
- Memory: smaller variants (for example the Wan 2.2 5B model) are designed to run on consumer GPUs with offloading; 14B-class models want 24 GB+ or quantized weights.
- Image-to-video gives far more control than text-to-video: generate or pick a strong first frame, then animate it.
- Frame interpolation and upscaling are usually separate post-processing steps (custom node packs provide them).
- Video helper nodes for loading and combining frames come from packs such as ComfyUI-VideoHelperSuite.
Settings cheat sheet
Native resolutions (stay close to the training size, then upscale):
| Family | Square | Portrait / landscape examples |
|---|---|---|
| SD 1.5 | 512×512 | 512×768, 768×512 |
| SDXL | 1024×1024 | 832×1216, 1216×832, 896×1152, 1152×896, 768×1344, 1344×768 |
| Flux-class | 1024×1024 | Flexible around 1 megapixel; dimensions divisible by 16 |
Sampler and scheduler starting points:
| Goal | sampler_name | scheduler | Steps |
|---|---|---|---|
| Reliable default (SD 1.5, SDXL) | dpmpp_2m |
karras |
25 to 30 |
| More variety per step | euler_ancestral |
normal |
25 to 35 |
| Flux / DiT models | euler |
simple or beta |
20 to 30 (dev), ~4 (schnell) |
| Distilled “turbo / lightning” checkpoints | as model card says | as model card says | 1 to 8, CFG near 1 to 2 |
Ancestral samplers (_ancestral, _sde) add fresh noise each step, so results do not converge as steps increase; use a non-ancestral sampler when you need reproducible “more steps = refined” behavior.
CFG:
- SD 1.5: 6 to 9.
- SDXL: 4 to 8.
- Flux dev: 1.0 with FluxGuidance ~2.5 to 4.
- Distilled models: whatever the model card says (often 1 to 2).
Seed behavior: the KSampler’s control after generate widget (fixed, increment, decrement, randomize) decides what happens to the seed after each run. Set it to fixed when comparing settings.
Prompting tips for diffusion models
- Describe, don’t instruct. “A red bicycle leaning on a brick wall, morning light, 35mm photo” beats “make me a picture of a bike”.
- Order matters a little for CLIP-based models: put the subject first.
- CLIP truncates long prompts in chunks of 77 tokens; ComfyUI concatenates chunks, but very long prompts dilute attention. T5-based models (Flux, SD3) handle long natural-language prompts much better.
- Weights:
(word:1.2)increases emphasis,(word:0.8)decreases. Stay between 0.7 and 1.4. - Negative prompts help SD 1.5 and SDXL (blurry, low quality, watermark, extra fingers); they are ignored at CFG 1.
- Embeddings: reference a textual inversion with
embedding:filenamein the prompt. - Iterate with a fixed seed, change one phrase at a time, and keep a notes node in the graph with what worked.
Running workflows from Python (API)
ComfyUI is also an HTTP server. Any workflow can be queued from code.
- In ComfyUI, export the workflow in API format (workflow menu > Export (API); on older UIs enable dev mode options in settings to see “Save (API Format)”). The API format is a flat object of nodes keyed by id, each with
class_typeandinputs. Links are["source_node_id", output_index]. - Run it with
scripts/comfy_client.py(standard library only):
# ComfyUI running at http://127.0.0.1:8188 (override with --server or COMFY_URL)
python3 scripts/comfy_client.py workflows/txt2img_sdxl.api.json \
--prompt "isometric diorama of a tiny ramen shop at night, neon" \
--seed 1234 --out outputs/
# Change any input: --set NODE_ID.INPUT=VALUE
python3 scripts/comfy_client.py workflows/txt2img_sdxl.api.json --set 5.steps=20 --set 4.width=832 --set 4.height=1216
# Upload a local file for a LoadImage node (node 4 in the img2img workflow)
python3 scripts/comfy_client.py workflows/img2img_sdxl.api.json --image 4=photo.jpg --set 6.denoise=0.45
What the client does:
| Step | Endpoint |
|---|---|
| Upload input images | POST /upload/image (multipart, field image) |
| Queue the graph | POST /prompt with {"prompt": graph, "client_id": id} → prompt_id |
| Wait for completion | GET /history/{prompt_id} (polling) |
| Download outputs | GET /view?filename=...&subfolder=...&type=output |
For progress updates in real time, ComfyUI also offers a WebSocket at /ws?clientId=...; the official repo’s script_examples/ folder shows how to use it.
Validate workflow files before queueing them (catches broken links, wrong output slots, cycles, and accidentally exported UI-format files):
python3 scripts/validate_workflow.py workflows/*.api.json
Batch idea: loop over a CSV of prompts and seeds and call run() for each; ComfyUI queues them and processes in order.
Security: never expose port 8188 to the internet. The API can run any installed node, including custom nodes that read and write files. Use a VPN, SSH tunnel or an authenticating reverse proxy.
Custom nodes: useful packs and safety
Install custom nodes with ComfyUI-Manager (repo), which is bundled with Desktop and can install missing nodes for a loaded workflow.
Widely used packs (check each repo’s README for current status and compatibility):
| Pack | What it adds |
|---|---|
| ComfyUI-Manager | Install, update and disable custom nodes and models |
| comfyui_controlnet_aux | ControlNet preprocessors (canny, depth, pose, line art) |
| ComfyUI-Impact-Pack | Detection and detailers (face and hand fixing), segmentation helpers |
| ComfyUI_IPAdapter_plus | Image prompting (style and subject transfer) with IP-Adapter models |
| ComfyUI-VideoHelperSuite | Load and combine video frames, export video |
| ComfyUI-GGUF | Load GGUF-quantized diffusion models and text encoders |
| rgthree-comfy | Quality-of-life nodes and UI helpers |
Custom nodes are arbitrary Python code running with your user’s permissions. Malicious packs have been found in the wild. Before installing:
- Prefer packs with an active, known maintainer and a public history.
- Read what the pack installs (
requirements.txt, install scripts). - Keep ComfyUI in a dedicated virtual environment or container, without access to your SSH keys, password stores or crypto wallets.
- Remove packs you no longer use.
Performance and VRAM
| Symptom | Try |
|---|---|
| Out of memory during sampling | Smaller resolution or batch, --lowvram, FP8 or GGUF weights |
| Out of memory during VAE decode | VAE Decode (Tiled) |
| Slow first run, fast later runs | Normal: models load once and stay cached |
| Slow every run on a big model | Model is being offloaded; reduce other loaded models or use quantized weights |
| Mac very slow | Expected on MPS for large models; prefer SD 1.5 or SDXL, fewer steps, or smaller video models |
Other tips:
- Keep only one big model loaded where possible; switching models costs load time.
- Use Preview Image instead of Save Image while experimenting to avoid filling the disk.
- Close the browser tab’s live previews if the GPU is shared with your display and memory is tight.
- Keep GPU drivers and PyTorch reasonably current; attention optimizations ship regularly.
Troubleshooting
| Error or symptom | Cause | Fix |
|---|---|---|
| Model missing from dropdown | Wrong folder or no refresh | Move it to the folder in the table, press R |
| Red nodes after loading a workflow | Missing custom nodes | Manager > Install Missing Custom Nodes, then restart |
Error while deserializing header |
Corrupt or incomplete download | Re-download, compare file size or hash |
| Shape or size mismatch errors | Mixing families (SD 1.5 LoRA on SDXL, wrong VAE or text encoder) | Use files made for the same base model |
| Black or NaN images | VAE precision issue with some models | Try a different VAE, or ComfyUI’s --fp32-vae style options (see --help) |
| Blurry results | Too few steps, wrong VAE, resolution far from native | Raise steps, use the model’s VAE, generate at native size then upscale |
| Duplicated people or limbs | Resolution too high for one pass | Use hires fix |
prompt_outputs_failed_validation from the API |
Input value not in allowed list (e.g. model filename) | Match filenames exactly as they appear in the loader dropdown |
| API returns 400 for a valid-looking file | UI-format JSON sent instead of API format | Export with Export (API); validate_workflow.py detects this |
Best picks: which model family for which job
Model families evolve quickly; these are durable rules of thumb. Check each model card for license and recommended settings.
| Job | Good starting family | Why |
|---|---|---|
| Learning ComfyUI on modest hardware | SD 1.5 | Runs on 4 GB VRAM, huge ecosystem of LoRAs and ControlNets |
| General image generation, mature tooling | SDXL and its fine-tunes | 1024-pixel native, many community checkpoints and LoRAs |
| Strong prompt following and text in images | Flux-class and newer DiT models | T5 or LLM text encoders understand long, natural prompts |
| Fast drafts and previews | Distilled “turbo / lightning / schnell” variants | 1 to 8 steps |
| Photo editing with masks | Dedicated inpainting checkpoints, or the inpaint workflow with a strong base | Clean seams |
| Consistent characters across images | LoRA training on your character, or image-prompt adapters | Identity carried by weights or reference images |
| Short video clips on consumer GPUs | Smaller video models (for example the Wan 2.2 5B variant) | Designed to fit with offloading |
| Highest-quality video | Larger video models (14B class) or quantized versions | More VRAM, much slower |
Workflow organization tips
Graphs get messy fast. Habits that keep them maintainable:
- Group by stage (loaders, conditioning, sampling, post-processing) with colored groups and titles.
- Title your key nodes (“Positive prompt”, “Final sampler”). The client script in this repo finds prompts by title.
- Use reroute nodes to avoid crossing wires across the canvas.
- Turn repeated subgraphs into reusable pieces (newer ComfyUI versions support subgraphs; otherwise save small template workflows).
- Add a Note node with the model files, settings and seed that produced your best results.
- Save workflows in Git as JSON (export both editor and API formats) and keep model filenames in a README.
- Pin versions: record your ComfyUI commit or release and custom node versions so you can reproduce results later.
- One output per purpose: Preview Image while iterating, Save Image only for keepers.
Training your own LoRA (overview)
Training happens outside ComfyUI in most setups; the result is a .safetensors file you drop into models/loras/.
| Tool | License | Notes |
|---|---|---|
| kohya-ss sd-scripts | Apache-2.0 | The widely used training scripts for SD 1.5, SDXL and newer families |
| kohya_ss GUI | Apache-2.0 | A graphical front end for those scripts |
| AI Toolkit | MIT | Config-driven trainer popular for Flux-class and newer models |
| OneTrainer | AGPL-3.0 | All-in-one trainer with a UI |
A first LoRA, step by step:
- Collect 15 to 40 images of the subject or style: varied angles, lighting and backgrounds; no watermarks; you have the rights to use them.
- Crop and resize near the base model’s native resolution (for SDXL around 1024 pixels on the long side; bucketing in the trainer handles aspect ratios).
- Caption every image: a unique trigger word plus a plain description of what is not the concept (background, clothing), so the LoRA learns only the concept.
- Train with conservative defaults from your trainer’s preset for the base model (rank around 16 to 32 and a modest learning rate are common starting points), saving checkpoints along the way.
- Test each checkpoint in ComfyUI with the LoRA workflow at strengths 0.6 to 1.0 and a fixed seed; pick the one that captures the concept without copying training images.
- Watch for overfitting: identical poses or backgrounds from the training set, or burned colors, mean too many steps or too high a learning rate.
Only train on images you are allowed to use, and never on real people without their consent.
Running ComfyUI in the cloud
When your GPU is too small or you need to scale:
| Option | What you get |
|---|---|
| Comfy Cloud | ComfyUI hosted by the Comfy team (docs) |
| GPU rental (for example RunPod) | A rented GPU machine where you run ComfyUI yourself, often from community templates |
| Serverless (for example Modal’s ComfyUI example) | Run workflows as API endpoints that scale to zero |
| Hosted model APIs (for example Replicate) | Call specific models without managing ComfyUI at all |
Tips: keep models on a persistent volume so they are not downloaded on every start; use the API format and scripts/comfy_client.py (pointed at the remote URL through a secure tunnel) for automation; shut down idle GPUs.
FAQ
What is ComfyUI used for? Building and running image, video and audio generation pipelines for diffusion models with a node graph, interactively or through an HTTP API.
Is ComfyUI free? The software is free and open source. Models have their own licenses (some restrict commercial use), and cloud GPU or hosted services cost money.
ComfyUI vs Automatic1111 / Forge: which should I use? Form-based UIs are quicker for simple text-to-image. ComfyUI is better when you need control, reproducible pipelines, newer model families soon after release, video models, or API automation.
How much VRAM do I need for ComfyUI? About 4 GB for SD 1.5, 8 GB or more for SDXL, and 12 to 24 GB or more for Flux-class and video models unless you use FP8 or GGUF quantized weights with offloading.
Does ComfyUI run on Mac? Yes, on Apple silicon through PyTorch’s MPS backend or the Desktop app. It is slower than a comparable NVIDIA GPU, especially for large and video models.
Why does my workflow show red nodes? It uses custom nodes you have not installed. Use the manager’s “Install Missing Custom Nodes”, restart, and reload the workflow. Review what you install.
How do I load a workflow from an image? Drag a PNG generated by ComfyUI onto the canvas. The workflow is stored in the image metadata. Images that were re-saved or stripped of metadata (many social sites do this) will not work.
What is the difference between the workflow JSON and the API JSON?
The editor format stores layout, links and widget values for the UI. The API format is a flat map of nodes and inputs for POST /prompt. Export the API format for automation.
How do I get the same image twice? Same model files, same graph, same seed, same sampler settings, and the same ComfyUI and PyTorch versions on similar hardware. Some GPU operations are not perfectly deterministic, so tiny differences can still occur.
How do I run ComfyUI on a remote GPU?
Run it on the server with --listen bound to a private interface, then reach it through an SSH tunnel or VPN. Never expose port 8188 publicly.
Where to go next
- Open Browse Templates in ComfyUI and run one official template per model family you care about.
- Work through the official tutorials for the video model you want to try.
- Automate a workflow with
scripts/comfy_client.pyand a CSV of prompts. - Read the ControlNet and LoRA papers to understand what the nodes do under the hood.
- Train a small LoRA for a style or character once you are comfortable with the base workflows.
Glossary
- Checkpoint: a full model file with diffusion model, text encoder and VAE.
- UNet / DiT: the denoising network architecture (convolutional UNet in SD 1.x/SDXL, diffusion transformer in Flux, SD3 and most video models).
- Latent: compressed image representation the model operates on.
- VAE: encoder/decoder between pixels and latents.
- Conditioning: encoded prompt (and other guidance) steering the sampler.
- CFG (classifier-free guidance): strength of prompt guidance relative to an unconditioned prediction.
- Denoise: portion of the noise schedule applied; below 1.0 keeps part of the input.
- LoRA: low-rank adapter that adds a style or concept to a base model.
- ControlNet: auxiliary network that conditions generation on a structural image.
- Inpainting / outpainting: regenerating a masked area / extending the canvas.
- API format: flat JSON workflow used by the HTTP API; different from the editor (UI) format.
Resources
- ComfyUI repository and official documentation
- ComfyUI examples: drag-and-drop example workflows per model family
- comfy-cli: command-line installer and manager
- Stable Diffusion XL base 1.0 model card
- FLUX.1 [dev] and FLUX.1 [schnell] model cards
- OpenModelDB: upscaling model database
- Papers: High-Resolution Image Synthesis with Latent Diffusion Models (Rombach et al.), Classifier-Free Diffusion Guidance (Ho and Salimans), LoRA (Hu et al.), Adding Conditional Control to Text-to-Image Diffusion Models (ControlNet, Zhang et al.), SDXL (Podell et al.)
Repository layout
comfyui-workflows/
├── workflows/ # API-format workflows (edit model filenames to match yours)
│ ├── txt2img_sdxl.api.json
│ ├── img2img_sdxl.api.json
│ ├── inpaint_sdxl.api.json
│ ├── txt2img_lora_sdxl.api.json
│ ├── controlnet_sdxl.api.json
│ ├── hires_fix_sdxl.api.json
│ └── upscale_model.api.json
├── scripts/
│ ├── comfy_client.py # queue, wait, download (stdlib only)
│ └── validate_workflow.py # static checks for API-format JSON
└── tests/
└── test_workflows.py # validates shipped graphs; client tested against a fake server
The workflows reference sd_xl_base_1.0.safetensors and placeholder names for LoRA, ControlNet and upscaler files. Replace them with files you have, either by editing the JSON or with --set, for example --set 1.ckpt_name="my_model.safetensors".
Run the tests (no GPU or ComfyUI needed):
python3 -m unittest discover -s tests
Contributing
PRs are welcome: new workflows (API format, validated with scripts/validate_workflow.py), corrections when ComfyUI renames nodes or folders, and troubleshooting entries. Please keep entries accurate, test workflows on a real ComfyUI install, link only to original sources, and do not add workflows that require questionable or pirated models.
License
Code, workflows and guide are released under the MIT License. Models you load are covered by their own licenses.
If this helped you, a star helps others find it.
More free resources
Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.