Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Comfy-Org/ComfyUI/llms.txt

Use this file to discover all available pages before exploring further.

ComfyUI supports numerous command line arguments to customize server behavior, hardware configuration, memory management, and performance optimizations.

Running ComfyUI with Arguments

Pass arguments when launching ComfyUI:
python main.py --listen 0.0.0.0 --port 8188 --preview-method auto

Server Configuration

--listen
string
default:"127.0.0.1"
Specify the IP address to listen on. Use 0.0.0.0 to listen on all IPv4 addresses, or provide a comma-separated list.
# Listen on localhost only (default)
python main.py --listen 127.0.0.1

# Listen on all interfaces (IPv4 and IPv6)
python main.py --listen

# Listen on specific IPs
python main.py --listen 127.0.0.1,192.168.1.100
Using --listen without an argument defaults to 0.0.0.0,:: (all IPv4 and IPv6 addresses).
--port
integer
default:"8188"
Set the listen port for the web server.
python main.py --port 3000
--tls-keyfile
string
Path to TLS (SSL) key file. Enables HTTPS access. Requires --tls-certfile.
python main.py --tls-keyfile key.pem --tls-certfile cert.pem
--tls-certfile
string
Path to TLS (SSL) certificate file. Enables HTTPS access. Requires --tls-keyfile.
--enable-cors-header
string
default:"*"
Enable CORS (Cross-Origin Resource Sharing) with optional origin.
# Allow all origins
python main.py --enable-cors-header

# Allow specific origin
python main.py --enable-cors-header "https://example.com"
--max-upload-size
float
default:"100"
Set the maximum upload size in MB.
python main.py --max-upload-size 500
--auto-launch
boolean
Automatically launch ComfyUI in the default browser on startup.
python main.py --auto-launch
--disable-auto-launch
boolean
Disable auto-launching the browser (overrides --auto-launch).
--dont-print-server
boolean
Suppress server output messages.
--enable-compress-response-body
boolean
Enable response body compression to reduce bandwidth usage.

Directory Configuration

--base-directory
string
Set the ComfyUI base directory for models, custom_nodes, input, output, temp, and user directories.
python main.py --base-directory /path/to/comfyui
--output-directory
string
Set the output directory for generated images. Overrides --base-directory.
python main.py --output-directory /path/to/outputs
--input-directory
string
Set the input directory for source images. Overrides --base-directory.
python main.py --input-directory /path/to/inputs
--temp-directory
string
Set the temporary files directory. Overrides --base-directory.
python main.py --temp-directory /tmp/comfyui
--user-directory
string
Set the user directory with an absolute path. Overrides --base-directory.
python main.py --user-directory /path/to/user
--extra-model-paths-config
string
Load one or more extra_model_paths.yaml files. Can be specified multiple times.
python main.py --extra-model-paths-config /path/to/config1.yaml --extra-model-paths-config /path/to/config2.yaml

GPU and Device Configuration

--cuda-device
integer
Set the CUDA device ID to use. Makes all other devices invisible.
python main.py --cuda-device 0
--default-device
integer
Set the default device ID while keeping other devices visible.
python main.py --default-device 0
--directml
integer
default:"-1"
Use torch-directml for AMD/Intel GPUs on Windows.
# Use default DirectML device
python main.py --directml

# Use specific DirectML device
python main.py --directml 0
--oneapi-device-selector
string
Sets the oneAPI device selector for Intel GPUs.
python main.py --oneapi-device-selector "level_zero:0"
--disable-ipex-optimize
boolean
Disables ipex.optimize when loading models with Intel’s Extension for PyTorch.
--supports-fp8-compute
boolean
Force ComfyUI to act as if the device supports FP8 compute.

VRAM Management

--gpu-only
boolean
Store and run everything (text encoders, CLIP, VAE, etc.) on the GPU. Requires high VRAM.
python main.py --gpu-only
--highvram
boolean
Keep models in GPU memory after use instead of unloading to CPU. Requires ~12GB+ VRAM.
python main.py --highvram
--normalvram
boolean
Force normal VRAM usage mode (used if lowvram is automatically enabled).
python main.py --normalvram
--lowvram
boolean
Split the UNet model to use less VRAM. For GPUs with 4-8GB VRAM.
python main.py --lowvram
--novram
boolean
Extreme memory saving mode. Use when lowvram isn’t enough.
python main.py --novram
--cpu
boolean
Run everything on the CPU. Very slow but works without a GPU.
python main.py --cpu
--reserve-vram
float
Reserve amount of VRAM (in GB) for OS/other software.
python main.py --reserve-vram 2.0
--disable-smart-memory
boolean
Force aggressive offloading to RAM instead of keeping models in VRAM when possible.
--disable-dynamic-vram
boolean
Disable dynamic VRAM management and use estimate-based model loading.
--async-offload
integer
default:"2"
Use async weight offloading with specified number of streams. Enabled by default on NVIDIA.
# Use default 2 streams
python main.py --async-offload

