Skip to content

Commit aeb9ad5

Browse files
committed
feat: add comfy workflow media support
1 parent d37b97c commit aeb9ad5

27 files changed

Lines changed: 2384 additions & 32 deletions

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Docs: https://docs.openclaw.ai
2121
- Plugins: add plugin-config TUI prompts to guided onboarding/setup flows, and add `openclaw plugins install --force` so existing plugin and hook-pack targets can be replaced without using the dangerous-code override flag. (#60590, #60544)
2222
- Channels/context visibility: add configurable `contextVisibility` per channel (`all`, `allowlist`, `allowlist_quote`) so supplemental quote, thread, and fetched history context can be filtered by sender allowlists instead of always passing through as received.
2323
- Providers: add bundled Qwen, Fireworks AI, and StepFun providers, plus MiniMax TTS, Ollama Web Search, and MiniMax Search integrations for chat, speech, and search workflows. (#60032, #55921, #59318, #54648)
24+
- Providers/ComfyUI: add a bundled `comfy` workflow media plugin for local ComfyUI and Comfy Cloud workflows, including shared `image_generate` and `video_generate` support plus a bundled `music_generate` tool for audio workflows, with prompt injection, optional reference-image upload, live tests, and output download.
2425
- Providers/Amazon Bedrock: add bundled Mantle support plus inference-profile discovery and automatic request-region injection so Bedrock-hosted Claude, GPT-OSS, Qwen, Kimi, GLM, and similar routes work with less manual setup. (#61296, #61299) Thanks @wirjo.
2526
- Providers/request overrides: add shared model and media request transport overrides across OpenAI-, Anthropic-, Google-, and compatible provider paths, including headers, auth, proxy, and TLS controls. (#60200)
2627
- Prompt caching: keep prompt prefixes more reusable across transport fallback, deterministic MCP tool ordering, compaction, embedded image history, normalized system-prompt fingerprints, `openclaw status --verbose` cache diagnostics, and the removal of duplicate in-band tool inventories from agent system prompts so follow-up turns hit cache more reliably. (#58036, #58037, #58038, #59054, #60603, #60691) Thanks @bcherny and @vincentkoc.

β€Ždocs/docs.jsonβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,12 +1200,14 @@
12001200
"tools/exec",
12011201
"tools/exec-approvals",
12021202
"tools/image-generation",
1203+
"tools/music-generation",
12031204
"tools/llm-task",
12041205
"tools/lobster",
12051206
"tools/loop-detection",
12061207
"tools/pdf",
12071208
"tools/reactions",
1208-
"tools/thinking"
1209+
"tools/thinking",
1210+
"tools/video-generation"
12091211
]
12101212
},
12111213
{
@@ -1238,6 +1240,7 @@
12381240
"providers/bedrock",
12391241
"providers/bedrock-mantle",
12401242
"providers/chutes",
1243+
"providers/comfy",
12411244
"providers/claude-max-api-proxy",
12421245
"providers/cloudflare-ai-gateway",
12431246
"providers/deepgram",

β€Ždocs/help/testing.mdβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,15 @@ If you want to rely on env keys (e.g. exported in your `~/.profile`), run local
389389
- Enable: `BYTEPLUS_API_KEY=... BYTEPLUS_LIVE_TEST=1 pnpm test:live src/agents/byteplus.live.test.ts`
390390
- Optional model override: `BYTEPLUS_CODING_MODEL=ark-code-latest`
391391

392+
## ComfyUI workflow media live
393+
394+
- Test: `extensions/comfy/comfy.live.test.ts`
395+
- Enable: `OPENCLAW_LIVE_TEST=1 COMFY_LIVE_TEST=1 pnpm test:live -- extensions/comfy/comfy.live.test.ts`
396+
- Scope:
397+
- Exercises the bundled comfy image, video, and `music_generate` paths
398+
- Skips each capability unless `models.providers.comfy.<capability>` is configured
399+
- Useful after changing comfy workflow submission, polling, downloads, or plugin registration
400+
392401
## Image generation live
393402

394403
- Test: `src/image-generation/runtime.live.test.ts`

β€Ždocs/providers/comfy.mdβ€Ž

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
---
2+
title: "ComfyUI"
3+
summary: "ComfyUI workflow image, video, and music generation setup in OpenClaw"
4+
read_when:
5+
- You want to use local ComfyUI workflows with OpenClaw
6+
- You want to use Comfy Cloud with image, video, or music workflows
7+
- You need the bundled comfy plugin config keys
8+
---
9+
10+
# ComfyUI
11+
12+
OpenClaw ships a bundled `comfy` plugin for workflow-driven ComfyUI runs.
13+
14+
- Provider: `comfy`
15+
- Models: `comfy/workflow`
16+
- Shared surfaces: `image_generate`, `video_generate`
17+
- Plugin tool: `music_generate`
18+
- Auth: none for local ComfyUI; `COMFY_API_KEY` or `COMFY_CLOUD_API_KEY` for Comfy Cloud
19+
- API: ComfyUI `/prompt` / `/history` / `/view` and Comfy Cloud `/api/*`
20+
21+
## What it supports
22+
23+
- Image generation from a workflow JSON
24+
- Image editing with 1 uploaded reference image
25+
- Video generation from a workflow JSON
26+
- Video generation with 1 uploaded reference image
27+
- Music or audio generation through the bundled `music_generate` tool
28+
- Output download from a configured node or all matching output nodes
29+
30+
The bundled plugin is workflow-driven, so OpenClaw does not try to map generic
31+
`size`, `aspectRatio`, `resolution`, `durationSeconds`, or TTS-style controls
32+
onto your graph.
33+
34+
## Config layout
35+
36+
Comfy supports shared top-level connection settings plus per-capability workflow
37+
sections:
38+
39+
```json5
40+
{
41+
models: {
42+
providers: {
43+
comfy: {
44+
mode: "local",
45+
baseUrl: "http://127.0.0.1:8188",
46+
image: {
47+
workflowPath: "./workflows/flux-api.json",
48+
promptNodeId: "6",
49+
outputNodeId: "9",
50+
},
51+
video: {
52+
workflowPath: "./workflows/video-api.json",
53+
promptNodeId: "12",
54+
outputNodeId: "21",
55+
},
56+
music: {
57+
workflowPath: "./workflows/music-api.json",
58+
promptNodeId: "3",
59+
outputNodeId: "18",
60+
},
61+
},
62+
},
63+
},
64+
}
65+
```
66+
67+
Shared keys:
68+
69+
- `mode`: `local` or `cloud`
70+
- `baseUrl`: defaults to `http://127.0.0.1:8188` for local or `https://cloud.comfy.org` for cloud
71+
- `apiKey`: optional inline key alternative to env vars
72+
- `allowPrivateNetwork`: allow a private/LAN `baseUrl` in cloud mode
73+
74+
Per-capability keys under `image`, `video`, or `music`:
75+
76+
- `workflow` or `workflowPath`: required
77+
- `promptNodeId`: required
78+
- `promptInputName`: defaults to `text`
79+
- `outputNodeId`: optional
80+
- `pollIntervalMs`: optional
81+
- `timeoutMs`: optional
82+
83+
Image and video sections also support:
84+
85+
- `inputImageNodeId`: required when you pass a reference image
86+
- `inputImageInputName`: defaults to `image`
87+
88+
## Backward compatibility
89+
90+
Existing top-level image config still works:
91+
92+
```json5
93+
{
94+
models: {
95+
providers: {
96+
comfy: {
97+
workflowPath: "./workflows/flux-api.json",
98+
promptNodeId: "6",
99+
outputNodeId: "9",
100+
},
101+
},
102+
},
103+
}
104+
```
105+
106+
OpenClaw treats that legacy shape as the image workflow config.
107+
108+
## Image workflows
109+
110+
Set the default image model:
111+
112+
```json5
113+
{
114+
agents: {
115+
defaults: {
116+
imageGenerationModel: {
117+
primary: "comfy/workflow",
118+
},
119+
},
120+
},
121+
}
122+
```
123+
124+
Reference-image editing example:
125+
126+
```json5
127+
{
128+
models: {
129+
providers: {
130+
comfy: {
131+
image: {
132+
workflowPath: "./workflows/edit-api.json",
133+
promptNodeId: "6",
134+
inputImageNodeId: "7",
135+
inputImageInputName: "image",
136+
outputNodeId: "9",
137+
},
138+
},
139+
},
140+
},
141+
}
142+
```
143+
144+
## Video workflows
145+
146+
Set the default video model:
147+
148+
```json5
149+
{
150+
agents: {
151+
defaults: {
152+
videoGenerationModel: {
153+
primary: "comfy/workflow",
154+
},
155+
},
156+
},
157+
}
158+
```
159+
160+
Comfy video workflows currently support text-to-video and image-to-video through
161+
the configured graph. OpenClaw does not pass input videos into Comfy workflows.
162+
163+
## Music workflows
164+
165+
The bundled plugin registers a `music_generate` tool for workflow-defined audio
166+
or music outputs:
167+
168+
```text
169+
/tool music_generate prompt="Warm ambient synth loop with soft tape texture"
170+
```
171+
172+
Use the `music` config section to point at your audio workflow JSON and output
173+
node.
174+
175+
## Comfy Cloud
176+
177+
Use `mode: "cloud"` plus one of:
178+
179+
- `COMFY_API_KEY`
180+
- `COMFY_CLOUD_API_KEY`
181+
- `models.providers.comfy.apiKey`
182+
183+
Cloud mode still uses the same `image`, `video`, and `music` workflow sections.
184+
185+
## Live tests
186+
187+
Opt-in live coverage exists for the bundled plugin:
188+
189+
```bash
190+
OPENCLAW_LIVE_TEST=1 COMFY_LIVE_TEST=1 pnpm test:live -- extensions/comfy/comfy.live.test.ts
191+
```
192+
193+
The live test skips individual image, video, or music cases unless the matching
194+
Comfy workflow section is configured.
195+
196+
## Related
197+
198+
- [Image Generation](/tools/image-generation)
199+
- [Video Generation](/tools/video-generation)
200+
- [Music Generation](/tools/music-generation)
201+
- [Provider Directory](/providers/index)
202+
- [Configuration Reference](/gateway/configuration-reference#agent-defaults)

β€Ždocs/providers/index.mdβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Looking for chat channel docs (WhatsApp/Telegram/Discord/Slack/Mattermost (plugi
3131
- [Anthropic (API + Claude CLI)](/providers/anthropic)
3232
- [BytePlus (International)](/concepts/model-providers#byteplus-international)
3333
- [Chutes](/providers/chutes)
34+
- [ComfyUI](/providers/comfy)
3435
- [Cloudflare AI Gateway](/providers/cloudflare-ai-gateway)
3536
- [DeepSeek](/providers/deepseek)
3637
- [fal](/providers/fal)
@@ -71,6 +72,7 @@ Looking for chat channel docs (WhatsApp/Telegram/Discord/Slack/Mattermost (plugi
7172

7273
- [Additional bundled variants](/providers/models#additional-bundled-provider-variants) - Anthropic Vertex, Copilot Proxy, and Gemini CLI OAuth
7374
- [Image Generation](/tools/image-generation) - Shared `image_generate` tool, provider selection, and failover
75+
- [Music Generation](/tools/music-generation) - Plugin-provided `music_generate` tool surfaces
7476
- [Video Generation](/tools/video-generation) - Shared `video_generate` tool, provider selection, and failover
7577

7678
## Transcription providers

β€Ždocs/providers/models.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ model as `provider/model`.
2929
- [Amazon Bedrock](/providers/bedrock)
3030
- [BytePlus (International)](/concepts/model-providers#byteplus-international)
3131
- [Chutes](/providers/chutes)
32+
- [ComfyUI](/providers/comfy)
3233
- [Cloudflare AI Gateway](/providers/cloudflare-ai-gateway)
3334
- [fal](/providers/fal)
3435
- [Fireworks](/providers/fireworks)

β€Ždocs/tools/image-generation.mdβ€Ž

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
summary: "Generate and edit images using configured providers (OpenAI, Google Gemini, fal, MiniMax)"
2+
summary: "Generate and edit images using configured providers (OpenAI, Google Gemini, fal, MiniMax, ComfyUI)"
33
read_when:
44
- Generating images via the agent
55
- Configuring image generation providers and models
@@ -38,12 +38,13 @@ The agent calls `image_generate` automatically. No tool allow-listing needed β€”
3838

3939
## Supported providers
4040

41-
| Provider | Default model | Edit support | API key |
42-
| -------- | -------------------------------- | ----------------------- | ----------------------------------------------------- |
43-
| OpenAI | `gpt-image-1` | Yes (up to 5 images) | `OPENAI_API_KEY` |
44-
| Google | `gemini-3.1-flash-image-preview` | Yes | `GEMINI_API_KEY` or `GOOGLE_API_KEY` |
45-
| fal | `fal-ai/flux/dev` | Yes | `FAL_KEY` |
46-
| MiniMax | `image-01` | Yes (subject reference) | `MINIMAX_API_KEY` or MiniMax OAuth (`minimax-portal`) |
41+
| Provider | Default model | Edit support | API key |
42+
| -------- | -------------------------------- | ---------------------------------- | ----------------------------------------------------- |
43+
| OpenAI | `gpt-image-1` | Yes (up to 5 images) | `OPENAI_API_KEY` |
44+
| Google | `gemini-3.1-flash-image-preview` | Yes | `GEMINI_API_KEY` or `GOOGLE_API_KEY` |
45+
| fal | `fal-ai/flux/dev` | Yes | `FAL_KEY` |
46+
| MiniMax | `image-01` | Yes (subject reference) | `MINIMAX_API_KEY` or MiniMax OAuth (`minimax-portal`) |
47+
| ComfyUI | `workflow` | Yes (1 image, workflow-configured) | `COMFY_API_KEY` or `COMFY_CLOUD_API_KEY` for cloud |
4748

4849
Use `action: "list"` to inspect available providers and models at runtime:
4950

@@ -107,13 +108,13 @@ Notes:
107108

108109
### Image editing
109110

110-
OpenAI, Google, fal, and MiniMax support editing reference images. Pass a reference image path or URL:
111+
OpenAI, Google, fal, MiniMax, and ComfyUI support editing reference images. Pass a reference image path or URL:
111112

112113
```
113114
"Generate a watercolor version of this photo" + image: "/path/to/photo.jpg"
114115
```
115116

116-
OpenAI and Google support up to 5 reference images via the `images` parameter. fal and MiniMax support 1.
117+
OpenAI and Google support up to 5 reference images via the `images` parameter. fal, MiniMax, and ComfyUI support 1.
117118

118119
MiniMax image generation is available through both bundled MiniMax auth paths:
119120

@@ -122,18 +123,19 @@ MiniMax image generation is available through both bundled MiniMax auth paths:
122123

123124
## Provider capabilities
124125

125-
| Capability | OpenAI | Google | fal | MiniMax |
126-
| --------------------- | -------------------- | -------------------- | ------------------- | -------------------------- |
127-
| Generate | Yes (up to 4) | Yes (up to 4) | Yes (up to 4) | Yes (up to 9) |
128-
| Edit/reference | Yes (up to 5 images) | Yes (up to 5 images) | Yes (1 image) | Yes (1 image, subject ref) |
129-
| Size control | Yes | Yes | Yes | No |
130-
| Aspect ratio | No | Yes | Yes (generate only) | Yes |
131-
| Resolution (1K/2K/4K) | No | Yes | Yes | No |
126+
| Capability | OpenAI | Google | fal | MiniMax | ComfyUI |
127+
| --------------------- | -------------------- | -------------------- | ------------------- | -------------------------- | ---------------------------------- |
128+
| Generate | Yes (up to 4) | Yes (up to 4) | Yes (up to 4) | Yes (up to 9) | Yes (workflow-defined outputs) |
129+
| Edit/reference | Yes (up to 5 images) | Yes (up to 5 images) | Yes (1 image) | Yes (1 image, subject ref) | Yes (1 image, workflow-configured) |
130+
| Size control | Yes | Yes | Yes | No | No |
131+
| Aspect ratio | No | Yes | Yes (generate only) | Yes | No |
132+
| Resolution (1K/2K/4K) | No | Yes | Yes | No | No |
132133

133134
## Related
134135

135136
- [Tools Overview](/tools) β€” all available agent tools
136137
- [fal](/providers/fal) β€” fal image and video provider setup
138+
- [ComfyUI](/providers/comfy) β€” local ComfyUI and Comfy Cloud workflow setup
137139
- [Google (Gemini)](/providers/google) β€” Gemini image provider setup
138140
- [MiniMax](/providers/minimax) β€” MiniMax image provider setup
139141
- [OpenAI](/providers/openai) β€” OpenAI Images provider setup

β€Ždocs/tools/index.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ For image work, use `image` for analysis and `image_generate` for generation or
7575

7676
For video work, use `video_generate`. If you target `qwen/*` or another non-default video provider, configure that provider's auth/API key first.
7777

78+
For workflow-driven audio generation, use `music_generate` when a plugin such as
79+
ComfyUI registers it. This is separate from `tts`, which is text-to-speech.
80+
7881
`session_status` is the lightweight status/readback tool in the sessions group.
7982
It answers `/status`-style questions about the current session and can
8083
optionally set a per-session model override; `model=default` clears that
@@ -100,6 +103,7 @@ Plugins can register additional tools. Some examples:
100103

101104
- [Lobster](/tools/lobster) β€” typed workflow runtime with resumable approvals
102105
- [LLM Task](/tools/llm-task) β€” JSON-only LLM step for structured output
106+
- [Music Generation](/tools/music-generation) β€” plugin-provided `music_generate` tool surfaces
103107
- [Diffs](/tools/diffs) β€” diff viewer and renderer
104108
- [OpenProse](/prose) β€” markdown-first workflow orchestration
105109

0 commit comments

Comments
Β (0)