ComfyUI Workflow Image, Video, and Music Generation in OpenClaw

Learn how to use the bundled comfy plugin to run ComfyUI workflows for image, video, and music generation. This guide covers setup, authentication, and supported tools.

Read this when

  • You want to use local ComfyUI workflows with OpenClaw
  • You want to use Comfy Cloud with image, video, or music workflows
  • You need the bundled comfy plugin config keys

OpenClaw includes a bundled comfy plugin for running ComfyUI workflows. The plugin is entirely driven by workflows: OpenClaw does not map generic size, aspectRatio, resolution, durationSeconds, or TTS style controls onto your graph.

PropertyDetail
Providercomfy
Modelcomfy/workflow
Shared toolsimage_generate, video_generate, music_generate
AuthNone for local ComfyUI; COMFY_API_KEY or COMFY_CLOUD_API_KEY for Comfy Cloud
APIComfyUI /prompt / /history / /view; Comfy Cloud /api/*

What it supports

  • Generate and edit images from a workflow JSON (editing uses 1 uploaded reference image)
  • Generate video from a workflow JSON, either text to video or image to video (1 reference image)
  • Generate music or audio through the shared music_generate tool, with an optional single reference image
  • Download output from a configured node, or from all matching output nodes when none is set

Getting started

You can run ComfyUI on your own machine or use Comfy Cloud.

Local

Best for: running your own ComfyUI instance on your machine or LAN.

Start ComfyUI locally

Ensure your local ComfyUI instance is running (defaults to http://127.0.0.1:8188).

Prepare your workflow JSON

Export or create a ComfyUI workflow JSON file. Note the node IDs for the prompt input node and the output node that OpenClaw should read from.

Configure the provider

Set mode: "local" and point it at your workflow file. Minimal image example:

{
  plugins: {
    entries: {
      comfy: {
        config: {
          mode: "local",
          baseUrl: "http://127.0.0.1:8188",
          image: {
            workflowPath: "./workflows/flux-api.json",
            promptNodeId: "6",
            outputNodeId: "9",
          },
        },
      },
    },
  },
}

Set the default model

Point OpenClaw at the comfy/workflow model for the capability you configured:

{
  agents: {
    defaults: {
      imageGenerationModel: {
        primary: "comfy/workflow",
      },
    },
  },
}

Verify

openclaw models list --provider comfy

Comfy Cloud

Best for: running workflows on Comfy Cloud without managing local GPU resources.

Get an API key

Sign up at comfy.org and generate an API key from your account dashboard.

Set the API key

Provide your key using any of these methods:

# Onboarding flag
openclaw onboard --comfy-api-key "your-key"

# Environment variable (preferred for daemons)
export COMFY_API_KEY="your-key"

# Alternative environment variable
export COMFY_CLOUD_API_KEY="your-key"

# Or inline in config
openclaw config set plugins.entries.comfy.config.apiKey "your-key"

Prepare your workflow JSON

Export or create a ComfyUI workflow JSON file. Note the node IDs for the prompt input node and the output node.

Configure the provider

Set mode: "cloud" and point it at your workflow file:

{
  plugins: {
    entries: {
      comfy: {
        config: {
          mode: "cloud",
          image: {
            workflowPath: "./workflows/flux-api.json",
            promptNodeId: "6",
            outputNodeId: "9",
          },
        },
      },
    },
  },
}

Tip

Cloud mode defaults baseUrl to https://cloud.comfy.org. Set baseUrl only for a custom cloud endpoint.

Set the default model

{
  agents: {
    defaults: {
      imageGenerationModel: {
        primary: "comfy/workflow",
      },
    },
  },
}

Verify

openclaw models list --provider comfy

Configuration

Comfy supports shared top-level connection settings plus per capability workflow sections (image, video, music):

{
  plugins: {
    entries: {
      comfy: {
        config: {
          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",
          },
        },
      },
    },
  },
}

Shared keys

KeyTypeDescription
mode"local" or "cloud"Connection mode. Defaults to "local".
baseUrlstringDefaults to http://127.0.0.1:8188 for local or https://cloud.comfy.org for cloud.
apiKeystringOptional inline key, alternative to COMFY_API_KEY / COMFY_CLOUD_API_KEY env vars.
allowPrivateNetworkbooleanAllow a private or LAN baseUrl in cloud mode or a local private DNS FQDN.

Note

In local mode, loopback or private IP literals and single label service names such as http://comfyui:8188 work without allowPrivateNetwork. Public looking private DNS FQDNs such as https://comfy.local.example.com require allowPrivateNetwork: true. Private origin trust stays scoped to the configured scheme, hostname, and port; local redirects cannot leave the configured hostname, while cloud redirects to public CDNs are checked with the default SSRF policy.

Per-capability keys

These keys apply inside the image, video, or music sections:

KeyRequiredDefaultDescription
workflow or workflowPathYes--Inline workflow JSON, or path to the ComfyUI workflow JSON file.
promptNodeIdYes--Node ID that receives the text prompt.
promptInputNameNo"text"Input name on the prompt node.
outputNodeIdNo--Node ID to read output from. If omitted, all matching output nodes are used.
pollIntervalMsNo1500Polling interval in milliseconds for job completion.
timeoutMsNo300000Timeout in milliseconds for the workflow run.

The image and video sections also support a reference image input node:

KeyRequiredDefaultDescription
inputImageNodeIdYes (when passing a reference image)--Node ID that receives the uploaded reference image.
inputImageInputNameNo"image"Input name on the image node.

apiKey accepts either a literal string or a secret reference object.

Workflow details

Image workflows

Set the default image model to comfy/workflow:

{
  agents: {
    defaults: {
      imageGenerationModel: {
        primary: "comfy/workflow",
      },
    },
  },
}

Reference image editing example:

To enable image editing with an uploaded reference image, add inputImageNodeId to your image config:

{
  plugins: {
    entries: {
      comfy: {
        config: {
          image: {
            workflowPath: "./workflows/edit-api.json",
            promptNodeId: "6",
            inputImageNodeId: "7",
            inputImageInputName: "image",
            outputNodeId: "9",
          },
        },
      },
    },
  },
}

Video workflows

Set the default video model to comfy/workflow:

{
  agents: {
    defaults: {
      videoGenerationModel: {
        primary: "comfy/workflow",
      },
    },
  },
}

Comfy video workflows support text to video and image to video through the configured graph.

Note

OpenClaw does not pass input videos into Comfy workflows. Only text prompts and single reference images are supported as inputs.

Music workflows

The bundled plugin registers a music generation provider for workflow defined audio or music outputs, surfaced through the shared music_generate tool. It accepts an optional reference image (up to 1):

/tool music_generate prompt="Warm ambient synth loop with soft tape texture"

Use the music config section to point at your audio workflow JSON and output node.

Backward compatibility

Existing top level image config (without the nested image section) still works:

{
  plugins: {
    entries: {
      comfy: {
        config: {
          workflowPath: "./workflows/flux-api.json",
          promptNodeId: "6",
          outputNodeId: "9",
        },
      },
    },
  },
}

OpenClaw treats that legacy shape as the image workflow config. You do not need to migrate immediately, but the nested image / video / music sections are recommended for new setups. If you only use image generation, the legacy flat config and the new nested image section are functionally equivalent.

Live tests

Opt in live coverage exists for the bundled plugin:

OPENCLAW_LIVE_TEST=1 COMFY_LIVE_TEST=1 pnpm test:live -- extensions/comfy/comfy.live.test.ts

The live test skips individual image, video, or music cases unless the matching Comfy workflow section is configured.