Generate an image
generate_imageGenerate an image from a text prompt, optionally guided by reference images (image-to-image). Returns image URLs directly. Most models finish in 10-60 seconds; if your client times out, set async=true to get a task_id you can poll instead. This call costs money — do not retry speculatively.
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": {
"model": "<model>",
"prompt": "<prompt>"
},
"name": "generate_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | How many images to generate. Defaults to 1. Each one is billed. | |
| size | No | Output size, e.g. 1024x1024, 1536x1024, or 'auto'. Model-dependent; omit for the model default. | |
| async | No | Submit asynchronously and return a task_id instead of waiting. Use when the client times out on slow models; poll with get_task using platform 'image'. | |
| model | Yes | Exact model name, e.g. gpt-image-2 or nano-banana-pro. Call list_models with category 'image' if unsure. | |
| images | No | Optional reference images as HTTPS URLs or data URLs, for image-to-image generation. Not all models accept references. | |
| prompt | Yes | Description of the image to generate. | |
| quality | No | Quality hint, e.g. low, medium, high or auto. Model-dependent. | |
| aspect_ratio | No | Z-Image only: required output aspect ratio. Supported values: 1:1, 4:3, 3:4, 16:9, 9:16. | |
| nsfw_checker | No | Z-Image only: enable or disable the upstream NSFW checker. Explicit false is preserved. | |
| wait_seconds | No | Only with async: poll server-side for up to this many seconds (max 240) and return the finished image if it completes in time. | |
| response_format | No | 'url' (default) returns links; 'b64_json' returns base64 data, which is far larger and usually unnecessary. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | What to do next. | |
| model | Yes | Model that served the request. | |
| images | No | Generated images, when the call completed. | |
| status | Yes | One of: completed, queued, in_progress, failed. | |
| task_id | No | Task identifier, when submitted asynchronously and still running. | |
| platform | No | Pass this to get_task together with task_id. |