Gemini 3.1 Flash Image Preview (Nano Banana 2)
Gemini 3.1 Flash Image (Nano Banana 2) is optimized for image understanding and generation and offers a balance of price and performance.
const response = await fetch('https://api.minirouter.sh/v1/chat/completions', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MINIROUTER_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'google/gemini-3.1-flash-image-preview', messages: [{ role: 'user', content: 'Why is the sky blue?' }], }),}) const data = await response.json()console.log(data.choices[0].message.content)Overview
- Model type
- language
- Context window
- 131,072
- Maximum output
- 32,768
- Input / 1M tokens
- $0.525
- Output / 1M tokens
- $3.15
- Released
- 2026-02-26
Prices include the MiniRouter fee. Compatibility snapshot: 2026-08-06. Input: text, image. Output: text, image.
Endpoints
/v1/chat/completions/v1/messages/v1/responsesPlatform-funded routing only. Caller BYOK credentials and OIDC-based upstream authentication are intentionally excluded; authenticate with a MiniRouter bearer key.
Captured parameters: max_tokens, temperature, stop, reasoning, include_reasoning.
API
Use the setup panel above to switch between Chat Completions, Messages, and client configurations. Every snippet keeps the model ID unchanged.
https://api.minirouter.sh/v1google/gemini-3.1-flash-image-previewProviders
MiniRouter selects from the configured routes below. Priority is the catalog order, not a latency or availability score.
| Provider | Priority | Input / 1M | Output / 1M | Parameters | Access |
|---|---|---|---|---|---|
vercel | 1 | $0.525 | $3.15 | max_tokens, temperature, stop, reasoning, include_reasoning | MiniRouter balance |