Skip to main content
ComfyUI can be run as a headless server for production environments where the web interface is not needed. This guide covers the command-line options and configurations for running ComfyUI in headless mode.

Basic Headless Setup

To run ComfyUI as a headless server:
By default, ComfyUI only listens on 127.0.0.1 (localhost). Use --listen 0.0.0.0 to accept external connections.

Essential Command-Line Options

Network Configuration

string
default:"127.0.0.1"
IP address to listen on. Use 0.0.0.0 for all IPv4 interfaces or 0.0.0.0,:: for both IPv4 and IPv6.
integer
default:"8188"
Set the listen port.
boolean
Suppress server output logs.

Security Options

string
Path to TLS key file for HTTPS support.
string
Path to TLS certificate file for HTTPS support.
string
Enable CORS with optional origin. Use * to allow all origins.
float
default:"100"
Maximum upload size in MB.

Directory Configuration

string
Set the ComfyUI base directory for all subdirectories (models, custom_nodes, input, output, temp, user).
string
Set the output directory. Overrides --base-directory.
string
Set the input directory. Overrides --base-directory.
string
Set the temp directory. Overrides --base-directory.
string
Set the user directory. Overrides --base-directory.
string
Load additional model path configuration files.

GPU and Performance Options

VRAM Management

float
Reserve VRAM in GB for OS/other software.

GPU Selection

integer
Set CUDA device ID. Other devices will be hidden.
integer
Set default device ID while keeping other devices visible.

Precision Options

Attention Mechanisms

Caching Options

Old style aggressive caching (default behavior).

Custom Nodes and Extensions

boolean
Disable loading all custom nodes.
string[]
Specify custom node folders to load even when --disable-all-custom-nodes is enabled.
boolean
Disable API nodes that communicate with external services.

Logging and Debugging

string
default:"INFO"
Set logging level: DEBUG, INFO, WARNING, ERROR, or CRITICAL.
boolean
Send process output to stdout instead of stderr.

Multi-User Mode

boolean
Enable per-user storage for multi-tenant environments.

Preview Options

enum
default:"none"
Default preview method: none, auto, latent2rgb, or taesd.
integer
default:"512"
Maximum preview size for sampler nodes.

Production Example

Here’s a complete example for a production headless server:
production_server.sh
Always configure proper firewall rules when running with --listen 0.0.0.0 to prevent unauthorized access.

Platform-Specific Options

AMD GPUs (ROCm)

Intel GPUs

DirectML (Windows)

Memory Optimizations

Dynamic VRAM

Async Offload

Smart Memory

Pinned Memory

Next Steps

Python Integration

Learn how to integrate ComfyUI into Python applications

Docker Deployment

Deploy ComfyUI using containers