Run any ComfyUI workflow from inside a Modly workflow. This extension adds a ComfyUI Generate node: feed it a positive and a negative prompt, point it at a workflow you exported from ComfyUI, and it returns the generated image to the next node in your Modly graph.
It talks to a ComfyUI server you already run locally — nothing is bundled, nothing is
downloaded. The processor is pure Python standard library, so there is no setup.py
and no virtual environment to build.
┌─ ComfyUI Generate ──────────────┐
│ ○ positive image ● ──→ │
│ ○ negative │
├─────────────────────────────────┤
│ Server URL http://127.0.0.1… │
│ Workflows <folder> 📁 │
│ Workflow ▼ my_workflow.json │
│ Seed -1 │
└─────────────────────────────────┘
| Port | Type | Description |
|---|---|---|
positive (input) |
text | Prompt injected into the workflow's positive text encoder |
negative (input) |
text | Prompt injected into the workflow's negative text encoder |
image (output) |
image | The generated image, passed downstream |
| Parameter | Description |
|---|---|
| Server URL | Where ComfyUI is listening. http://127.0.0.1:8188 by default (ComfyUI Desktop often uses port 8000). |
| Workflows Folder | A folder of ComfyUI workflows exported in API format. |
| Workflow | Dropdown of the .json files in that folder — pick the one to run. |
| Seed | -1 (default) randomizes the seed on every run. Set a fixed value (≥ 0) for reproducible results. |
Both prompt inputs are optional. If a prompt input is left unconnected, the text already saved in the workflow is used as-is.
- Modly with extension support.
- A running ComfyUI server, reachable from the machine Modly runs on.
- Any Python 3.8+ available to Modly (only the standard library is used).
In Modly → Extensions → Install from GitHub, paste this repository's URL.
Copy this folder into Modly's extensions directory, then restart Modly (extensions are loaded at startup). The node appears under Extensions in the Workflows node palette.
The node needs the URL where ComfyUI is listening. The port is not always 8188.
- Look at the ComfyUI console when it starts — it prints a line like:
Starting server…To see the GUI go to: http://127.0.0.1:8188The number at the end (8188,8000, …) is your port. - Or look at your browser's address bar when ComfyUI is open:
http://127.0.0.1:XXXX. - Rule of thumb: the classic/portable ComfyUI uses 8188; ComfyUI Desktop usually uses 8000.
So your Server URL is http://127.0.0.1:<that number> (e.g. http://127.0.0.1:8000).
Quick check: open
http://127.0.0.1:<port>in a browser — if the ComfyUI interface loads, that's the right port.
This is the single most common source of errors. ComfyUI's /prompt API only accepts the
API format, not the visual graph you see on screen.
- In ComfyUI, open Settings (⚙️) and enable Dev mode (a.k.a. "Enable dev mode options"). This adds the API export button.
- Open or build the workflow you want to run.
- Workflow → Export (API) (older builds: the "Save (API Format)" button).
- Save the
.jsoninto a dedicated folder — that folder is your Workflows Folder.
If you feed a normal (UI-format) export, the node fails with:
This is a UI-format export. In ComfyUI use Workflow > Export (API) instead.
A ready example is in examples/txt2img_api.json — a minimal
SD1.5 text-to-image graph. Change ckpt_name to a checkpoint you actually have installed
in ComfyUI.
- Add the ComfyUI Generate node (Workflows palette → Extensions).
- Server URL → the URL from step 1.
- Workflows Folder → click 📁 and pick the folder from step 2.
- Workflow → choose your
.jsonin the dropdown. - Wire a Text node into
positive(and optionally another intonegative), then run.
On each run the processor:
- Reads the selected workflow JSON (rejecting UI-format files early).
- Finds every
CLIPTextEncodenode and traces which sampler slot consumes it, to know whether it is the positive or negative encoder — then writes your prompts in. - Sets every
seed/noise_seed— randomized by default, or to the fixed Seed value when you set one (≥ 0). With a fixed seed, identical inputs are served from ComfyUI's cache and emit no image, so the node reports it. POST /prompt→ pollsGET /history/{id}→ downloads the first image viaGET /viewand saves it into Modly's workspace, returning its path to the next node.
- Batch generation: put your prompts in two folders (
positif/,negatif/) and drive the two inputs with two For Each Text nodes running in lockstep — one image per pair. - Isolated subjects: a
plain white backgroundpositive plus abackground, scenery, landscapenegative gives clean subjects — ideal to feed a 3D mesh generator downstream. - Wrong port: if you get "server not reachable", check the Server URL. ComfyUI
Desktop frequently listens on
8000, not8188.
| Message | Cause / fix |
|---|---|
server not reachable at … |
ComfyUI isn't running, or the Server URL/port is wrong. |
This is a UI-format export… |
Re-export via Workflow → Export (API). |
rejected the workflow … |
A node/model referenced by the workflow isn't installed in ComfyUI. |
produced no outputs … |
The workflow has no Save Image node. |
MIT © 2026 Lorchie