Run ComfyUI workflows from the command line. Designed for agent automation — structured JSON output on stdout, human-readable text on stderr.
# Run a workflow (blocks until complete)
python3 run.py image "a cat sitting on a windowsill" -o ./output
# Get view URL without downloading
python3 run.py image "a cat" --no-download| Workflow | Use Case | Default Model |
|---|---|---|
image |
General purpose, style-agnostic | z_image_turbo_bf16.safetensors |
anime |
Anime/manga style | NetaYumev35_pretrained_all_in_one.safetensors |
sdxl |
SDXL-specific workflows | See workflow JSON |
Models must include the correct path prefix for ComfyUI's discovery:
- SDXL models:
SDXL/(e.g.,SDXL/realDream_sdxlPony17_fp16.safetensors) - Standard checkpoints: Just the filename (e.g.,
z_image_turbo_bf16.safetensors) - UNet models:
unet/prefix
All generated images go to:
~/.openclaw/media/tool-image-generation/
The script outputs JSON lines to stdout at each stage:
| status | meaning |
|---|---|
submitting |
Job submitted, waiting on queue |
queued |
In ComfyUI queue (includes prompt_id, queue_position) |
done |
Complete — includes paths or urls |
failed |
Error — includes error field with reason |
Example parsing:
output=$(python3 run.py image "a cat" -o ./output 2>/dev/null)
last=$(echo "$output" | tail -1)
status=$(echo "$last" | jq -r '.status')
if [ "$status" = "done" ]; then
echo "Files: $(echo "$last" | jq -r '.paths[]')"
fi- z_image_turbo_bf16.safetensors — Fast, versatile, good for most use cases
- NetaYumev35_pretrained_all_in_one.safetensors — Best anime/manga output
- realDream_sdxlPony17_fp16.safetensors — Photo-realistic SDXL
- ComfyUI running locally (default:
http://localhost:8188) - Python 3.10+
- Models installed in your ComfyUI models directory