
Gemini 3.1 Flash Image Preview (Nano Banana 2) is now available on AI Gateway.
This release improves visual quality while maintaining the generation speed and cost of flash-tier models.
Nano Banana 2 can use Google Image Search to ground outputs in real-world imagery. This helps with rendering lesser-known landmarks and objects by retrieving live visual data. This model also introduces configurable thinking levels (Minimal and High) to let the model reason through complex prompts before rendering. New resolutions and new aspect ratios (512p, 1:4 and 1:8) are available alongside the existing options to expand to support more types of creative assets.
To use this model, set model to google/gemini-3.1-flash-image-preview in the AI SDK. Nano Banana 2 is a multimodal model. Use `streamText` or `generateText` to generate images alongside text responses. This example shows how the model can use web search to find live data.
You can also change the thinking level: in this example, thinking is set to high for a more thorough response.
AI Gateway provides a unified API for calling models, tracking usage and cost, and configuring retries, failover, and performance optimizations for higher-than-provider uptime. It includes built-in observability, Bring Your Own Key support, and intelligent provider routing with automatic retries.
Learn more about AI Gateway, view the AI Gateway model leaderboard or try it in our model playground.