Skip to main content

Overview

comfy-cli is a command line tool that streamlines installation and management of Comfy, and gives you scriptable, single-command access to the entire ComfyUI ecosystem locally or in the cloud. It serves three primary functions:
  1. Manage a local ComfyUI installation — install, launch, update, snapshot, and bisect ComfyUI and custom nodes.
  2. Access hosted partner nodes — generate images, video, audio, and 3D from providers including Seedance, Nano Banana (Gemini), Grok, Flux, Ideogram, DALL·E, Recraft, Stability, Kling, Luma, Runway, Pika, Vidu, Hailuo, Moonvalley, and others with single commands.
  3. Run full workflows on Comfy Cloud — submit workflow graphs, browse the curated template gallery, slot-edit workflows, and watch jobs to completion without a local GPU.
Two surfaces, one CLI. Every command auto-detects where to run. If you are signed in to Comfy Cloud, commands route to cloud; otherwise they run against your local server. Override per call with --where local|cloud, the COMFY_WHERE env var, or persist it with comfy set-default --where cloud.

Install CLI

To get shell completion hints:
New in recent versions: a single interactive wizard that handles routing, auth, and agent skills in one step.
It walks you through choosing a routing target (local or cloud), signing in through your browser (OAuth), picking a project directory, and optionally installing the agent skills. This is the recommended path. It opens the browser sign-in for you, with no keys to copy.
Non-interactive (CI only). Browser OAuth needs an interactive session. For CI, devcontainers, and scripted installs where no browser is available, pass an API key instead:

Install ComfyUI (Local)

Create a virtual environment with any Python version greater than 3.9.
Install ComfyUI
You still need to install CUDA, or ROCm depending on your GPU.

Run ComfyUI (Local)

Run in the background and stop it later:
Check which workspace is selected and what is installed:

Comfy Cloud

Run workflows and partner nodes on Comfy’s hosted GPUs. No local install required.
Once signed in, commands auto-route to cloud. Browser OAuth is the recommended path. No keys to manage, and the CLI handles token refresh for you. To point at a custom environment (for example a PR preview) before signing in:
API key is optional. You only need an API key for headless or CI use where a browser sign-in is not possible. It is a fallback, not the default:
Session lifetime. Cloud session tokens are short-lived (~1h). The CLI auto-refreshes them on demand. If a command reports cloud_unauthorized, run comfy cloud login again.

Generate with Partner Nodes

comfy generate is in beta. Flag names, model aliases, and output formats may change. The underlying partner endpoints are stable. File feedback on the comfy-cli GitHub repo.
The fastest way to call Comfy’s partner nodes from a terminal or script. It hits the same hosted endpoints as ComfyUI workflows, but as single CLI calls. Ideal for batch jobs, quick experiments, and automation where a full ComfyUI graph is unnecessary.

Prerequisites

First generation

The CLI uploads local files, submits the job, polls for completion, and saves results.
Discover a model’s real parameters first. Flag names differ per model (for example flux-ultra takes --width/--height; seedance takes --ratio/--resolution/--duration). Always check before scripting:

Common models

Nano Banana (Google Gemini): text-to-image and editing:
Flux 1.1 Pro Ultra: high-resolution text-to-image:
Seedance (ByteDance): text-to-video and image-to-video, up to 1080p / 12s:
Grok (xAI): images and video:

Discover models

Image editing with references

Pass local file paths. The CLI uploads via Comfy’s storage endpoint or base64-encodes as needed:
To upload once and reuse across calls:
Uploaded reference assets auto-delete after 24 hours. They are stored in Comfy-managed GCS with signed URLs. For long-running pipelines, re-upload before each job. See the reference for details.

Video generation (async jobs)

Video jobs are async. The CLI blocks and polls by default:
Return immediately with --async, then resume later:

JSON output for scripts

Emit raw API responses for pipeline integration:
See the reference for the full list of commands, flags, and model aliases.

Run Workflows (comfy run)

Beyond single partner calls, comfy run submits a complete ComfyUI workflow graph. It accepts both API-format and exported UI-format JSON (UI workflows are converted to API format client-side), and routes to local or cloud like every other command. It is async by default. It returns a prompt_id in milliseconds while a background watcher tracks progress. Pass --wait to block instead.
Prefer a single blocking call? Use --wait:
Track and manage jobs:
Validate before you submit. Catch unknown nodes, missing models, and bad wiring before burning cloud compute:

Start from a Template

The curated Comfy-Org/workflow_templates gallery is the fastest way to get a known-good workflow for a given task. You do not need to build from scratch.
The downloaded JSON is frontend-format. comfy run --where cloud auto-converts it to API format on submit.

Edit Workflows In Place

comfy workflow exposes the agent-tweakable slots in any frontend-format workflow and lets you override them. No manual JSON surgery.
Saved workflows on Comfy Cloud:
For complex multi-step pipelines, compose small reusable fragments into one graph:

Discover Nodes and Models

Introspect everything available on the resolved backend. Nodes:
Models:

Upload and Download Files

The idiomatic pipe:
comfy download reads the prompt_id and output URLs from piped stdin automatically. No manual key extraction, no jq.

Manage Custom Nodes

The tool uses cm-cli for custom node installation. See the ComfyUI Manager cm-cli docs for details.

Manage Models (Local)

Download models easily:

JSON Output for Scripts and Agents

Every command accepts --json and emits the same envelope shape, making the CLI fully scriptable and agent-friendly:
When error is present, read the hint and act on it:
The agent-facing surface is fully self-describing. Dump the entire command tree, output schemas, and error codes:

Agent Skills

Install the bundled Comfy agent skills into Claude Code, Cursor, and any AGENTS.md-aware tool, so your coding agent can drive the CLI directly:
These are bundled CLI skills installed by comfy skills install. They are separate from the Comfy Skills repository, which hosts the comfy-cloud Claude Code plugin for Comfy Cloud MCP.

Contributing

Contributions are welcome. Open issues or submit pull requests on the comfy-cli GitHub repository. Refer to the Dev Guide for further details.

Analytics

Usage tracking helps improve the CLI. Disable it with:
Re-enable tracking:
You can also hard opt-out via the DO_NOT_TRACK or COMFY_NO_TELEMETRY environment variables.