# Use 4 streams
python main.py --async-offload 4
--disable-async-offload
boolean
Disable async weight offloading.

Precision and Data Types

Global Precision

--force-fp32
boolean
Force FP32 precision globally. Use if your GPU has issues with FP16.
python main.py --force-fp32
--force-fp16
boolean
Force FP16 precision globally.
python main.py --force-fp16

UNet/Diffusion Model Precision

--fp32-unet
boolean
Run the diffusion model in FP32 precision.
--fp16-unet
boolean
Run the diffusion model in FP16 precision.
--bf16-unet
boolean
Run the diffusion model in BF16 precision.
--fp64-unet
boolean
Run the diffusion model in FP64 precision (very slow, for debugging).
--fp8_e4m3fn-unet
boolean
Store UNet weights in FP8 E4M3FN format.
--fp8_e5m2-unet
boolean
Store UNet weights in FP8 E5M2 format.
--fp8_e8m0fnu-unet
boolean
Store UNet weights in FP8 E8M0FNU format.

VAE Precision

--fp16-vae
boolean
Run the VAE in FP16. May cause black images on some GPUs.
python main.py --fp16-vae
--fp32-vae
boolean
Run the VAE in full precision FP32. Use if you get black images.
python main.py --fp32-vae
--bf16-vae
boolean
Run the VAE in BF16 precision.
--cpu-vae
boolean
Run the VAE on the CPU instead of GPU. Slower but uses less VRAM.
python main.py --cpu-vae

Text Encoder Precision

--fp8_e4m3fn-text-enc
boolean
Store text encoder weights in FP8 (E4M3FN variant).
--fp8_e5m2-text-enc
boolean
Store text encoder weights in FP8 (E5M2 variant).
--fp16-text-enc
boolean
Store text encoder weights in FP16.
--fp32-text-enc
boolean
Store text encoder weights in FP32.
--bf16-text-enc
boolean
Store text encoder weights in BF16.

CUDA Configuration

--cuda-malloc
boolean
Enable cudaMallocAsync (enabled by default for PyTorch 2.0+).
--disable-cuda-malloc
boolean
Disable cudaMallocAsync. Use if you get CUDA errors.
python main.py --disable-cuda-malloc
--force-channels-last
boolean
Force channels-last memory format when inferencing models.
--force-non-blocking
boolean
Force non-blocking operations for all tensors. May improve performance on non-NVIDIA systems.
--disable-pinned-memory
boolean
Disable pinned memory usage.

Attention Mechanisms

--use-split-cross-attention
boolean
Use split cross attention optimization. Ignored when xformers is used.
--use-quad-cross-attention
boolean
Use sub-quadratic cross attention optimization. Ignored when xformers is used.
--use-pytorch-cross-attention
boolean
Use PyTorch 2.0+ native cross attention function.
python main.py --use-pytorch-cross-attention
--use-sage-attention
boolean
Use Sage Attention implementation.
--use-flash-attention
boolean
Use FlashAttention for faster attention computation.
--disable-xformers
boolean
Disable xformers optimization.
--force-upcast-attention
boolean
Force enable attention upcasting. Use if you get black images.
--dont-upcast-attention
boolean
Disable all attention upcasting. For debugging only.

Caching Strategies

--cache-classic
boolean
Use the old-style aggressive caching (default behavior).
python main.py --cache-classic
--cache-lru
integer
default:"0"
Use LRU caching with maximum N node results cached. May use more RAM/VRAM.
python main.py --cache-lru 10
--cache-none
boolean
Disable caching to reduce RAM/VRAM usage. Executes every node for each run.
python main.py --cache-none
--cache-ram
float
default:"4.0"
Use RAM pressure caching with specified headroom threshold (in GB). Removes large items when RAM is low.
# Use default 4GB threshold
python main.py --cache-ram

# Use 8GB threshold
python main.py --cache-ram 8.0

Preview Configuration

--preview-method
enum
default:"none"
Default preview method for sampler nodes. Options: none, auto, latent2rgb, taesd.
python main.py --preview-method auto
--preview-size
integer
default:"512"
Set the maximum preview size for sampler nodes.
python main.py --preview-size 768

File Loading Optimizations

