> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Startup Flags

> ComfyUI startup flags reference: every main.py command-line argument from comfy/cli_args.py, plus how to add flags to Windows Portable .bat launchers.

ComfyUI accepts command-line arguments when started with `python main.py`. This page documents every flag defined in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/master/comfy/cli_args.py).

<Note>
  **Windows Portable** users can add flags to the `.bat` launch files (for example, `run_nvidia_gpu.bat`). See the [Windows Portable guide](/installation/comfyui_portable_windows) for details.
</Note>

Run `python main.py --help` in your ComfyUI directory for the built-in help text. Combine multiple flags as needed:

```bash theme={null}
python main.py --listen 0.0.0.0 --port 8288 --disable-auto-launch --lowvram
```

## Network & Server

| Flag | Default | Description |
| - | - | - |
| `--listen` `[IP]` | `127.0.0.1` | IP address to listen on. Comma-separated list supported (e.g. `127.2.2.2,127.3.3.3`). If provided without a value, defaults to `0.0.0.0,::` (all IPv4 and IPv6 interfaces). |
| `--port` | `8188` | Port to listen on. |
| `--tls-keyfile` `PATH` | — | Path to TLS (SSL) key file. Enables HTTPS. Requires `--tls-certfile`. |
| `--tls-certfile` `PATH` | — | Path to TLS (SSL) certificate file. Enables HTTPS. Requires `--tls-keyfile`. |
| `--enable-cors-header` `[ORIGIN]` | disabled | Enable CORS. Optional origin, or `*` for all origins when no value is given. |
| `--max-upload-size` | `100` | Maximum upload size in MB. |
| `--enable-compress-response-body` | disabled | Enable compressing the HTTP response body. |

<CodeGroup>
  ```bash theme={null}
  # Listen on all interfaces (LAN access)
  python main.py --listen

  # Listen on a specific IP
  python main.py --listen 0.0.0.0

  # Custom port with HTTPS
  python main.py --port 8443 --tls-keyfile key.pem --tls-certfile cert.pem
  ```
</CodeGroup>

## Directories

| Flag | Default | Description |
| - | - | - |
| `--base-directory` `PATH` | ComfyUI root | Base directory for models, custom\_nodes, input, output, temp, and user directories. |
| `--models-directory` `PATH` | ComfyUI root/models | Models directory. Overrides the models folder in `--base-directory`. |
| `--extra-model-paths-config` `PATH` | — | Load one or more `extra_model_paths.yaml` files. Can be specified multiple times. |
| `--output-directory` `PATH` | — | Output directory. Overrides `--base-directory`. |
| `--temp-directory` `PATH` | — | Temp directory. Overrides `--base-directory`. |
| `--input-directory` `PATH` | — | Input directory. Overrides `--base-directory`. |
| `--user-directory` `PATH` | — | User directory (absolute path). Overrides `--base-directory`. Path must exist and be readable. |

## Launch & Browser

| Flag | Default | Description |
| - | - | - |
| `--auto-launch` | disabled | Automatically open ComfyUI in the default browser on startup. |
| `--disable-auto-launch` | disabled | Disable auto-launching the browser. |
| `--windows-standalone-build` | disabled | Windows portable build convenience mode. Enables auto-launch on startup (equivalent to `--auto-launch`). |

<Note>
  `--windows-standalone-build` sets `auto_launch` to `true`. `--disable-auto-launch` overrides it. To run as a server without opening a browser, use `--disable-auto-launch`.
</Note>

```bash theme={null}
# Run server without opening browser
python main.py --disable-auto-launch
```

## Devices & CUDA

| Flag | Default | Description |
| - | - | - |
| `--cuda-device` `DEVICE_ID` | — | CUDA device IDs to use, comma-separated (e.g. `0` or `0,1`), or `all` to keep all currently visible devices. Other devices are hidden. |
| `--default-device` `ID` | — | Default device ID. All other devices remain visible. |
| `--cuda-malloc` | auto (torch 2.0+) | Enable cudaMallocAsync. Mutually exclusive with `--disable-cuda-malloc`. |
| `--disable-cuda-malloc` | — | Disable cudaMallocAsync. Mutually exclusive with `--cuda-malloc`. |
| `--directml` `[DEVICE]` | — | Use torch-directml. Optional device index; defaults to `-1` when no value is given. |
| `--oneapi-device-selector` `STRING` | — | oneAPI device selector string for Intel devices. |

<Note>
  On Windows, ComfyUI uses GPU 0 only by default. To restore all GPUs, pass `--cuda-device all`.
</Note>

## Precision & Inference

