Google released
gemini-3.1-flash-image as the GA model for Nano Banana 2 on May 28, 2026. Use this stable model ID instead of gemini-3.1-flash-image-preview, which is deprecated and scheduled to shut down on June 25, 2026.Key capabilities
- Text-to-image — Generate images from text descriptions
- Image editing — Pass a reference image in
inline_dataalongside your text instruction - Aspect ratio control —
1:1,4:3,3:4,16:9,9:16 - Resolution control —
512(512px),1K(~1024px),2K(~2048px),4K(~4096px) on the long edge - Multi-modal output — Return both the image and a text caption with
responseModalities: ["TEXT", "IMAGE"]
Note: If you need the generated image returned as a URL, select the Aggregate-NanoUrl group when creating your API token.
Text-to-image example
Image editing example (with reference image)
Include both atext instruction and an inline_data reference image in the same parts array.
Parameters
API Reference
View the interactive API playground for Gemini 3.1 Flash Image.