invokeai_generate
Generate images with local InvokeAI through text prompts, image-to-image, masked inpainting, or 4x upscaling. Jobs enqueue asynchronously; poll the queue to retrieve results.
Instructions
Generate images through the local InvokeAI creative engine.
[RATIONALE] All generation paths share one enqueue flow (graph build -> queue batch), so they live under a single portmanteau with an operation discriminator instead of four near-identical tools.
txt2img: text prompt to a fresh image.
img2img: transform an existing image (needs image_name, uses strength).
inpaint: regenerate a masked region (needs image_name + mask_image_name).
upscale: RealESRGAN 4x upscale of an existing image (needs image_name).
The job is enqueued and runs asynchronously; poll completion with invokeai_queue(operation="item_status" or "result").
Return Format
{"success": bool, "queue_item_id": int, "batch_id": str, "message": str, "poll": {"tool": "invokeai_queue", "args": {...}}}
Examples
invokeai_generate(operation="txt2img", prompt="neon cyberpunk city at night, rain") invokeai_generate(operation="img2img", prompt="make it a watercolor painting", image_name="abc123.png", strength=0.6) invokeai_generate(operation="upscale", image_name="abc123.png")
Notes:
InvokeAI must be running (onboarding) and a main model installed.
Model base determines graph family: sd-1, sdxl, flux.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| runs | No | Number of images to generate (1-8). | |
| seed | No | Random seed for reproducibility. Omit for a random seed. | |
| steps | No | Denoising steps (1-150). | |
| width | No | Image width in pixels. | |
| height | No | Image height in pixels. | |
| prompt | Yes | Positive prompt describing the desired image. | |
| strength | No | img2img/inpaint transformation strength (0.0-1.0). | |
| cfg_scale | No | Prompt guidance scale (1.0-20.0). | |
| model_key | No | Model key or name from invokeai_models. Defaults to first main model. | |
| operation | Yes | Generation operation to run. | |
| scheduler | No | Sampling scheduler. | euler |
| image_name | No | Source image for img2img / inpaint / upscale (InvokeAI image_name). | |
| mask_image_name | No | Mask image for inpaint (white = regenerate region). | |
| negative_prompt | No | Elements to avoid in the image. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||