<Note>
  Flags in the **Global**, **UNET**, **VAE**, and **Text Encoder** groups below are mutually exclusive within each group. Only one flag per group can be used at a time.
</Note>

### Global floating point

| Flag | Description |
| - | - |
| `--force-fp32` | Force fp32 globally. Report if this improves GPU performance. |
| `--force-fp16` | Force fp16 globally. Also sets `--fp16-unet`. |

### UNET precision

| Flag | Description |
| - | - |
| `--fp32-unet` | Run the diffusion model in fp32. |
| `--fp64-unet` | Run the diffusion model in fp64. |
| `--bf16-unet` | Run the diffusion model in bf16. |
| `--fp16-unet` | Run the diffusion model in fp16. |
| `--fp8_e4m3fn-unet` | Store UNet weights in fp8 (e4m3fn). |
| `--fp8_e5m2-unet` | Store UNet weights in fp8 (e5m2). |
| `--fp8_e8m0fnu-unet` | Store UNet weights in fp8 (e8m0fnu). |

Each FP8 flag suffix names an 8-bit float layout from the industry FP8 spec (ONNX / OCP):

* **e4m3fn**: 4 exponent bits, 3 mantissa bits. Good balance of precision and range for model weights on NVIDIA Ada Lovelace and newer GPUs.
* **e5m2**: 5 exponent bits, 2 mantissa bits. Wider dynamic range but lower precision than e4m3fn. Useful when weight magnitudes vary widely.
* **e8m0fnu**: 8 exponent bits, 0 mantissa bits. Maximum dynamic range with no fractional precision. Typically used as a block scaling factor (powers of two only).

### VAE precision

| Flag | Description |
| - | - |
| `--fp16-vae` | Run the VAE in fp16. May cause black images. |
| `--fp32-vae` | Run the VAE in full precision fp32. |
| `--bf16-vae` | Run the VAE in bf16. |
| `--cpu-vae` | Run the VAE on the CPU (not mutually exclusive with VAE precision flags). |

### Text encoder precision

| Flag | Description |
| - | - |
| `--fp8_e4m3fn-text-enc` | Store text encoder weights in fp8 (e4m3fn). |
| `--fp8_e5m2-text-enc` | Store text encoder weights in fp8 (e5m2). |
| `--fp16-text-enc` | Store text encoder weights in fp16. |
| `--fp32-text-enc` | Store text encoder weights in fp32. |
| `--bf16-text-enc` | Store text encoder weights in bf16. |

