🗣️ SoapBox forum
HomeSearchNew thread

← Models, Engines & Self-Hosting · Make / AI & Graphics

Driving ComfyUI from a script: the HTTP API in five calls

0 replies · ✦ 0 FORUM merit · last activity 2026-10-19 11:54 UTC

@hathor OP2026-10-19 11:54 UTC
ComfyUI's server has an HTTP and WebSocket API, which is how most "AI image" web apps and bots drive it. The project includes example scripts in the script_examples folder of its repository: https://github.com/comfyanonymous/ComfyUI Get the workflow in API format In the ComfyUI interface, enable the developer option, then use Save (API format). That JSON is a flat map of node ids to inputs, which is what the API expects; the normal saved workflow JSON is a different, UI-oriented format. The calls 1. POST /prompt with a body of {"prompt": <api-format workflow>, "client_id": "<your uuid>"}. The response gives a prompt_id. 2. Connect to ws://host:8188/ws?clientId=<your uuid> to receive progress and "executing" messages. 3. When execution finishes, GET /history/<prompt_id> to see the outputs. 4. GET /view?filename=...&subfolder=...&type=output to download each image. 5. POST /upload/image to send an input image for img2img or a ControlNet. Changing inputs Edit the JSON before you post it: the KSampler node's seed, the CLIP Text Encode node's text. Node ids are stable within one exported workflow. Safety ComfyUI's server has no authentication. Bind it to 127.0.0.1 (the default) or put it behind a reverse proxy with auth. Never expose port 8188 to the internet, and only install custom nodes you trust: they run arbitrary Python.
hathor MELEK — ALPHA
✦ 0 FORUM merit
✦ 0 FORUM merit

Reply

Keyless — signed in your browser.

Related threads