> ## 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.

# 参考

# CLI

## 生成（合作节点）— Beta

<Info>
  **`comfy generate` 目前处于 Beta 阶段。** 参数名称、模型别名及输出格式可能会有所变化。底层合作节点接口是稳定的，但 CLI 界面仍在演进中。欢迎在 [comfy-cli GitHub 仓库](https://github.com/Comfy-Org/comfy-cli/issues) 提交反馈。
</Info>

**用法**：

```console theme={null}
$ comfy generate [OPTIONS] <MODEL_OR_ACTION> [--<param> value]...
```

`<MODEL_OR_ACTION>` 可以是：

* 一个 **模型别名**（例如 `flux-pro`、`ideogram-edit`、`kling`、`dalle`）—— 直接调用对应的合作伙伴模型。
* 一个 **保留操作**：`list`、`schema`、`refresh`、`upload`、`resume`。

任何不在保留集合中的内容都将被视为模型别名，并将请求发送到相应的合作伙伴端点。

**认证**：

设置 `COMFY_API_KEY` 环境变量，或在每次调用时传递 `--api-key <KEY>`。在 [platform.comfy.org](https://platform.comfy.org) 获取密钥。

**运行级标志**（适用于任何模型）：

* `--download PATH`：将结果图像/视频保存到 `PATH`。
* `--async`：立即提交并返回一个作业 ID，不会等待完成。稍后使用 `comfy generate resume <model> <job_id>` 恢复。
* `--json`：以 JSON 格式输出原始 API 响应（用于脚本处理）。
* `--timeout SECONDS`：覆盖默认的 300 秒轮询超时。
* `--api-key KEY`：内联 API 密钥（覆盖 `COMFY_API_KEY`）。

**示例**：

```bash theme={null}
comfy generate flux-pro --prompt "a cat on the moon" --width 1024 --height 1024 --download cat.png
comfy generate ideogram-edit --image cat.png --mask m.png --prompt "add sunglasses" --rendering_speed TURBO
comfy generate kling --prompt "a paper boat drifting at dusk" --duration 5 --download boat.mp4
```

### `list`

列出可用的合作伙伴模型及其简短别名。

**用法**：

```console theme={null}
$ comfy generate list [OPTIONS]
```

**选项**：

* `--partner TEXT` / `-p TEXT`：按合作伙伴筛选（例如 `bfl`、`kling`、`ideogram`、`openai`）。
* `--category TEXT` / `--style TEXT` / `-c TEXT`：按类别筛选（例如 `text-to-image`、`image-edit`、`inpaint`、`upscale`、`text-to-video`、`image-to-video`）。
* `--query TEXT` / `-q TEXT`：对模型 id/摘要进行子串匹配。

### `schema`

显示指定模型的参数信息，包括必需/可选标志、类型、默认值以及示例调用。

**用法**：

```console theme={null}
$ comfy generate schema <MODEL>
```

**示例**：

```bash theme={null}
comfy generate schema flux-pro
comfy generate schema kling-i2v
```

### `refresh`

从云端 OpenAPI 规范刷新本地缓存的模型目录。当有新的合作伙伴模型添加时很有用。

**用法**：

```console theme={null}
$ comfy generate refresh
```

### `upload`

将本地文件（或重新托管一个远程 URL）上传到 Comfy 的存储，并输出签名 URL。大多数模型可以直接接受本地文件路径——此命令适用于需要显式获取 URL 的场景（例如在多次调用中重复使用同一资源）。

**用法**：

```console theme={null}
$ comfy generate upload <FILE_OR_URL> [--json]
```

**示例**：

```bash theme={null}
comfy generate upload ./photo.jpg
comfy generate upload ./photo.jpg --json
```

<Note>
  **引用资源会在 24 小时后自动删除。**上传的文件（无论是通过 `comfy generate upload`，还是在向模型传递本地文件路径时隐式上传）都会存储在 Comfy 管理的 GCS 存储桶（`api-nodes-prod`）中，并且只能通过签名 URL 访问。对象会根据存储桶的生命周期规则，在**上传 1 天后**自动删除。如果你需要让某个资源在长时间运行的异步作业中持久存在，请在每个作业前重新上传，或者自行托管并直接传递 URL。
</Note>

### `resume`

恢复之前提交的异步作业（通常是使用 `--async` 提交的视频作业）。会轮询直到结果就绪，并可选择下载。

**用法**：

```console theme={null}
$ comfy generate resume <MODEL> <JOB_ID> [--download PATH] [--json]
```

**示例**：

```bash theme={null}
comfy generate resume luma 7c3f9e2a --download out.mp4
```

### 模型别名（部分）

以下简短别名可作为 `<MODEL>` 使用。运行 `comfy generate list` 获取完整的最新目录。

**热门**：

| 别名                 | 合作伙伴                        | 类别                  |
| ------------------ | --------------------------- | ------------------- |
| `nano-banana`      | Google (Gemini Flash Image) | 文本生成图像 / 图像编辑       |
| `seedance`         | ByteDance                   | 文本生成视频 / 图像生成视频（异步） |
| `grok`、`grok-edit` | xAI                         | 文本生成图像 / 图像编辑       |
| `grok-video`       | xAI                         | 文本生成视频（异步）          |

**其他全部**：

| 别名                                                                                                                                             | 合作伙伴       | 类别                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | --------------------------------- |
| `flux-pro`、`flux-ultra`、`flux-2`                                                                                                               | BFL        | 文本生成图像（异步）                        |
| `flux-kontext`、`flux-kontext-max`                                                                                                              | BFL        | 图像编辑（异步）                          |
| `flux-fill`、`flux-expand`、`flux-canny`、`flux-depth`                                                                                            | BFL        | 修复 / 外扩 / ControlNet              |
| `ideogram`、`ideogram-edit`、`ideogram-remix`、`ideogram-reframe`、`ideogram-bg`                                                                   | Ideogram   | 文本生成图像 / 图像编辑                     |
| `dalle`、`dalle-edit`                                                                                                                           | OpenAI     | 文本生成图像 / 图像编辑                     |
| `stability-ultra`、`stability-sd3`、`stability-upscale`、`stability-upscale-creative`、`stability-upscale-fast`                                    | Stability  | 文本生成图像 / 放大                       |
| `recraft`、`recraft-vectorize`、`recraft-rmbg`、`recraft-replace-bg`、`recraft-i2i`、`recraft-inpaint`、`recraft-upscale`、`recraft-upscale-creative` | Recraft    | 文本生成图像 / 图像编辑                     |
| `reve`、`reve-edit`                                                                                                                             | Reve       | 文本生成图像 / 图像编辑                     |
| `runway`                                                                                                                                       | Runway     | 文本生成图像                            |
| `kling`、`kling-i2v`、`kling-extend`、`kling-lipsync`                                                                                             | Kling      | 文本生成视频 / 图像生成视频 / 视频扩展 / 唇形同步（异步） |
| `luma`、`luma-i2v`                                                                                                                              | Luma       | 文本生成视频 / 图像生成视频（异步）               |
| `hailuo`                                                                                                                                       | MiniMax    | 文本生成视频（异步）                        |
| `runway-i2v`                                                                                                                                   | Runway     | 图像生成视频（异步）                        |
| `moonvalley-t2v`、`moonvalley-i2v`                                                                                                              | Moonvalley | 文本生成视频 / 图像生成视频（异步）               |
| `pika`、`pika-i2v`                                                                                                                              | Pika       | 文本生成视频 / 图像生成视频（异步）               |
| `vidu`、`vidu-i2v`、`vidu-extend`                                                                                                                | Vidu       | 文本生成视频 / 图像生成视频 / 视频扩展（异步）        |

## 节点

**用法**:

```console theme={null}
$ comfy node [OPTIONS] COMMAND [ARGS]...
```

**选项**:

* `--install-completion`: 为当前 shell 安装自动补全功能。
* `--show-completion`: 显示当前 shell 的自动补全功能，可用于复制或自定义安装。
* `--help`: 显示此消息并退出。

**命令**:

* `deps-in-workflow`
* `disable`
* `enable`
* `fix`
* `install`
* `install-deps`
* `reinstall`
* `restore-dependencies`
* `restore-snapshot`
* `save-snapshot`: 保存当前 ComfyUI 环境的快照...
* `show`
* `simple-show`
* `uninstall`
* `update`

### `deps-in-workflow`

**用法**:

```console theme={null}
$ deps-in-workflow [OPTIONS]
```

**选项**:

* `--workflow TEXT`: 工作流文件 (.json/.png)  \[必需]
* `--output TEXT`: 输出文件 (.json/.png)  \[必需]
* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `disable`

**用法**:

```console theme={null}
$ disable [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: 禁用自定义节点  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `enable`

**用法**:

```console theme={null}
$ enable [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: 启用自定义节点  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `fix`

**用法**:

```console theme={null}
$ fix [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: 修复指定自定义节点的依赖项  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `install`

**用法**:

```console theme={null}
$ install [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: 安装自定义节点  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `install-deps`

**用法**:

```console theme={null}
$ install-deps [OPTIONS]
```

**选项**:

* `--deps TEXT`: 依赖项规范文件 (.json)
* `--workflow TEXT`: 工作流文件 (.json/.png)
* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `reinstall`

**用法**:

```console theme={null}
$ reinstall [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: 重新安装自定义节点  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `restore-dependencies`

**用法**:

```console theme={null}
$ restore-dependencies [OPTIONS]
```

**选项**:

* `--help`: 显示此消息并退出。

### `restore-snapshot`

**用法**:

```console theme={null}
$ restore-snapshot [OPTIONS] PATH
```

**参数**:

* `PATH`: \[必需]

**选项**:

* `--help`: 显示此消息并退出。

### `save-snapshot`

保存当前 ComfyUI 环境的快照。

**用法**:

```console theme={null}
$ save-snapshot [OPTIONS]
```

**选项**:

* `--output TEXT`: 指定输出文件路径 (.json/.yaml)。
* `--help`: 显示此消息并退出。

### `show`

**用法**:

```console theme={null}
$ show [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: \[installed|enabled|not-installed|disabled|all|snapshot|snapshot-list]  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `simple-show`

**用法**:

```console theme={null}
$ simple-show [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: \[installed|enabled|not-installed|disabled|all|snapshot|snapshot-list]  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `uninstall`

**用法**:

```console theme={null}
$ uninstall [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: 卸载自定义节点  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

### `update`

**用法**:

```console theme={null}
$ update [OPTIONS] ARGS...
```

**参数**:

* `ARGS...`: 更新自定义节点  \[必需]

**选项**:

* `--channel TEXT`: 指定操作模式
* `--mode TEXT`: \[remote|local|cache]
* `--help`: 显示此消息并退出。

## 模型

**用法**:

```console theme={null}
$ comfy model [OPTIONS] COMMAND [ARGS]...
```

**选项**:

* `--install-completion`: 为当前 shell 安装自动补全功能。
* `--show-completion`: 显示当前 shell 的自动补全功能，可用于复制或自定义安装。
* `--help`: 显示此消息并退出。

**命令**:

* `download`: 下载模型到指定的相对路径...
* `list`: 显示当前所有已下载模型的列表...
* `remove`: 删除一个或多个已下载的模型，...

### `download`

如果模型尚未下载，则将其下载到指定的相对路径。

**用法**:

```console theme={null}
$ download [OPTIONS]
```

**选项**:

* `--url TEXT`: 模型下载的 URL  \[必需]
* `--relative-path TEXT`: 从当前工作区到安装模型的相对路径。  \[默认值: models/checkpoints]
* `--help`: 显示此消息并退出。

### `list`

以表格格式显示当前已下载的所有模型列表。

**用法**:

```console theme={null}
$ list [OPTIONS]
```

**选项**:

* `--relative-path TEXT`: 从当前工作区到存储模型的相对路径。  \[默认值: models/checkpoints]
* `--help`: 显示此消息并退出。

### `remove`

通过直接指定或交互式选择，删除一个或多个已下载的模型。

**用法**:

```console theme={null}
$ remove [OPTIONS]
```

**选项**:

* `--relative-path TEXT`: 从当前工作区到存储模型的相对路径。  \[默认值: models/checkpoints]
* `--model-names TEXT`: 要删除的模型文件名列表，用空格分隔。
* `--help`: 显示此消息并退出。
