generate_with_workflow
Submit a ComfyUI workflow JSON to generate images. Returns image URLs for custom node graphs like ControlNet or upscaling.
Instructions
Submit an arbitrary ComfyUI workflow (full node graph) and return the resulting image URLs. Use this when you need a custom workflow like ControlNet, upscaling, or a node graph exported from ComfyUI's 'Save (API Format)'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow | Yes | Complete ComfyUI workflow JSON (node graph as returned by ComfyUI's 'Save (API Format)' export) |
Implementation Reference
- src/comfyui/client.ts:61-68 (helper)The runWorkflow method on ComfyUIClient that generate_with_workflow's handler calls. Submits the workflow via HTTP POST to /prompt, then polls /history until completion, extracting image URLs.
async runWorkflow(workflow: Workflow): Promise<GenerateResult> { const { prompt_id } = await this.submit(workflow); const entry = await this.waitForCompletion(prompt_id); return { promptId: prompt_id, images: extractImageUrls(entry, this.publicUrl), }; }