AI Generation

Nano Banana 2API

Nano Banana 2, formerly known as Gemini 3.1 Flash Image, is an AI image generation and editing model. It was released by Google in February 2026. It combines the capabilities of previous "Pro" models with the performance of Google’s Flash architecture.

Test in Dashboard View Docs ← All Tools

Three ways to use this tool

REST API

One POST request. Get the result back directly — as an image, video, or JSON depending on the tool.

terminal
curl -X POST https://apiai.me/api/workflow/nano-banana-2-2 \
     -H "X-API-Key: YOUR_API_KEY" \
     -F "image=@input.jpg" \
     -F "aspect_ratio=1:1" \
     -F "image_size=1K" \
     -F "max_output_tokens=VALUE" \
     -F "negative_prompt=VALUE" \
     -F "person_generation=allow_adult" \
     -F "PROMPT=VALUE" \
     -F "safety_filter_level=BLOCK_ONLY_HIGH" \
     -F "temperature=1" \
     -F "top_k=64" \
     -F "top_p=0.95"
     --output result.png

Dashboard Playground

Test this tool visually before writing any code. Upload an image, set parameters, and see the result live. When it looks right, copy the auto-generated curl command and paste it into your app.

  1. Open the dashboard → API Toolbox
  2. Find Nano Banana 2 and click it
  3. Upload your input and adjust parameters
  4. Copy the curl command and ship
Open Dashboard →

Batch Processing

Process hundreds of images at once without writing a loop. Upload a CSV with one row per item, set your parameters, and download the results as a ZIP when they're done.

  1. Open the dashboard → Batches
  2. Select Nano Banana 2
  3. Add your content and start the batch
  4. Download results ZIP when complete
Go to Batches →

Parameters

Name Required Description Default / Options
aspect_ratio optional Aspect ratio of the generated image 1:13:44:39:1616:9
image_size optional Output resolution. Nano Banana 2 (gemini-3.1-flash-image-preview): 512, 1K, 2K, 4K. Nano Banana Pro (gemini-3-pro-image-preview) and Imagen: 1K, 2K, 4K. Not supported by gemini-2.5-flash-image. 5121K2K4K
max_output_tokens optional Maximum output tokens (up to 65,536)
negative_prompt optional Elements or styles to exclude from the generated image
person_generation optional Allow people in the generated image (allow_all not permitted in EU/UK/CH/MENA) dont_allowallow_adultallow_all
PROMPT required Text prompt for the Gemini model
safety_filter_level optional Content safety filter level BLOCK_LOW_AND_ABOVEBLOCK_MEDIUM_AND_ABOVEBLOCK_ONLY_HIGHBLOCK_NONE
temperature optional Controls randomness (0 = deterministic, max 1) 1
top_k optional Top-K sampling: number of highest probability tokens to consider (max 64) 64
top_p optional Nucleus sampling: cumulative probability cutoff (0-1) 0.95

Ready to integrate?

Get an API key, test Nano Banana 2 in the dashboard, and copy the curl command.

Get API Key Full API Reference