--mmap-torch-files
boolean
Use memory mapping when loading .ckpt/.pt files.
python main.py --mmap-torch-files
--disable-mmap
boolean
Don’t use memory mapping when loading safetensors files.
--default-hashing-function
enum
default:"sha256"
Hash function for duplicate filename/contents comparison. Options: md5, sha1, sha256, sha512.
python main.py --default-hashing-function sha512

Performance Optimizations

--fast
string[]
Enable experimental optimizations that may reduce quality. Use without arguments to enable all, or specify individual features.Available optimizations:
  • fp16_accumulation - Use FP16 accumulation
  • fp8_matrix_mult - Use FP8 matrix multiplication
  • cublas_ops - Use cuBLAS operations
  • autotune - Enable autotuning
# Enable all optimizations
python main.py --fast

# Enable specific optimizations
python main.py --fast fp16_accumulation fp8_matrix_mult
These are experimental features that may crash ComfyUI or reduce image quality.
--deterministic
boolean
Make PyTorch use slower deterministic algorithms when possible.
python main.py --deterministic
This may not make images fully deterministic in all cases.

Custom Nodes

--disable-all-custom-nodes
boolean
Disable loading all custom nodes.
python main.py --disable-all-custom-nodes
--whitelist-custom-nodes
string[]
Specify custom node folders to load even when --disable-all-custom-nodes is enabled.
python main.py --disable-all-custom-nodes --whitelist-custom-nodes "ComfyUI-Manager" "custom-node-2"
--disable-api-nodes
boolean
Disable loading all API nodes. Also prevents the frontend from communicating with the internet.
python main.py --disable-api-nodes

ComfyUI Manager

--enable-manager
boolean
Enable the ComfyUI-Manager feature.
python main.py --enable-manager
--disable-manager-ui
boolean
Disable only the ComfyUI-Manager UI and endpoints. Background tasks still operate. Requires --enable-manager.
python main.py --enable-manager --disable-manager-ui
--enable-manager-legacy-ui
boolean
Enable the legacy UI of ComfyUI-Manager. Requires --enable-manager.
python main.py --enable-manager --enable-manager-legacy-ui

Frontend Configuration

--front-end-version
string
default:"comfyanonymous/ComfyUI@latest"
Specify the frontend version to use. Format: [owner]/[repo]@[version]
# Use latest frontend
python main.py --front-end-version Comfy-Org/ComfyUI_frontend@latest

# Use specific version
python main.py --front-end-version Comfy-Org/ComfyUI_frontend@1.2.0

# Use legacy frontend
python main.py --front-end-version Comfy-Org/ComfyUI_legacy_frontend@latest
--front-end-root
string
Local filesystem path to frontend directory. Overrides --front-end-version.
python main.py --front-end-root /path/to/custom/frontend

Multi-User and Database

--multi-user
boolean
Enable per-user storage.
python main.py --multi-user
--database-url
string
default:"sqlite:///user/comfyui.db"
Specify the database URL.
# Use in-memory database
python main.py --database-url "sqlite:///:memory:"

# Use PostgreSQL
python main.py --database-url "postgresql://user:pass@localhost/comfyui"
--disable-assets-autoscan
boolean
Disable asset scanning on startup for database synchronization.
--comfy-api-base
string
default:"https://api.comfy.org"
Set the base URL for the ComfyUI API.
python main.py --comfy-api-base "https://custom-api.example.com"

Metadata and Output

--disable-metadata
boolean
Disable saving prompt metadata in output files.
python main.py --disable-metadata

Logging

--verbose
enum
default:"INFO"
Set the logging level. Options: DEBUG, INFO, WARNING, ERROR, CRITICAL.
python main.py --verbose DEBUG
--log-stdout
boolean
Send process output to stdout instead of stderr.

Development and Testing

--quick-test-for-ci
boolean
Quick test mode for continuous integration.
--windows-standalone-build
boolean
Enable features for Windows standalone build (auto-launch, etc.).

Example Configurations

Low VRAM Setup (4GB GPU)

python main.py --lowvram --fp16-vae --preview-method auto

High Performance (24GB+ GPU)

python main.py --highvram --gpu-only --preview-method taesd --fast

CPU Only

python main.py --cpu --preview-method auto

Remote Server

python main.py --listen 0.0.0.0 --port 8188 --preview-method auto

Development Mode

python main.py --verbose DEBUG --auto-launch --preview-method taesd

Shared Models with A1111

python main.py --extra-model-paths-config ./extra_model_paths.yaml --preview-method auto

Intel Arc GPU

python main.py --use-pytorch-cross-attention --preview-method auto

AMD ROCm

python main.py --use-pytorch-cross-attention --preview-method auto