generate_image
Generate an image from a text prompt. Builds a text-to-image workflow with configurable parameters and returns a prompt ID for tracking.
Instructions
Generate an image from a text prompt — the high-level entry point. Builds a txt2img workflow, filling any unspecified parameter from your configured defaults (set_defaults / COMFYUI_DEFAULT_* / config file), auto-selecting a local checkpoint when none is given. Returns the prompt_id immediately; the resulting asset_id arrives in the completion notification and can be passed to view_image or regenerate. For full control over the node graph, use create_workflow + enqueue_workflow instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Positive text prompt | |
| negative_prompt | No | Negative prompt (default: empty / from defaults) | |
| width | No | Image width | |
| height | No | Image height | |
| steps | No | Sampling steps | |
| cfg | No | CFG scale | |
| sampler | No | Sampler name (e.g. euler, dpmpp_2m) | |
| scheduler | No | Scheduler (e.g. normal, karras) | |
| seed | No | Seed (omit to randomize) | |
| checkpoint | No | Checkpoint filename; auto-selected from local models if omitted | |
| batch_size | No | Number of images to generate |