comfy-cli is the official command-line tool for ComfyUI. One pip install gives you a comfy command that can install ComfyUI with the right PyTorch for your GPU, launch it, add custom nodes and models, and run whole workflows from a script.
It can also send jobs to Comfy Cloud or call hosted partner models when you have no local GPU.
This guide walks through installing it, setting up a workspace, installing ComfyUI, launching it in the foreground or background, and managing nodes, models and snapshots.
It also covers running workflows from the terminal, the JSON output for scripts and AI agents, cloud routing, and the common errors. It follows the official ComfyUI documentation as of December 2026.
- Install:
pip install comfy-cli(or Homebrew), inside a Python 3.10+ virtual environment. - Install ComfyUI:
comfy install(add--nvidiafor an unattended NVIDIA install). - Run:
comfy launch, orcomfy launch --backgroundandcomfy stop. - Nodes and models:
comfy node install NAME,comfy model download --url URL --relative-path models/loras. - Workflows:
comfy run --workflow flow.json --wait | comfy download. - Scripts: add
--jsonto any command;comfy validatebefore you run.
What comfy-cli Does
comfy-cli has three jobs:
- Manage a local ComfyUI: install, launch, update, snapshot and bisect ComfyUI and its custom nodes.
- Call hosted partner nodes: generate images, video, audio and 3D from providers such as Flux, Kling, Luma, Runway, Seedance and Nano Banana with single commands.
- Run workflows on Comfy Cloud: submit workflow graphs and collect results without a local GPU.
Every command picks where to run automatically. If you are signed in to Comfy Cloud it routes to the cloud; otherwise it talks to your local server. You can override this per command with --where local or --where cloud, with the COMFY_WHERE variable, or permanently with comfy set-default --where local.
New to ComfyUI itself? Start with our ComfyUI beginner guide.
Install comfy-cli
You need git and Python 3.10 or newer. Use a virtual environment so ComfyUI’s packages do not clash with other Python projects.
- Create and activate a virtual environment:
# venv (Linux / macOS) python3 -m venv comfy-env source comfy-env/bin/activate # venv (Windows PowerShell) python -m venv comfy-env .\comfy-env\Scripts\Activate.ps1 # or conda conda create -n comfy-env python=3.11 conda activate comfy-env - Install comfy-cli:
pip install comfy-cliOn macOS you can use Homebrew instead:
brew tap Comfy-Org/comfy-cli brew install comfy-org/comfy-cli/comfy-cli - Optional: turn on tab completion:
comfy --install-completion
Run the Setup Wizard
Recent versions include a one-step wizard:
comfy setup
It asks whether you want to work locally or in the cloud, signs you in through your browser if you pick cloud, chooses a project directory for workflows, inputs and outputs, and offers to install agent skills. Useful flags:
| Flag | Purpose |
|---|---|
--where local|cloud |
Skip the routing question |
--project-dir |
Folder for workflows, inputs and outputs |
--api-key |
Comfy Cloud key for headless or CI setups |
-y, --non-interactive |
No prompts |
--skip-skills |
Do not install agent skills |
For a purely local setup you can skip the wizard and go straight to comfy install.
Install ComfyUI
comfy install
It clones ComfyUI into a workspace and asks which GPU you have, then installs the matching PyTorch build into the active Python environment:
| Platform | What it installs | What you still need |
|---|---|---|
| NVIDIA | PyTorch with the CUDA runtime | A current GPU driver (not the full CUDA Toolkit) |
| AMD on Linux | ROCm PyTorch | A ROCm-capable driver stack |
| AMD on Windows | torch-directml |
DirectML is no longer supported by ComfyUI; install the ROCm build instead (RDNA 2 or newer) |
| Apple silicon | PyTorch nightly with Metal (MPS) | macOS on Apple silicon |
| Intel Arc | PyTorch XPU | A compatible Intel Arc GPU |
| CPU | CPU PyTorch | Nothing; slow but works |
For a scripted install, pass the GPU flag, for example comfy install --nvidia. If you manage PyTorch yourself, add --skip-torch-or-directml. RTX 50-series owners should also read our ComfyUI RTX 50 setup guide, and Mac users our ComfyUI on Mac guide.
Check which workspace is active and what is installed:
comfy which
comfy env
Launch and Stop ComfyUI
comfy launch
This starts ComfyUI in your terminal. Open the address it prints (usually http://127.0.0.1:8188) in a browser. Press Ctrl+C to stop.
To keep your terminal free, run it in the background:
comfy launch --background
comfy stop
ComfyUI’s own launch options, such as the listen address or VRAM modes, are listed in our ComfyUI command line arguments guide. Check comfy launch --help for how your comfy-cli version passes them through.
Manage Custom Nodes
comfy-cli uses ComfyUI-Manager’s cm-cli under the hood, so names match what you see in the Manager.
comfy node install NODE_NAME # install a node pack by its registry name
comfy node show installed # list installed packs
comfy node update all # update every pack
comfy node disable NAME # turn one off without deleting
comfy node uninstall NAME
Other handy subcommands:
comfy node save-snapshotandcomfy node restore-snapshot PATHsave and restore your exact node setup before risky updates.comfy node deps-in-workflowandcomfy node install-depsfind and install what a shared workflow needs.comfy node fixandcomfy node reinstallrepair broken packs.
For a list of packs worth installing, see must-have ComfyUI custom nodes. Writing your own? Follow our ComfyUI custom node tutorial; its comfy node scaffold and comfy node publish commands come from this same tool.
Download and Manage Models
comfy model download --url https://huggingface.co/.../model.safetensors \
--relative-path models/checkpoints
comfy model list --relative-path models/loras
comfy model remove
--relative-path is relative to your ComfyUI workspace and defaults to models/checkpoints. Use models/loras, models/vae, models/diffusion_models and so on; our ComfyUI model folders cheat sheet shows where each type goes.
To browse models known to the running server, use the discovery commands:
comfy models list-folders
comfy models search --text "wan2.2" --type lora
comfy models show wan2.2_vae.safetensors
Run Workflows From the Terminal
comfy run submits a full workflow. It accepts both API-format JSON and normal exported UI workflows, which it converts for you.
- Export a workflow from ComfyUI (Workflow menu, Export). See how to save and export ComfyUI workflows.
- Validate it to catch missing nodes, models or bad links before you spend GPU time:
comfy validate --workflow my_workflow.json - Run it and collect the outputs in one line:
comfy run --workflow my_workflow.json --wait | comfy downloadResults land in
./outputs/.
Without --wait, comfy run returns a prompt_id immediately and tracks the job in the background. Manage jobs with:
comfy jobs ls
comfy jobs status PROMPT_ID
comfy jobs wait ID1 ID2
comfy jobs cancel PROMPT_ID
Need to process a folder of images? Combine this with our ComfyUI batch process guide, or drive ComfyUI from Python with the ComfyUI API.
Templates and Workflow Slots
Start from the official template gallery instead of building from scratch:
comfy templates ls --type image --tag "Text to Image"
comfy templates show NAME
comfy templates fetch NAME --out my.json
Then change prompts and settings without editing JSON by hand:
comfy workflow slots my.json
comfy workflow set-slot my.json 6.text="a fox in the snow"
comfy workflow vary my.json --slot positive.text='["a cat","a dog","a fox"]' --out-dir ./variants
vary writes one workflow per value, which is handy for prompt tests.
Comfy Cloud and Partner Models
No GPU? Sign in and the same commands run on Comfy’s hosted GPUs:
comfy cloud login # browser sign-in
comfy cloud whoami
comfy cloud logout
For CI or a headless server, use an API key instead of the browser: comfy setup --where cloud --api-key comfyui-... --non-interactive, or set COMFY_API_KEY.
Partner models are one command each (beta; needs credits):
comfy generate list
comfy generate schema flux-ultra
comfy generate flux-pro --prompt "a cat on the moon" --width 1024 --height 1024 --download cat.png
Always run comfy generate schema MODEL first, because each model takes different flags. Compare costs with a local card in our ComfyUI cloud GPU pricing vs local post.
JSON Output and Agent Skills
Every command accepts --json and returns the same envelope:
{ "ok": true, "command": "...", "version": "...", "where": "local", "data": {}, "error": null }
When something fails, the error object includes a hint:
comfy --json run --workflow my.json | jq '.error.hint'
Run comfy --json discover to dump the whole command tree for an AI agent. To let Claude Code, Cursor or other AGENTS.md tools drive ComfyUI, install the bundled skills:
comfy skills install
comfy skills list
comfy skills status
Our Comfy agent guide shows what agents can do with it.
Command Cheat Sheet
| Task | Command |
|---|---|
| Install ComfyUI | comfy install |
| Start / stop | comfy launch / comfy launch --background / comfy stop |
| Show workspace | comfy which, comfy env |
| Install a node pack | comfy node install NAME |
| Snapshot nodes | comfy node save-snapshot |
| Download a model | comfy model download --url URL --relative-path models/loras |
| Run a workflow | comfy run --workflow f.json --wait | comfy download |
| Check a workflow | comfy validate --workflow f.json |
| Search nodes | comfy nodes search "checkpoint" |
| Turn off telemetry | comfy tracking disable |
You can also opt out of usage tracking with the DO_NOT_TRACK or COMFY_NO_TELEMETRY environment variables.
Troubleshooting
comfy install fails while cloning
Install git and make sure it is on your PATH. comfy-cli needs it to clone ComfyUI and custom nodes.
Packages install into the wrong Python
comfy install uses the active environment. Activate your venv or conda env first, then check with comfy env.
ComfyUI runs on the CPU instead of the GPU
The wrong PyTorch build was installed. Reinstall with the right flag, such as comfy install --nvidia, and update your GPU driver.
AMD on Windows does not work
ComfyUI dropped DirectML. Install the ROCm PyTorch build, which needs an RDNA 2 or newer card.
comfy setup hangs on a server
Browser sign-in cannot finish without a browser. Use --api-key with --non-interactive.
cloud_unauthorized
Cloud sessions last about an hour and refresh automatically; if that fails, run comfy cloud login again.
For ComfyUI errors after launch, see our ComfyUI errors and fixes.
FAQ
What is comfy-cli?
The official command-line tool for installing, running and managing ComfyUI, custom nodes, models and workflows, locally or on Comfy Cloud.
Is comfy-cli free?
Yes. Local use is free. Comfy Cloud and partner models use paid credits.
Does comfy-cli replace ComfyUI-Manager?
No. It uses ComfyUI-Manager’s cm-cli for node installs. Keep the Manager for the in-browser UI.
Can I use comfy-cli with an existing ComfyUI install?
Yes. Run it from your ComfyUI folder or set it as the workspace; check with comfy which.
How do I run ComfyUI in the background?
comfy launch --background, then comfy stop when you are done.
Which Python version does it need?
Python 3.10 or newer, ideally in a virtual environment.



