generate_image
Create images from text prompts or edit existing images with reference images, masks, and denoise controls for offline GPU-based generation.
Instructions
Generate images from a text prompt, optionally guided by reference images.
Without reference_images the default model is Z-Image Turbo (1024x1024, 8 steps). reference_images: up to 4 local image paths to edit or combine; the prompt says what to do with them (for example "change the jacket to red", "the person from image 1 in the setting of image 2"). This uses FLUX.2 Klein 4B; output size follows the first reference unless width and height are given. input_image: a local image to start from (image to image) instead of noise. The output keeps its size (width and height are not allowed); it is worked on at about 1 megapixel. The prompt describes the whole desired result, not only the change. denoise (0.05 to 1.0, needs input_image): how much may change. Z-Image Turbo default 0.6. Z-Image holds on to the input strongly: 0.3 and 0.6 change only fine detail, 0.9 keeps the layout but changes colours and materials, 1.0 ignores the input (except outside a mask). mask_image (needs input_image): a black and white image, white = change, black = keep; any size (it is stretched to input_image). Only the white area is regenerated, and the result is pasted back over input_image with an 8 pixel feathered edge, so every pixel more than about 18 px outside the white area is exactly the original. To replace what is in the region use denoise 1.0; to recolour an object, Klein (model="flux2-klein-4b") follows the prompt better than Z-Image at 0.9, which keeps some of the old colour. input_image with reference_images (or model="flux2-klein-4b"): FLUX.2 Klein edits input_image as image 1 and the references are images 2 to 4 (at most 3), for example "give the person in image 1 the hat from image 2"; Klein's denoise default is 1.0 (a full edit guided by image 1), and mask_image limits it to a region the same way. count > 1 queues all images at once (one model load); seeds are seed, seed+1, ... Returns absolute PNG paths, the seeds and settings used, timings and the effective backend idle timeout. Default output folder: /ai/output/localgen/image//. idle_timeout_seconds: keep the backend up this long after the last call (bounded, default 300).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "generate_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| count | No | ||
| model | No | ||
| steps | No | ||
| width | No | ||
| height | No | ||
| prompt | Yes | ||
| denoise | No | ||
| mask_image | No | ||
| output_dir | No | ||
| input_image | No | ||
| reference_images | No | ||
| idle_timeout_seconds | No |