Just a few dozen lines of Python and you're good to go for batch generating images with the ComfyUI API.

When you’re doing a project that needs to batch-generate assets, who’s still clicking through the GUI one by one? ComfyUI has a built-in HTTP service on port 8188 that directly accepts workflow JSONs—the same ones you export via “Save API Format” in the UI. The basic flow is just three steps: submit the prompt, poll to check if it’s done, then download the images locally.

You can handle it in under fifty lines of Python. I use it for updating new SKU assets, with auto-changing seeds and organized output directories—I can generate a hundred images overnight without touching anything.

If you’re only making one or two images occasionally and want to tweak things visually, stick with the UI. The API is purely for automation and pipelines. It’s also easy to integrate into a backend—just wrap it with FastAPI, take user prompts, and return images.

Saving the JSON in the API format is key, a lot of people don’t know that.

After polling finishes, can we switch to WebSocket for more real-time updates?

Yeah, batch generating assets really relies on this. Clicking manually would drive you crazy.

Oh nice, I was just about to use that FastAPI part too, thanks for sharing.

The auto-sorting into directories is such a nice touch.

GUI for tweaking, API for bulk runs—clear division of labor.