Gemini 3.1 Flash Image Preview (Nano Banana 2)
Gemini 3.1 Flash Image Preview (Nano Banana 2) Preview (Nano Banana 2) improves visual output quality at flash-tier speed, adding Google Image Search grounding, configurable thinking levels, and new resolution and aspect ratio options including 512p and ultra-wide formats.
import { generateText } from 'ai'
const result = await generateText({ model: 'google/gemini-3.1-flash-image-preview', prompt: 'Render a picture of a red balloon.',});Frequently Asked Questions
How does Google Image Search grounding work in this model?
At generation time, the model can query Google's image index to retrieve live visual data for the subject you describe. This improves rendering accuracy for subjects that may not be well-represented in static training data, such as specific real-world locations or recent events.
What are the available thinking levels and when should I use each?
minimalandhigh. Useminimalwhen speed is the priority and the prompt is relatively straightforward. Usehighwhen the prompt requires precise spatial reasoning, complex diagram layout, or multi-element compositions where reasoning before rendering reduces errors.What new aspect ratios are available in Gemini 3.1 Flash Image Preview (Nano Banana 2) Preview?
1:4 and 1:8 aspect ratios alongside 512p resolution. These expand the model's usefulness for narrow-format creative assets such as web banners, vertical strips, and other non-standard formats.
Does this model support streaming?
Yes. Use
streamTextfrom the AI SDK withresponseModalities: ['TEXT', 'IMAGE']inproviderOptions.google.Do I need to set
responseModalitiesexplicitly?Yes. Because this is a multimodal model, you must include
responseModalities: ['TEXT', 'IMAGE']in the provider options to receive image output. The model will not emit images without this configuration.How does this model compare to Gemini 3 Pro Image?
Gemini 3 Pro Image targets professional and creative workflows with higher resolution, higher multi-image input limits, and more advanced compositing support. Gemini 3.1 Flash Image Preview (Nano Banana 2) Preview prioritizes generation speed and cost efficiency while adding grounding and thinking capabilities that were absent from the original flash-tier image model.
Can I use this model for real-time applications?
Yes, its flash-tier cost and speed profile are designed for production workloads. Using
thinkingLevel: 'minimal'minimizes additional latency from the reasoning step.What does
includeThoughts: truereturn?It streams the model's reasoning tokens before the generated image, giving visibility into how the model interpreted the prompt and planned the composition. This is useful for debugging prompts that produce unexpected output.