Generate an image
generate_imageGenerates one image from a prompt, with an optional reference image and aspect ratio, and saves it to your FXI library. Spends credits. Returns the image URL when ready (usually within 25 seconds), or a generation id to check with get_generation (prefer its lifecycle_status field over the legacy status field). Uses the fast default model unless the user picks another one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Optional seed for repeatable results. | |
| model | No | Image model. Leave this out, or use "z-image-turbo" (fast, cheapest), unless the user names a model or asks for higher detail. Do not upgrade because the prompt sounds cinematic, premium or photoreal. Higher-detail options cost more: "nano-banana-2" (balanced) and "nano-banana-pro" (highest detail, about 9x the credits). Offer them by name with their price from list_models, and switch only when the user agrees. | |
| prompt | Yes | What the image should show. | |
| model_id | No | Deprecated alias of "model". Prefer "model". | |
| input_image | No | Optional reference image. Public https URL, or an asset_url from create_upload_url, upload_from_url or upload_media_data (used as-is). | |
| aspect_ratio | No | For example "16:9", "1:1" or "9:16". | |
| estimate_only | No | If true, returns the estimated credit cost for this exact request and does NOT generate anything or spend any credits. | |
| idempotency_key | No | Optional. Reuse the same key to retry safely: the earlier result is returned and nothing is charged twice. | |
| last_frame_image | No | Optional end image (models that support it). Public https URL, or an asset_url from create_upload_url, upload_from_url or upload_media_data (used as-is). | |
| first_frame_image | No | Optional start image (models that support it). Public https URL, or an asset_url from create_upload_url, upload_from_url or upload_media_data (used as-is). |