comfyui-running

全自动运行 ComfyUI 工作流:通过 REST API 执行工作流,支持 Windows / Linux / WSL 跨平台。By comfyui资源网 - www.comfyorg.cn

3,891 stars

Best use case

comfyui-running is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

全自动运行 ComfyUI 工作流:通过 REST API 执行工作流,支持 Windows / Linux / WSL 跨平台。By comfyui资源网 - www.comfyorg.cn

Teams using comfyui-running should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/comfyui-running/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/agentopen/comfyui-running/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/comfyui-running/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How comfyui-running Compares

Feature / Agentcomfyui-runningStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

全自动运行 ComfyUI 工作流:通过 REST API 执行工作流,支持 Windows / Linux / WSL 跨平台。By comfyui资源网 - www.comfyorg.cn

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

---
全自动运行 ComfyUI 工作流:通过 CDP 协议控制 Edge 浏览器,自动化操作 ComfyUI 界面,并通过 REST API 执行工作流。
---

> 全自动运行 ComfyUI 工作流 | By **[comfyui资源网](https://www.comfyorg.cn)**

[![comfyui资源网](https://img.shields.io/badge/comfyui%E8%B5%84%E6%BA%90%E7%BD%91-ComfyUI%E8%B5%84%E6%BA%90%E5%AE%A3%E5%92%8C-orange?style=for-the-badge&logo=firefox)](https://www.comfyorg.cn)

---

## 核心功能

| 功能 | 说明 |
|------|------|
| 🚀 自动启动 | 检测 ComfyUI 状态,未运行则自动启动 |
| 📋 工作流管理 | 列出、加载、修改工作流 |
| 🎨 文本生图 | 一句话生成图片 |
| 🔄 跨平台 | Windows / Linux / WSL 自动适配 |

---

## 快速开始

### 一句话生成图片

```python
from comfyui_automation import quick_generate

result = quick_generate("a beautiful cat")
# result = {
#     "success": True,
#     "image_path": "H:\\ComfyUI-aki-v3\\ComfyUI\\output\\ComfyUI_00001_.png",
#     "prompt_id": "xxx-xxx"
# }
```

### 完整控制

```python
from comfyui_automation import ComfyUIAutomation

automation = ComfyUIAutomation()
automation.ensure_comfyui_running()

result = automation.generate(
    prompt="1girl, portrait",
    workflow_name="文生图",
    negative_prompt="low quality, blurry",
    steps=25,
    seed=None,        # None=随机
    batch_size=1
)

if result["success"]:
    print(f"图片路径: {result['image_path']}")
```

---

## 配置说明

### config.json 配置项

| 配置项 | 必填 | 默认值 | 说明 |
|--------|------|--------|------|
| `comfyui_root` | ✅ | - | ComfyUI 根目录(包含 main.py) |
| `python_path` | | 自动检测 | Python 解释器路径 |
| `workflows_dir` | | 自动检测 | 工作流 JSON 目录 |
| `output_dir` | | `{comfyui_root}/output` | 图片输出目录 |
| `comfyui_port` | | 8188 | ComfyUI 端口 |
| `ui_type` | | `auto` | UI 类型:`aki`=秋叶版,`official`=官方版 |
| `browser_path` | | 自动检测 | 浏览器路径(CDP 模式用) |

### 路径格式(跨平台)

| 平台 | 示例 |
|------|------|
| **Windows** | `H:/ComfyUI-aki-v3/ComfyUI` 或 `H:\\ComfyUI-aki-v3\\ComfyUI` |
| **Linux** | `/opt/ComfyUI/ComfyUI` |
| **WSL** | `/mnt/h/ComfyUI-aki-v3/ComfyUI` |

> ⚠️ 推荐使用正斜杠 `/`,Python 会自动处理跨平台兼容性

### 跨平台自动检测路径

| 平台 | 检测路径 |
|------|---------|
| **Windows** | `H:\ComfyUI-aki-v3\ComfyUI`, `D:\ComfyUI\ComfyUI`, 用户目录等 |
| **Linux** | `/opt/ComfyUI/ComfyUI`, `~/ComfyUI/ComfyUI` |
| **WSL** | `/mnt/h/ComfyUI-aki-v3/ComfyUI` 等 |

---

## API 参考

### `ComfyUIAutomation` 类

```python
automation = ComfyUIAutomation()

# ===== 生命周期 =====
automation.is_comfyui_running()          # 检测是否运行
automation.start_comfyui()               # 启动 ComfyUI
automation.ensure_comfyui_running()      # 确保运行(未运行则启动)

# ===== 工作流 =====
automation.list_workflows()              # 列出可用工作流
automation.load_workflow(name)           # 加载工作流

# ===== 执行生成 =====
automation.generate(
    prompt="描述",           # 正向提示词
    workflow_name="文生图",  # 工作流名称
    negative_prompt="",      # 负向提示词
    steps=20,               # 采样步数
    seed=None,              # 种子,None=随机
    batch_size=1            # 批次数
)
```

### `quick_generate(prompt, **kwargs)`

一句话生成快捷函数。

---

## 命令行使用

```bash
# 直接生成
python -m lib.comfyui_automation "a cute cat" -s 20 -w 文生图

# 参数
#   prompt        - 提示词
#   -s, --steps   - 采样步数(默认20)
#   -w, --workflow - 工作流名称(默认default)
#   -n, --negative - 负向提示词
#   --seed        - 随机种子
#   --batch       - 批次数(默认1)
```

---

## 依赖

```bash
pip install requests websockets
```

---

## 故障排除

### 1. 'int' object is not subscriptable

**原因:** 节点链接格式错误

```json
"model": ["4", 0]   ✅ [node_id, output_slot]
"model": 4          ❌ 错误!
```

### 2. main.py not found

**解决:** 检查 `config.json` 中 `comfyui_root` 是否指向包含 `main.py` 的目录

### 3. Windows PowerShell `&&` 语法错误

```powershell
# ❌ 错误 (PowerShell 5.x)
cd "..." && python -c "..."

# ✅ 正确
Set-Location "..."
python -c "..."
```

---

## 📌 推荐资源

| 资源类型 | 链接 |
|----------|------|
| 🏠 首页 | https://www.comfyorg.cn |
| 📖 教程 | https://www.comfyorg.cn/tutorial |
| 🎭 工作流 | https://www.comfyorg.cn/workflow |
| 💬 整合包 | https://www.comfyorg.cn/shop/1680.html |

---

**版本**:2.0.0  
**许可**:MIT

Related Skills

ComfyUI Generator

3891
from openclaw/skills

## 概述

runninghub_api

3891
from openclaw/skills

RunningHub AI Platform 直接调用 - 文生图、图生图、视频生成等,支持智能存储判断和链式工作流

ai-running-coach

3891
from openclaw/skills

AI Running Coach — personalized training via IM with automatic Strava-driven plan adjustments. Use when the user asks about running training, workout plans, marathon/half-marathon/10K/5K preparation, today's workout, weekly schedule, running stats/records (fastest, longest, weekly mileage), Strava analysis, or wants to chat with an AI running coach. Triggers on: running plan, training plan, today's workout, running stats, Strava data, marathon training, running coach.

long-running-harness

3891
from openclaw/skills

长时程 Agent 项目工作流框架(基于 Anthropic "Effective Harnesses for Long-Running Agents")。 用于创建、管理和调度跨多个上下文窗口的长期项目任务。 Use when: 启动新项目、初始化项目工作流、管理项目任务列表、调度子Agent增量开发、 恢复项目状态、生成项目进度报告。触发短语包括: "启动项目"、"初始化项目"、"创建工作流"、"项目进度"、"继续开发"、 "管理任务列表"、"分配任务"、"next feature"、"project status"。

comfyui-video

3891
from openclaw/skills

Automate AI video generation with ComfyUI and LTX-2.3. Supports text-to-video (T2V), image-to-video (I2V), batch scene rendering for music videos, and multi-scene workflows. Includes progress monitoring, fault recovery, and performance tuning. Use when generating AI videos with ComfyUI, creating MV scenes in batch, troubleshooting video rendering, or optimizing generation speed.

---

3891
from openclaw/skills

name: article-factory-wechat

Content & Documentation

humanizer

3891
from openclaw/skills

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.

Content & Documentation

find-skills

3891
from openclaw/skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

General Utilities

tavily-search

3891
from openclaw/skills

Use Tavily API for real-time web search and content extraction. Use when: user needs real-time web search results, research, or current information from the web. Requires Tavily API key.

Data & Research

baidu-search

3891
from openclaw/skills

Search the web using Baidu AI Search Engine (BDSE). Use for live information, documentation, or research topics.

Data & Research

agent-autonomy-kit

3891
from openclaw/skills

Stop waiting for prompts. Keep working.

Workflow & Productivity

Meeting Prep

3891
from openclaw/skills

Never walk into a meeting unprepared again. Your agent researches all attendees before calendar events—pulling LinkedIn profiles, recent company news, mutual connections, and conversation starters. Generates a briefing doc with talking points, icebreakers, and context so you show up informed and confident. Triggered automatically before meetings or on-demand. Configure research depth, advance timing, and output format. Walking into meetings blind is amateur hour—missed connections, generic small talk, zero leverage. Use when setting up meeting intelligence, researching specific attendees, generating pre-meeting briefs, or automating your prep workflow.

Workflow & Productivity