Model providers
Using ComfyUI with OpenClaw
Browse more in Model providers.
All model providers guides →This guide shows you how to wire up ComfyUI as a model provider inside OpenClaw using the bundled comfy plugin. You configure image, video, and music workflows so your agents can call ComfyUI through shared tools like image_generate and music_generate.
By the end, you will have ComfyUI running in local or cloud mode with OpenClaw agents using a comfy/workflow model for generation.
Prerequisites
- ✓A running ComfyUI instance reachable at a URL like http://127.0.0.1:8188 or a Comfy Cloud account.
- ✓Existing ComfyUI workflow JSON files for image, video, and/or music generation (for example ./workflows/flux-api.json).
- ✓An OpenClaw project where you can edit the models.providers and agents.defaults configuration.
- ✓A COMFY_API_KEY or COMFY_CLOUD_API_KEY if you plan to use Comfy Cloud instead of a local ComfyUI server.
Steps
- 1
Configure the comfy provider for local ComfyUI
Start by registering the comfy provider in your OpenClaw models config so it can talk to your local ComfyUI server. You point each capability (image, video, music) at a specific workflow JSON and define which nodes handle prompts and outputs.
json{ models: { providers: { comfy: { mode: "local", baseUrl: "http://127.0.0.1:8188", image: { workflowPath: "./workflows/flux-api.json", promptNodeId: "6", outputNodeId: "9", }, video: { workflowPath: "./workflows/video-api.json", promptNodeId: "12", outputNodeId: "21", }, music: { workflowPath: "./workflows/music-api.json", promptNodeId: "3", outputNodeId: "18", }, }, }, }, } - 2
Set comfy as the default image and video generation model
Next, tell your agents to use the comfy/workflow model when they call the shared image and video generation tools. This keeps your prompts simple while routing all image and video work through your ComfyUI workflows.
json{ agents: { defaults: { imageGenerationModel: { primary: "comfy/workflow", }, }, }, } - 3
Configure reference-image editing for ComfyUI image workflows
If you want image editing with an uploaded reference image, add input image node settings to the comfy image section. This tells OpenClaw which node in your ComfyUI graph receives the uploaded image and how to name that input.
json{ models: { providers: { comfy: { image: { workflowPath: "./workflows/edit-api.json", promptNodeId: "6", inputImageNodeId: "7", inputImageInputName: "image", outputNodeId: "9", }, }, }, }, } - 4
Enable comfy for video generation workflows
To use ComfyUI for text-to-video or image-to-video, set the default videoGenerationModel to comfy/workflow. OpenClaw then routes video_generate calls through your configured ComfyUI video graph.
json{ agents: { defaults: { videoGenerationModel: { primary: "comfy/workflow", }, }, }, } - 5
Wire up music or audio workflows with the music_generate tool
For music or audio generation, you use the shared music_generate tool backed by your comfy music workflow. Once the music section is configured, you can trigger audio generation directly from prompts.
text/tool music_generate prompt="Warm ambient synth loop with soft tape texture" - 6
Switch comfy to Comfy Cloud mode with API keys
When you want OpenClaw to call Comfy Cloud instead of a local server, change the comfy mode to cloud and provide an API key. apiKey config.
textUse `mode: "cloud"` plus one of: * `COMFY_API_KEY` * `COMFY_CLOUD_API_KEY` * `models.providers.comfy.apiKey` - 7
Run live tests for the comfy plugin
After configuration, run the bundled live tests to verify that OpenClaw can reach your ComfyUI workflows. The test suite only exercises image, video, or music cases that you have configured, which helps you catch miswired node IDs early.
bashOPENCLAW_LIVE_TEST=1 COMFY_LIVE_TEST=1 pnpm test:live -- extensions/comfy/comfy.live.test.ts
Configuration
| Option | Description | Example |
|---|---|---|
| models.providers.comfy.mode | Selects whether the comfy provider talks to a local ComfyUI server or Comfy Cloud. | local |
| models.providers.comfy.baseUrl | Sets the base URL for the ComfyUI or Comfy Cloud API endpoints. | http://127.0.0.1:8188 |
| models.providers.comfy.apiKey | Inline API key for Comfy Cloud when you do not want to use environment variables. | sk-comfy-cloud-123 |
| models.providers.comfy.allowPrivateNetwork | Allows a private or LAN baseUrl when running in cloud mode. | true |
| COMFY_API_KEY | Environment variable for authenticating to Comfy Cloud in cloud mode. | sk-comfy-api-123 |
| COMFY_CLOUD_API_KEY | Alternative environment variable for Comfy Cloud authentication. | sk-comfy-cloud-456 |
| models.providers.comfy.image.workflowPath | Path to the ComfyUI workflow JSON used for image generation. | ./workflows/flux-api.json |
| models.providers.comfy.image.promptNodeId | ID of the node in the image workflow that receives the text prompt. | 6 |
| models.providers.comfy.image.promptInputName | Name of the input field on the prompt node for image workflows. | text |
| models.providers.comfy.image.outputNodeId | ID of the node in the image workflow whose outputs OpenClaw downloads. | 9 |
| models.providers.comfy.image.inputImageNodeId | ID of the node that accepts a reference image for image editing workflows. | 7 |
| models.providers.comfy.image.inputImageInputName | Name of the input field on the reference image node. | image |
| models.providers.comfy.video.workflowPath | Path to the ComfyUI workflow JSON used for video generation. | ./workflows/video-api.json |
| models.providers.comfy.video.promptNodeId | ID of the node in the video workflow that receives the text prompt. | 12 |
| models.providers.comfy.video.outputNodeId | ID of the node in the video workflow whose outputs OpenClaw downloads. | 21 |
| models.providers.comfy.music.workflowPath | Path to the ComfyUI workflow JSON used for music or audio generation. | ./workflows/music-api.json |
| models.providers.comfy.music.promptNodeId | ID of the node in the music workflow that receives the text prompt. | 3 |
| models.providers.comfy.music.outputNodeId | ID of the node in the music workflow whose outputs OpenClaw downloads. | 18 |
| OPENCLAW_LIVE_TEST | Enables live test coverage for OpenClaw when running the comfy plugin tests. | 1 |
| COMFY_LIVE_TEST | Enables Comfy-specific live tests for the bundled comfy plugin. | 1 |
Troubleshooting
Image generation calls succeed but no files are downloaded from ComfyUI.
This usually means the outputNodeId in your comfy image config does not match the node that produces the final images. outputNodeId to the ID of the node you want OpenClaw to download from.
{
models: {
providers: {
comfy: {
image: {
workflowPath: "./workflows/flux-api.json",
promptNodeId: "6",
outputNodeId: "9",
},
},
},
},
}
Video generation never finishes and the request times out.
Long-running ComfyUI video workflows can exceed your default timeoutMs or pollIntervalMs settings. Add or increase pollIntervalMs and timeoutMs in the comfy video section so OpenClaw keeps polling until your graph completes.
// Add pollIntervalMs and timeoutMs under models.providers.comfy.video
Music generation via /tool music_generate does nothing.
The music_generate tool only works when the comfy music section is configured with a valid workflow and output node. workflowPath, promptNodeId, and outputNodeId so OpenClaw knows which graph to run.
{
models: {
providers: {
comfy: {
music: {
workflowPath: "./workflows/music-api.json",
promptNodeId: "3",
outputNodeId: "18",
},
},
},
},
}
Live tests for the comfy plugin skip image, video, or music cases.
The live test suite only runs cases for capabilities that have a configured workflow section. comfy before running the live tests.
OPENCLAW_LIVE_TEST=1 COMFY_LIVE_TEST=1 pnpm test:live -- extensions/comfy/comfy.live.test.tsFrequently asked questions
Powered by Mem0
Add persistent memory to OpenClaw
Official Mem0 plugin for OpenClaw keeps context across chats and tools. Smaller prompts, lower cost, better continuity for your agents.