ComfyUI Headless: drive it from code

    1

    Automate local ComfyUI image generation via the HTTP API with production-ready pipelines and error handling.

    Free

    0 installsSecurity scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIGitHub CopilotGitHub CopilotGemini CLIGemini CLI+20 more

    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

    ParameterValue
    Modelqwen-2512-lightning.safetensors
    Pipelineqwen-2512-lightning
    Resolution1024 x 1024
    Steps / Sampler4 / euler
    CFG1.0
    Prompt IDf9a2b3c4-d5e6-4f7g-8h9i-0j1k2l3m4n5o
    StatusCompleted
    Output Pathoutputs/street-render_00001_.png
    WebP Size38.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_size in the run.py arguments if you need multiple variations of this scene.
    • If the lighting is too flat, consider switching to the z-image-base pipeline for higher step counts.

    comfyui-headless-drive-it-from-code.png

    PNG · 1536×1024

    Generated

    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 install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean today

    • Free to download with an account

    Listedtoday

    Frequently Asked Questions