Skip to main content

Command-line interface for an already running ComfyUI server

Project description

comfyui-cli

comfyui-cli 是一个面向 ComfyUI 的命令行工具,用来通过终端完成工作流执行、模型查询、队列管理、节点信息查看以及基础生成任务。

它面向已运行中的 ComfyUI 服务,适合通过 HTTP/API 在终端里执行工作流、查询模型与节点信息,并进行基础生成任务。

功能概览

  • 执行与校验 ComfyUI 工作流
  • 查看模型、节点、队列、历史记录与系统状态
  • 支持 txt2imgimg2img、LoRA 与风格化生成辅助命令
  • 支持 --json 机器可读输出
  • 提供可安装的命令入口:comfyui-cli

安装

从 PyPI 安装

pip install comfyui-cli

安装完成后,可通过以下命令检查是否可用:

comfyui-cli --version

从源码安装(可选)

如果你已经拿到源码,可以在源码目录执行:

python -m pip install -e .

如果你需要开发、测试或重新打包发布,可以安装开发依赖:

python -m pip install -r requirements-dev.txt

前置条件

需要先启动一个正在运行的 ComfyUI 服务器(默认:http://127.0.0.1:8188)。

python main.py --listen 127.0.0.1 --port 8188

快速开始

# 检查服务连通性
comfyui-cli system ping

# 列出 checkpoints
comfyui-cli models list checkpoints

# 执行工作流
comfyui-cli workflow run my_workflow.json --save-to ./output

# 输出 JSON
comfyui-cli --json system stats

常用场景

校验工作流

comfyui-cli workflow validate my_workflow.json

查看模型类型

comfyui-cli models types

查看节点列表

comfyui-cli nodes list

执行 txt2img

comfyui-cli generate txt2img --prompt "a cat" --checkpoint "model.safetensors"

常用命令

comfyui-cli workflow validate <file>
comfyui-cli workflow info <file>
comfyui-cli queue status
comfyui-cli models types
comfyui-cli nodes list
comfyui-cli history list
comfyui-cli generate txt2img --prompt "a cat" --checkpoint "model.safetensors"

项目结构

.
├── README.md
├── COMFYUI.md
├── LICENSE
├── setup.py
└── comfyui/
    ├── comfyui_cli.py
    ├── core/
    ├── utils/
    └── tests/

测试

运行核心单元测试:

pytest comfyui/tests/test_core.py -v

如果需要连接真实 ComfyUI 服务执行 E2E 测试:

export COMFYUI_TEST_SERVER=127.0.0.1:8188
export COMFYUI_TEST_CHECKPOINT=your_model.safetensors
pytest comfyui/tests/test_full_e2e.py -v

相关文档

  • COMFYUI.md:ComfyUI API 与命令映射说明

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comfyui_cli-0.1.1.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

comfyui_cli-0.1.1-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file comfyui_cli-0.1.1.tar.gz.

File metadata

  • Download URL: comfyui_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 35.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for comfyui_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a8ac0058021eed118efa3a27e1c956b918e5ad473c588ac3bf49f344b7841631
MD5 f9d3a4e2d53e5781f93ff84314f5476f
BLAKE2b-256 5cafe612118dc38cf68d53f3d336dd738056f05472e3eb79eefa1ef064f4efa1

See more details on using hashes here.

File details

Details for the file comfyui_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: comfyui_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for comfyui_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ee0c623006fb6eab3d1c67025d53bdd621df0a9cc9a94451712c94fdc4f929c
MD5 78e9d404a611467b3a8532fa046381a9
BLAKE2b-256 030effd1cd41c930019388281b03e38a65c36c9c015acfc3265d1b5f0268abf0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page