# Gemini 3.1 Flash Image Preview (Nano Banana 2)

Improved visual quality at flash-tier speed: Gemini 3.1 Flash Image Preview (Nano Banana 2) Preview adds real-world image search grounding, configurable thinking depth, and expanded resolution and aspect ratio support to the flash-tier image generation lineup.

- **Model ID:** `google/gemini-3.1-flash-image-preview`
- **Type:** chat
- **Providers:** google
- **Context window:** 131,072
- **Maximum output tokens:** 32,768
- **Pricing:** $0.5/1M input tokens, $3/1M output tokens
- **Canonical page:** https://vercel.com/ai-gateway/models/gemini-3.1-flash-image-preview

## Supported parameters

- **Parameters:** `temperature`, `tools`, `tool_choice`, `response_format`, `reasoning`, `media_resolution`, `topP`, `maxOutputTokens`, `responseModalities`, `imageConfig`
- **Operations:** Not reported
- **Input modalities:** `text`, `image`, `video`, `audio`, `pdf`
- **Output modalities:** `text`, `image`
- **Aspect ratios:** Not reported
- **Resolutions:** Not reported
- **Durations:** Not reported
- **Frame rates:** Not reported
- **Maximum outputs per request:** Not reported
- **Maximum input images:** Not reported
- **Input image formats:** Not reported
- **Maximum input image size:** 7 MB

## Example

```ts
import { generateText } from 'ai'

const result = await generateText({
  model: 'google/gemini-3.1-flash-image-preview',
  prompt: 'Render a picture of a red balloon.',
});
```

## About

Gemini 3.1 Flash Image Preview (Nano Banana 2) Preview, codenamed Nano Banana 2, advances over the prior flash-tier image model with improved visual quality while preserving the generation speed and cost profile that makes flash-tier models viable for production workloads. Three feature additions meaningfully expand what flash-tier image generation can do.

The first is Google Image Search grounding. The model can retrieve live visual reference data from Google's index at generation time, which allows it to render lesser-known landmarks, brand-specific objects, and recent real-world subjects accurately. The second addition is configurable thinking levels. Gemini 3.1 Flash Image Preview (Nano Banana 2) Preview introduces `Minimal` and `High` thinking modes, enabling the model to reason through complex prompts before rendering. The third addition is expanded output options: 512p resolution and 1:4 and 1:8 aspect ratios join the existing format options, opening the model to narrow-format creative assets like banners and vertical media strips.

## What to consider

This is a multimodal model: use `streamText` or `generateText` and specify `responseModalities: ['TEXT', 'IMAGE']` in `providerOptions.google` to receive image output. You can also set `thinkingConfig.thinkingLevel` to `'minimal'` or `'high'` to control reasoning depth per request.

## When to use

### Best For
- Image generation tasks that require grounding in current real-world subjects, landmarks, or recent events
- Technical diagram generation where configurable thinking depth improves spatial accuracy and label placement
- Creative asset production requiring unusual aspect ratios (1:4, 1:8) or 512p resolution
- Workloads that need both text and image output in a single multimodal response at flash-tier cost
- Rapid iteration on complex visual prompts using the `Minimal` thinking level to balance speed and reasoning

### Consider Alternatives When
- Your workflow demands the highest available image quality and supports pro-tier latency and cost (consider `google/gemini-3-pro-image`)
- You need a pure image generation API without multimodal text output (consider `google/imagen-4.0-generate-001`)
- Your prompts are straightforward enough that thinking levels and search grounding add unnecessary overhead
- You require video output rather than still images (consider the Veo model family)

## Best for

- **Real-world grounded imagery:** Image generation tasks that require grounding in current subjects, landmarks, or recent events
- **Technical diagram generation:** Configurable thinking depth improves spatial accuracy and label placement
- **Unusual aspect ratios:** Creative asset production requiring 1:4, 1:8 ratios or 512p resolution
- **Multimodal text and image output:** Single-response workloads at flash-tier cost
- **Rapid complex visual iteration:** Using the `Minimal` thinking level to balance speed and reasoning

## Consider alternatives

- **Highest image quality required:** Your workflow supports pro-tier latency and cost (consider `google/gemini-3-pro-image`)
- **Pure image generation API:** You do not need multimodal text output (consider `google/imagen-4.0-generate-001`)
- **Simple prompts:** Thinking levels and search grounding add unnecessary overhead
- **Video output required:** Still images are not sufficient (consider the Veo model family)

## 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?

`minimal` and `high`. Use `minimal` when speed is the priority and the prompt is relatively straightforward. Use `high` when 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 `streamText` from the AI SDK with `responseModalities: ['TEXT', 'IMAGE']` in `providerOptions.google`.

### Do I need to set `responseModalities` explicitly?

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: true` return?

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.

## Links

- [Model page](https://vercel.com/ai-gateway/models/gemini-3.1-flash-image-preview)
- [AI Gateway documentation](https://vercel.com/docs/ai-gateway)
- [Provider model documentation](https://cloud.google.com/vertex-ai)
- [Provider pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing)