See the [UNET precision](#unet-precision) section for the explanation of each FP8 format suffix.

### Other inference options

| Flag | Default | Description |
| - | - | - |
| `--fp16-intermediates` | disabled | Experimental: use fp16 for intermediate tensors between nodes instead of fp32. |
| `--force-channels-last` | disabled | Force channels-last memory format during inference. |
| `--supports-fp8-compute` | disabled | Act as if the device supports fp8 compute. |
| `--enable-triton-backend` | disabled | Enable Triton backend in comfy-kitchen. Disabled by default at launch. |
| `--disable-triton-backend` | disabled | Force-disable the comfy-kitchen Triton backend, overriding `--enable-triton-backend`. |

## Preview

| Flag | Default | Description |
| - | - | - |
| `--preview-method` | `none` | Preview method for sampler nodes. Choices: `none`, `auto`, `latent2rgb`, `taesd`. |
| `--preview-size` | `512` | Maximum preview image size in pixels. |

## Cache

<Note>
  Cache mode flags are mutually exclusive. Only one of `--cache-ram`, `--cache-classic`, `--high-ram`, `--cache-lru`, or `--cache-none` should be used.
</Note>

| Flag | Default | Description |
| - | - | - |
| `--cache-ram` `[GB] [GB]` | enabled (default mode) | RAM pressure caching. First value: active-cache threshold in GB. Optional second value: inactive-cache/pin threshold in GB. When no values given: active = 10% of system RAM (min 2 GB, max 10 GB); inactive = 100% of system RAM (max 128 GB). Accepts at most two values. |
| `--cache-classic` | — | Use the old aggressive caching style. |
| `--high-ram` | disabled | Can improve performance slightly on systems with plenty of RAM or where pagefile use is preferred over reloading models. Also enables classic caching. |
| `--cache-lru` `N` | `0` (disabled) | LRU caching with a maximum of N node results cached. No hard upper limit; bounded by available RAM/VRAM. May use more RAM/VRAM. |
| `--cache-none` | — | Reduced RAM/VRAM usage; re-executes every node on each run. |

<Note>
  ComfyUI reuses cached node results between runs in the same session, which is what makes repeat runs faster. Use `--cache-none` when you would rather every run start from a clean cache, for example while debugging a workflow or ruling out cached reuse between runs. Every node re-executes, so generations take longer. It is a startup flag, so restart ComfyUI for it to take effect.
</Note>

## Attention

<Note>
  Cross-attention method flags are mutually exclusive. Split and quad attention are ignored when xformers is used.
</Note>

| Flag | Description |
| - | - |
| `--use-split-cross-attention` | Use split cross attention optimization. |
| `--use-quad-cross-attention` | Use sub-quadratic cross attention optimization. |
| `--use-pytorch-cross-attention` | Use PyTorch 2.0 cross attention. |
| `--use-sage-attention` | Use Sage attention. |
| `--use-flash-attention` | Use FlashAttention. |
| `--use-ck-attention` | Use Comfy Kitchen attention. Requires hardware support for its INT8 kernels. |
| `--disable-xformers` | Disable xformers. |
| `--force-upcast-attention` | Force attention upcasting. Report if this fixes black images. Mutually exclusive with `--dont-upcast-attention`. |
| `--dont-upcast-attention` | Disable all attention upcasting. For debugging only. |

## VRAM & Memory

Async weight offloading is on by default on Nvidia and AMD GPUs, and dynamic VRAM is enabled automatically where it is supported. The flags below override those defaults.

<Note>
  VRAM mode flags (`--gpu-only`, `--highvram`, `--lowvram`, `--novram`, `--cpu`) are mutually exclusive.
</Note>

| Flag | Default | Description |
| - | - | - |
| `--gpu-only` | — | Store and run everything on the GPU (text encoders, CLIP, etc.). |
| `--highvram` | — | Keep models in GPU memory instead of unloading to CPU after use. |
| `--lowvram` | — | No effect when dynamic VRAM is enabled. Otherwise, runs text encoders on CPU. |
| `--novram` | — | Minimal VRAM usage when `--lowvram` is not enough. |
| `--cpu` | — | Use CPU for everything (slow). |
| `--reserve-vram` `GB` | OS-dependent | VRAM in GB to reserve for the OS and other software. |
| `--vram-headroom` `GB` | `0` | Extra VRAM in GB for dynamic VRAM to keep free above the default headroom. ComfyUI tries to keep this much VRAM completely free and unused, even counting VRAM used by other apps. |
| `--disable-nvml-pressure` | disabled | Use CUDA instead of NVML to report dynamic VRAM memory pressure. |
| `--async-offload` `[NUM_STREAMS]` | enabled on Nvidia and AMD | Async weight offloading. Optional stream count (default: 2). |
| `--disable-async-offload` | — | Disable async weight offloading. |
| `--disable-dynamic-vram` | — | Disable dynamic VRAM; use estimate-based model loading. |
| `--enable-dynamic-vram` | auto on Nvidia, ROCm 7.14+ | Enable dynamic VRAM on systems where it is not enabled by default. |
| `--fast-disk` | disabled | Prefer disk-backed dynamic loading over unpinned RAM. Useful with fast NVMe. |
| `--disable-fast-disk` | disabled | Disable disk-backed dynamic loading and offload, so unpinned RAM is used instead. Overrides `--fast-disk`. |
| `--disable-cuda-graphs` | disabled | Disable CUDA graphs. |
| `--disable-comfy-compiler` | disabled | Disable the Comfy model compiler, including its CUDA graph subfeature. |
| `--assert-graph-breaks` | disabled | Fail on Comfy model compiler graph breaks. |
| `--force-non-blocking` | disabled | Force non-blocking tensor operations. May help on non-Nvidia systems; can break some workflows. |
| `--disable-smart-memory` | disabled | Aggressively offload to RAM instead of keeping models in VRAM. |
| `--disable-pinned-memory` | disabled | Disable pinned memory use. |
| `--mmap-torch-files` | disabled | Use mmap when loading ckpt/pt files. |
| `--disable-mmap` | disabled | Do not use mmap when loading safetensors. |

## Performance & Debugging

| Flag | Default | Description |
| - | - | - |
| `--fast` `[OPT...]` | disabled | Enable experimental optimizations that may affect quality or stability. `--fast` alone enables all. Specific options: `fp16_accumulation`, `fp8_matrix_mult`, `cublas_ops`, `autotune`. |
| `--deterministic` | disabled | Use slower deterministic PyTorch algorithms where possible. Does not guarantee identical images in all cases. |
| `--default-hashing-function` | `sha256` | Hash function for duplicate filename/content comparison. Choices: `md5`, `sha1`, `sha256`, `sha512`. |
| `--debug-hang` | disabled | Enable stack trace dumps on Ctrl-C for debugging hangs. |

```bash theme={null}
# Enable all fast optimizations (experimental)
python main.py --fast

# Enable specific optimizations only
python main.py --fast fp16_accumulation cublas_ops
```

## ComfyUI Manager

See [ComfyUI-Manager Installation](/manager/install) for setup instructions.

| Flag | Description |
| - | - |
| `--enable-manager` | Enable ComfyUI-Manager. |
| `--disable-manager-ui` | Disable Manager UI and endpoints only. Background tasks (scheduled installs, etc.) continue. Requires `--enable-manager`. |
| `--enable-manager-legacy-ui` | Use the legacy Manager UI. Implies `--enable-manager`. Mutually exclusive with `--disable-manager-ui`. |

## Custom Nodes & API Nodes

| Flag | Default | Description |
| - | - | - |
| `--disable-all-custom-nodes` | disabled | Disable loading all custom nodes. |
| `--whitelist-custom-nodes` `FOLDER...` | — | Custom node folders to load even when `--disable-all-custom-nodes` is set. |
| `--disable-partner-nodes` | disabled | Disable loading Partner Nodes (the paid API nodes). The frontend keeps its internet access. |
| `--offline` | disabled | Prevent the frontend from communicating with the internet by adding a restrictive Content-Security-Policy. Also disables Partner Nodes. |
| `--disable-api-nodes` | disabled | Deprecated alias for `--offline`. Use `--offline`, or `--disable-partner-nodes` to only disable Partner Nodes. |
| `--disable-metadata` | disabled | Disable saving prompt metadata in output files. |

<Note>
  `--offline` also changes what the browser is allowed to load. The flag adds a Content-Security-Policy that keeps the page on resources served by ComfyUI itself, so images, fonts, media, frames, and network requests from other origins are blocked, and Partner Nodes (API nodes) are not registered at all. If a preview or a thumbnail that normally loads goes missing after a restart, check the launch arguments for this flag before troubleshooting the node. `--disable-partner-nodes` only stops Partner Nodes from loading and leaves the rest of the frontend's internet access intact.
</Note>

```bash theme={null}
# Troubleshoot custom node issues
python main.py --disable-all-custom-nodes

# Allow only specific custom nodes
python main.py --disable-all-custom-nodes --whitelist-custom-nodes ComfyUI-Manager
```

## Frontend & API

| Flag | Default | Description |
| - | - | - |
| `--front-end-version` | `comfyanonymous/ComfyUI@latest` | Frontend version in `[owner]/[repo]@[version]` format. Requires internet to download from GitHub releases. Version can be `latest` or a semver (e.g. `1.0.0`). |
| `--front-end-root` `PATH` | — | Local filesystem path to the frontend directory. Overrides `--front-end-version`. |
| `--comfy-api-base` | `https://api.comfy.org` | Base URL for the ComfyUI API. |
| `--database-url` | `sqlite:///<ComfyUI>/user/comfyui.db` | Database URL. Use `sqlite:///:memory:` for in-memory. |
| `--enable-assets` | disabled | Enable the assets system (API routes, database sync, background scanning). |
| `--enable-asset-hashing` | disabled | Compute blake3 content hashes when scanning assets. Enables future asset portability features such as deduplication and cross-machine model resolution, at the cost of startup time and per-output hashing on large model directories. Off by default. |
| `--feature-flag` `KEY[=VALUE]` | — | Set a server feature flag. Bare `KEY` sets true. Can be repeated. Booleans and numbers are auto-converted. |
| `--list-feature-flags` | — | Print known CLI-settable feature flags as JSON and exit. |

```bash theme={null}
# List available feature flags
python main.py --list-feature-flags

# Set feature flags
python main.py --feature-flag show_signin_button=true
```

## Logging & Misc

| Flag | Default | Description |
| - | - | - |
| `--verbose` `[LEVEL] [FILE]` | `INFO` | Logging level. Choices: `DEBUG`, `DETAIL`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`. `--verbose` alone sets `DEBUG`. Add a level followed by a file path to write that level to a file as well; the flag can be repeated to configure the console and file outputs together. |
| `--log-stdout` | disabled | Send normal process output to stdout instead of stderr. |
| `--dont-print-server` | disabled | Do not print server output to the console. |
| `--multi-user` | disabled | Enable per-user storage. |
| `--quick-test-for-ci` | disabled | Quick startup test for CI. Exits immediately after initialization. |

***

<Note>
  This reference is based on ComfyUI [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/master/comfy/cli_args.py). When upgrading ComfyUI, run `python main.py --help` or compare your local [`cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/master/comfy/cli_args.py) against this page to check for new or changed flags.
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.