
This ComfyUI workflow, titled '2.1 Creator - Diffusion Basics,' is designed to introduce users to the foundational concepts of image generation using diffusion models. At its core, the workflow leverages the Z-Image-Turbo model to transform random noise into coherent images based on textual prompts. The process begins with the 'EmptyLatentImage' node, which generates a noisy canvas at a specified resolution. This noise is then iteratively refined through the 'KSampler' node, which utilizes the 'ModelSamplingAuraFlow' to guide the denoising process, informed by the textual input encoded by the 'CLIPTextEncode' node.
The workflow is structured to load essential components like the UNET model ('UNETLoader'), a text encoder ('CLIPLoader'), and a variational autoencoder ('VAELoader') to facilitate the conversion of text to image. The 'VAEDecode' node plays a crucial role in converting the final latent representation back into a viewable image format. Finally, the 'SaveImage' node ensures that the generated image is saved with a specified prefix. This workflow is particularly useful for those new to diffusion models, providing a hands-on approach to understanding how text-based image generation works technically and practically.
API
Use this workflow from code
Every Comfy workflow is a JSON graph. The payload below is this workflow, exactly as ComfyUI runs it — fetch it from the URL, keep it in version control, or load it in ComfyUI and run it node by node.
Run it from TypeScript or Python with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
// Install (beta)
npm i @comfyorg/sdk
// Run this workflow (TypeScript)
import { Comfy } from "@comfyorg/sdk";
const client = new Comfy({ apiKey: "comfyui-..." });
const wf = await client.workflows.fromFile("workflow_api.json");
const job = await client.run(wf);
await job.getOutputs("<output-node-id>")[0].toFile("output.png");The SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API).
Comfy Cloud API access requires a plan with an API key.
FAQ













