Api Generate
Run a full workflow on a remote ComfyUI and get the image back, no screen required
- image
- output
ApiGenerate is the "just do it" remote-execution node: hand it an API-format workflow JSON, point it at a reachable ComfyUI, and it submits, waits, and hands you back the decoded image as a tensor. It's the whole "render on my RunPod, keep my nice local graph" fantasy in one node, and it's the synchronous version - you queue, it blocks until the remote finishes, and the frames land in your downstream nodes.
If that blocking behavior sounds wrong for your use case, that's exactly what Api Submit + Api Collect are for. This node is for when you want one clean pipeline step: fire, wait, get tensor.
How it works
The mechanics are the interesting part. You give it the API-format workflow (the flat {node_id: {class_type, inputs}} JSON from "Save (API Format)"), and it does surgical injection before submitting:
positive_promptis written into the node you name inpositive_prompt_id.negative_prompt, if non-empty, goes intonegative_prompt_id.seed, if not -1, replaces the seed/noise_seed atseed_id.- An optional
imageinput is encoded to PNG, uploaded to the remote's/upload/image, and bound to the LoadImage node you name inimage_node_id. overrides- a JSON string of{node_id: <full node dict>}- replaces entire node entries wholesale, applied last so it wins over every other injection.
Then it submits to the remote /prompt endpoint and polls /history until timeout_sec elapses. When done, it pulls the output of output_id (typically a SaveImage node), fetches the files, and decodes them into a tensor. Animated outputs come back as a batch of frames.
One nice detail: the whole submit/poll runs off the event loop in a worker thread, so ComfyUI marks the node pending and runs other ready nodes in the meantime instead of freezing the whole graph.
Inputs that matter
For a beginner, three of the ten required inputs do most of the work:
workflow- the API-format JSON string. Feed it from Load Workflow, or a file path.api_url- the remote base URL, e.g.https://xxxx-8188.proxy.runpod.netorhttp://127.0.0.1:8188.positive_promptandpositive_prompt_id- the text and the node id it goes into. You find node ids by hovering in the UI or checking the JSON.
output_id is the one people forget; leave it empty and nothing gets fetched back.
Install
Part of ComfyUI-Alchemine-Pack:
cd ComfyUI/custom_nodes
git clone https://github.com/alchemine/comfyui-alchemine-pack
pip install -r requirements.txt
Or via ComfyUI Manager (search "ComfyUI-Alchemine-Pack"). Only dependency is python-dotenv, no model downloads - the models live on the remote, which is the whole trick.
Common issues
The number-one failure is feeding a UI-format workflow. The remote will reject it with a parse error because the structure is completely different. Always save API format.
Number two: the api_url scheme matters. A bare xxxx-8188.proxy.runpod.net without https:// gets rejected by the validator - include the protocol. And if your pod has an API key set, this pack's API nodes don't currently take one as an input, so a key-protected pod will just fail auth.
Number three: timeout_sec defaults to 300. A heavy SDXL workflow with hires fix can outrun that on a slow pod. Bump it.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| workflow | STRING | — | |
| positive_prompt | STRING | — | |
| positive_prompt_id | STRING | — | |
| negative_prompt_id | STRING | — | |
| output_id | STRING | — | |
| seed | INT | -1-1–2147483647 | — |
| seed_id | STRING | — | |
| api_url | STRING | — | |
| image_node_id | STRING | — | |
| timeout_sec | INT | 3001–36000 | — |
| negative_promptopt | STRING | — | |
| imageopt | IMAGE | — | |
| overridesopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |