- Home
- Skills
- Image & Video
- ComfyUI Headless: drive it from code
ComfyUI Headless: drive it from code
by Ricardo Faya
Automate local ComfyUI image generation via the HTTP API with production-ready pipelines and error handling.
Free
ComfyUI Headless: drive it from code
Example session with this skill installed
Run a photorealistic render of a cyberpunk street using the Qwen-Lightning pipeline and save it as street-render.webp.
- Read your context and instructions
- Compiled the comfyui headless
- Generated the image
I have submitted the Qwen-2512-Lightning workflow to your local ComfyUI server. The prompt was enriched with photorealistic suffixes to ensure professional lighting and remove unwanted text/logos. The system successfully polled the history API until the job completed and retrieved the resulting image.
Headless Generation Results
| Parameter | Value |
|---|---|
| Model | qwen-2512-lightning.safetensors |
| Pipeline | qwen-2512-lightning |
| Resolution | 1024 x 1024 |
| Steps / Sampler | 4 / euler |
| CFG | 1.0 |
| Prompt ID | f9a2b3c4-d5e6-4f7g-8h9i-0j1k2l3m4n5o |
| Status | Completed |
| Output Path | outputs/street-render_00001_.png |
| WebP Size | 38.4 KB (Optimized via FFmpeg) |
# Execution log
# 1. Fetched node signatures from /object_info/UNETLoader
# 2. Submitting workflow JSON to POST /prompt...
# 3. Job f9a2b3c4... queued.
# 4. Polling /history/f9a2b3c4... Done.
# 5. Retrieving street-render_00001_.png.
# 6. Optimization: ffmpeg -i in.png -vf scale=1024:-1 -quality 80 street-render.webp
Next steps
- Inspect the render at the provided output path to check for unwanted artifacts.
- Scale the
batch_sizein therun.pyarguments if you need multiple variations of this scene. - If the lighting is too flat, consider switching to the
z-image-basepipeline for higher step counts.
street-render_00001_.png
PNG · 1536×1024
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
Running ComfyUI through the browser canvas is fine for single images but fails for automation. Developers lack clear documentation on the specific HTTP API format, subgraph handling, and error retrieval required for headless production pipelines.
What it does
- Submits image generation workflows to the ComfyUI HTTP API using the required flat-dict API format.
- Extracts and navigates complex subgraphs and muted nodes from modern workflow templates.
- Polls job history and retrieves output filenames for automated asset pipelines.
- Provides tested pipelines for Z-Image Turbo, Qwen-Lightning, and LoRA-integrated workflows.
- Queries the server for exact model filenames and node signatures to prevent validation errors.
Frameworks & tools
ComfyUI, Stable Diffusion, Flux, Z-Image, Qwen Image, Python, FFmpeg.
Why this beats prompting it yourself
ComfyUI uses two different JSON formats. Simply "saving" a workflow from the UI produces a Graph format that the API rejects. This skill handles the transformation, solves the silent LoRA wiring failure, and correctly parses the HTTP 400 error bodies where ComfyUI hides its validation feedback.
Use cases
- Building a backend worker that generates image assets for a web application.
- Running large-scale batch processing for thousands of variations without manual canvas clicks.
- Integrating image generation into CI/CD pipelines or nightly cron jobs.
- Creating a custom interface or agent that controls a local GPU server.
Known limitations
Requires a local or reachable ComfyUI server instance. High VRAM usage (8+ GB) is necessary for batching at 1024x1024 resolutions.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
8 uses
Times used to date
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 1 month ago
- Free with an Agensi account
Permissions
What's inside
Frequently Asked Questions
New in Image & Video
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Image Generation Skills.