Generate or edit an image
generate_imageGenerate an image from a prompt, or edit/combine images by passing them as references. Each call is charged to the user. Call it once per request: the result is already shown to the user inline, so do not call it again to refine, retry or verify, and do not call show_images for it, unless the user asks for changes or more images. When the user wants several options or variations of the same idea, set count (up to 4) in this one call instead of calling it several times; each image is charged. Returns an asset_id for later edits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | How many images to make from this same prompt (1-4), each charged at the normal price. Use it when the user asks for several options or variations (e.g. "4 logo ideas"); otherwise leave it at 1. | |
| model | No | Model id. Default nano-banana-2.1. Map what the user names to one of these without calling list_models or asking which variant (first listed wins): nano-banana-2.1 (Nano Banana 2.1); nano-banana-2-lite (Nano Banana 2 Lite); nano-banana-pro (Nano Banana Pro); gpt-image-2.5 (GPT Image 2.5); gpt-image-2.5-fast (GPT Image 2.5 Fast); flux-3 (FLUX.3); seedream-5-pro (Seedream 5.0 Pro); seedream-5-flash (Seedream 5.0 Flash); qwen-image-3 (Qwen Image 3); recraft-v4.1 (Recraft V4.1); recraft-v4.1-vector (Recraft V4.1 Vector); grok-imagine-2 (Grok Imagine 2.0). Call list_models only for advice, prices or models not listed. | nano-banana-2.1 |
| prompt | Yes | What to generate, or the edit to apply to the reference images. | |
| resolution | No | One of the model's resolutions in list_models (e.g. 1K, 2K, 4K). Ignored for models without resolutions. | |
| aspect_ratio | No | e.g. 1:1, 3:4, 16:9. Supported values depend on the model (list_models aspect_ratios); unsupported ones are mapped to the nearest supported ratio. Omit when editing to keep the first reference asset's ratio. | |
| reference_urls | No | Public https image URLs to use as references. | |
| reference_asset_ids | No | asset_ids of previous or uploaded images to edit or use as references. Max per model: list_models max_references. |