generate_image
Generate a single image from a natural-language text prompt and save it to a chosen directory, with control over aspect ratio, resolution, seed, and PNG/JPG/WebP format.
Instructions
Generate a single image from a text prompt.
PROMPT WRITING RULES (call get_model_info first for model-specific guidance):
Write as natural language prose, NOT comma-separated tags.
Put the subject first (first 10-20 words carry the most weight).
Always describe lighting explicitly.
30-80 words ideal. Do NOT use quality tags like '8k, masterpiece'.
For photorealism: reference real cameras/lenses ('Shot on Sony A7IV, 85mm f/2.0').
For text in images: use quotation marks ('The sign reads "OPEN"').
Args: prompt: Natural language description of the image. Describe the subject first, then environment, style, and lighting. Be specific and descriptive. output_dir: Directory to save the image. Provide a path appropriate for the user's project (e.g. "./assets/images", "./public/img", "./output"). negative_prompt: What to avoid (only works with Qwen-Image models, ignored by FLUX). For Qwen, good defaults: 'blurry, low quality, distorted, watermark, oversaturated'. width: Image width in pixels (must be multiple of 16). height: Image height in pixels (must be multiple of 16). aspect_ratio: Shortcut for resolution, e.g. "16:9", "1:1", "9:16", "16:9_2k", "16:9_4k" (overrides width/height). FLUX Klein supports up to 4K. num_inference_steps: Number of diffusion steps (fewer = faster, more = higher quality). guidance_scale: CFG scale. For Qwen-Image: raise to 7.0 for text-heavy images. seed: Random seed for reproducibility. filename: Output filename (auto-generated if omitted). format: Output image format. Options: "png" (lossless, default), "jpg" (lossy, quality=95, good for general use), "webp" (lossy, quality=90, smallest files, ideal for web projects). Choose based on context.
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>",
"output_dir": "<output_dir>"
},
"name": "generate_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| width | No | ||
| format | No | png | |
| height | No | ||
| prompt | Yes | ||
| filename | No | ||
| output_dir | Yes | ||
| aspect_ratio | No | ||
| guidance_scale | No | ||
| negative_prompt | No | ||
| num_inference_steps | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |