Install
openclaw skills install comfyui-automationUse when you need to automate ComfyUI tasks. This skill provides instructions and scripts for installing ComfyUI, parsing API-format workflow JSON files, checking and downloading missing models, and executing workflows. Use this for requests like "run this comfyui workflow", "set up comfyui", or "generate an image using this json".
openclaw skills install comfyui-automationThis skill provides a reliable, standardized workflow for interacting with ComfyUI. It is specifically designed to be easily executed by automated agents.
ComfyUI should be installed in the primary workspace. Never install directly using root pip to avoid OS conflicts (PEP 668); always use a virtual environment (venv).
Check if installed:
ls /root/.openclaw/workspace/ComfyUI/venv/bin/activate
If missing, install:
cd /root/.openclaw/workspace
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
ComfyUI workflows must be in API Format (a flat JSON dictionary where keys are stringified Node IDs).
If the user provides a standard UI format JSON (which contains links, pos, groups arrays), kindly request the API Format or use an appropriate converter.
Workflows will fail if the required weights (UNet, Checkpoints, VAE, LoRA, CLIP) are missing from the ComfyUI/models/ subdirectories.
To avoid redownloading large files, always check if the file exists first.
Use the provided script to scan the workflow JSON for model requirements and check them against the local directory:
python3 scripts/analyze_models.py /path/to/workflow_api.json /root/.openclaw/workspace/ComfyUI
Downloading:
If models are missing, formulate a download script. Always use wget -nc (no clobber) or -c (continue) to prevent overwriting or duplicate downloads. Example:
cd /root/.openclaw/workspace/ComfyUI/models/checkpoints
wget -nc https://huggingface.co/path/to/model.safetensors
Do not try to run ComfyUI workflows by modifying the UI state. Instead:
8188).Example Python Wrapper:
import json, urllib.request, random
# 1. Load the template
with open("workflow_api.json", "r") as f:
workflow = json.load(f)
# 2. Inject user variables (Identify the correct Node IDs beforehand)
# workflow["27"]["inputs"]["text"] = "A beautiful sunset..."
# workflow["3"]["inputs"]["seed"] = random.randint(1, 9999999)
# 3. Submit to API
payload = json.dumps({"prompt": workflow}).encode('utf-8')
req = urllib.request.Request("http://127.0.0.1:8188/prompt", data=payload)
req.add_header('Content-Type', 'application/json')
res = json.loads(urllib.request.urlopen(req).read())
print(f"Prompt queued with ID: {res['prompt_id']}")
ComfyUI/custom_nodes/, and pip install -r requirements.txt inside its folder using the venv.--lowvram to the ComfyUI startup command.