comfyui-api by mckruz/comfyui-expert
npx skills add https://github.com/mckruz/comfyui-expert --skill comfyui-api连接至 ComfyUI 的 REST API 以执行工作流、监控进度并获取输出。
http://127.0.0.1:8188完全 API 访问。交互式工作的首选模式。
GET /system_statscomfyui-inventory 技能POST /promptGET /history/{prompt_id}广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
GET /view?filename=...导出工作流 JSON 以便在 ComfyUI 中手动加载。
projects/{project}/workflows/{name}.jsoncurl http://127.0.0.1:8188/system_stats
响应字段:
system.os: 操作系统system.comfyui_version: 版本字符串devices[0].name: GPU 名称devices[0].vram_total: 总 VRAM 字节数devices[0].vram_free: 空闲 VRAM 字节数curl -X POST http://127.0.0.1:8188/prompt \
-H "Content-Type: application/json" \
-d '{"prompt": WORKFLOW_JSON, "client_id": "video-agent"}'
WORKFLOW_JSON 格式:
{
"1": {
"class_type": "LoadCheckpoint",
"inputs": {
"ckpt_name": "flux1-dev.safetensors"
}
},
"2": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "photorealistic portrait...",
"clip": ["1", 1]
}
}
}
每个节点由一个字符串 ID 作为键。输入通过 ["{node_id}", {output_index}] 引用其他节点。
响应:
{"prompt_id": "abc-123-def", "number": 1}
curl http://127.0.0.1:8188/history/abc-123-def
未完成 : 返回 {} (空对象) 已完成 : 返回包含输出的执行数据:
{
"abc-123-def": {
"outputs": {
"9": {
"images": [{"filename": "ComfyUI_00001.png", "subfolder": "", "type": "output"}]
}
},
"status": {"completed": true}
}
}
curl "http://127.0.0.1:8188/view?filename=ComfyUI_00001.png&subfolder=&type=output" -o output.png
curl -X POST http://127.0.0.1:8188/upload/image \
-F "image=@reference.png" \
-F "subfolder=input" \
-F "type=input"
curl -X POST http://127.0.0.1:8188/interrupt
curl -X POST http://127.0.0.1:8188/free \
-H "Content-Type: application/json" \
-d '{"unload_models": true}'
ComfyUI 在 CLI 上下文中不支持 WebSocket。使用 REST 轮询:
POST /prompt 队列工作流 → 获取 prompt_idGET /history/{prompt_id}status.completedcompleted: true,提取输出comfyui-troubleshooter超时 : 轮询 10 分钟后警告用户。视频生成 (Wan 14B) 可能需要 15-30 分钟。
在队列任何工作流之前:
state/inventory.json (通过 comfyui-inventory)class_type 存在于已安装节点中ComfyUI-Manager 安装命令references/models.md 的下载链接| 错误 | 原因 | 操作 |
|---|---|---|
| 连接被拒绝 | ComfyUI 未运行 | 切换到离线模式,保存 JSON |
| 400 错误请求 | 无效的工作流 JSON | 验证节点连接 |
| 500 内部错误 | ComfyUI 崩溃 | 建议重启,检查日志 |
| 超时 (无响应) | 服务器过载 | 等待并重试一次 |
完整 API 文档: foundation/api-quick-ref.md
每周安装数
280
代码仓库
GitHub 星标数
25
首次出现
2026年2月24日
安全审计
安装于
gemini-cli276
cursor276
opencode276
codex276
github-copilot276
kimi-cli276
Connect to ComfyUI's REST API to execute workflows, monitor progress, and retrieve outputs.
http://127.0.0.1:8188Full API access. Preferred mode for interactive work.
GET /system_statscomfyui-inventory skillPOST /promptGET /history/{prompt_id} every 5 secondsGET /view?filename=...Export workflow JSON for manual loading in ComfyUI.
projects/{project}/workflows/{name}.jsoncurl http://127.0.0.1:8188/system_stats
Response fields:
system.os: Operating systemsystem.comfyui_version: Version stringdevices[0].name: GPU namedevices[0].vram_total: Total VRAM bytesdevices[0].vram_free: Free VRAM bytescurl -X POST http://127.0.0.1:8188/prompt \
-H "Content-Type: application/json" \
-d '{"prompt": WORKFLOW_JSON, "client_id": "video-agent"}'
WORKFLOW_JSON format:
{
"1": {
"class_type": "LoadCheckpoint",
"inputs": {
"ckpt_name": "flux1-dev.safetensors"
}
},
"2": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "photorealistic portrait...",
"clip": ["1", 1]
}
}
}
Each node is keyed by a string ID. Inputs reference other nodes as ["{node_id}", {output_index}].
Response:
{"prompt_id": "abc-123-def", "number": 1}
curl http://127.0.0.1:8188/history/abc-123-def
Incomplete : Returns {} (empty object) Complete : Returns execution data with outputs:
{
"abc-123-def": {
"outputs": {
"9": {
"images": [{"filename": "ComfyUI_00001.png", "subfolder": "", "type": "output"}]
}
},
"status": {"completed": true}
}
}
curl "http://127.0.0.1:8188/view?filename=ComfyUI_00001.png&subfolder=&type=output" -o output.png
curl -X POST http://127.0.0.1:8188/upload/image \
-F "image=@reference.png" \
-F "subfolder=input" \
-F "type=input"
curl -X POST http://127.0.0.1:8188/interrupt
curl -X POST http://127.0.0.1:8188/free \
-H "Content-Type: application/json" \
-d '{"unload_models": true}'
ComfyUI doesn't support WebSocket in CLI context. Use REST polling:
POST /prompt → get prompt_idGET /history/{prompt_id} every 5 secondsstatus.completedcompleted: true, extract outputscomfyui-troubleshooterTimeout : Warn user after 10 minutes of polling. Video generation (Wan 14B) can take 15-30 minutes.
Before queuing any workflow:
state/inventory.json (via comfyui-inventory)class_type exists in installed nodesComfyUI-Manager install commandreferences/models.md| Error | Cause | Action |
|---|---|---|
| Connection refused | ComfyUI not running | Switch to offline mode, save JSON |
| 400 Bad Request | Invalid workflow JSON | Validate node connections |
| 500 Internal Error | ComfyUI crash | Suggest restart, check logs |
| Timeout (no response) | Server overloaded | Wait and retry once |
Full API documentation: foundation/api-quick-ref.md
Weekly Installs
280
Repository
GitHub Stars
25
First Seen
Feb 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli276
cursor276
opencode276
codex276
github-copilot276
kimi-cli276
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
56,200 周安装