|
| 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) |
0 commit comments