For the complete documentation index, see llms.txt. This page is also available as Markdown.

Gemini 2.5 Flash Image Edit (Nano Banana)

This documentation is valid for the following list of our models:

  • google/gemini-2.5-flash-image-edit

Model Overview

The model takes multiple images as input, with the prompt defining how they are used or combined.

Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.

API Schema

Aspect ratio/Resolution Table
Aspect ratio
Resolution
Credits

1:1

1024×1024

84 000

2:3

832×1248

84 000

3:2

1248×832

84 000

3:4

864×1184

84 000

4:3

1184×864

84 000

4:5

896×1152

84 000

5:4

1152×896

84 000

9:16

768×1344

84 000

16:9

1344×768

84 000

21:9

1536×672

84 000

post
Body
modelstring · enumRequiredPossible values:
promptstringRequired

The text prompt describing the content, style, or composition of the image to be generated.

image_urlsstring · uri[] · max: 3Optional

List of URLs or local Base64 encoded images to edit.

aspect_ratiostring · enumOptional

The aspect ratio of the generated image. It is taken from this parameter or from the provided reference image. If the parameter is not set and no reference image is provided, the default value is 16:9.

Possible values:
enhance_promptbooleanOptional

Optional parameter to use an LLM-based prompt rewriting feature for higher-quality images that better match the original prompt. Disabling it may affect image quality and prompt alignment.

Default: true
num_imagesinteger · max: 4Optional

The number of images to generate.

Default: 1
seedinteger · max: 4294967295Optional

The same seed and the same prompt given to the same version of the model will output the same image every time.

person_generationstring · enumOptional

Allow generation of people.

Default: allow_adultPossible values:
safety_settingstring · enumOptional

Adds a filter level to safety filtering.

Default: block_medium_and_abovePossible values:
add_watermarkbooleanOptional

Add an invisible watermark to the generated images.

Default: false
convert_base64_to_urlbooleanOptional

If True, the URL to the image will be returned; otherwise, the file will be provided in base64 format.

Default: true
providerstringOptional

Provider routing override. google runs native Google with no fallback; fal runs the fal.ai mirror; auto (default) uses the Google -> fal.ai fallback chain. Case-insensitive.

Example: auto
Responses
200

Successful response.

application/json
post/v1/images/generations
curl --request POST \
  --url 'https://api.aimlapi.com/v1/images/generations' \
  --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{"model": "google/nano-banana-edit", "prompt": "Describe what you want the model to generate."}'
200

Successful response.

{
  "data": [
    {
      "url": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png",
      "b64_json": null
    }
  ],
  "meta": {
    "usage": {
      "credits_used": 120000,
      "usd_spent": 0.06
    }
  }
}

Quick Example

Let's generate an image using two input images and a prompt that defines how they should be edited.

Response
Reference Images
Generated Image

Image #1

"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect."

Image #2

Last updated

Was this helpful?