Skip to content
Google · Released 2026-02-28

Nano Banana 2 (Gemini 3.1 Flash Image Preview)

Text → ImageImage → Image

Gemini 3.1 Flash Image Preview (“Nano Banana 2”) is Google’s next-generation image generation and editing model, combining Pro-level visual quality with Flash-level speed and cost efficiency. It delivers stronger contextual understanding, high-fidelity image creation, and fast iterative editing for a wide range of creative and production workflows. Developers can customize output composition and aspect ratios through the image_config API parameter.

google/gemini-3.1-flash-image-preview

Official example

Input
Prompt

将画面中的男性替换为女性,该女性手持香蕉

Output

Parameters

Derived from the model input schema
ParameterTypeDefaultDescription
promptRequiredstring提示词
aspect_ratiostring1:1宽高比1:1 · 1:4 · 1:8 · 3:2 · 2:3 · 3:4 …
response_modalitiesarrayIMAGE响应模态
sizestring1K图像大小0.5K · 1K · 2K · 4K
imageRequiredstring图片Url
imagesRequiredarray图片Url数组1 – 10

API example

Submit a generation task, then poll for the result — one API key for every model.

Get API Key Get API Key
# Submit task
curl https://router-integration.test.cogfoundry.ai/api/v1/tasks/generations \
  -H "Authorization: Bearer $MODEL_CENTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "google/gemini-3.1-flash-image-preview",
  "aspect_ratio": "16:9",
  "image": "https://oss.shengsuanyun.com/example/modelinfo/283/input_0.jpg",
  "prompt": "将画面中的男性替换为女性,该女性手持香蕉",
  "response_modalities": [
    "IMAGE"
  ],
  "size": "1K"
}'

# Poll result(REQUEST_ID 来自上一步返回的 data.request_id)
curl https://router-integration.test.cogfoundry.ai/api/v1/tasks/generations/REQUEST_ID \
  -H "Authorization: Bearer $MODEL_CENTER_API_KEY"

Pricing

USD · live rate
PricingUSD
Input$0.50
输入图像$0.50
Output$3.00
输出图像$60.00

Providers

Channels serving this model
Provider From
Google Vertex $0.50
OpenRouter $0.50

More from Google