Nano Banana 2 overview
Nano Banana 2 specs
- Model ID
google/gemini-3.1-flash-image-preview- Developer
- Context window
- 131,072 tokens
- Max output
- 32,768 tokens
- Input
- Image, Text
- Output
- Image
- API
- OpenAI-compatible, base URL
https://api.aimlapi.com/v1
Nano Banana 2 is a compact text-to-image model from Google optimized for fast image generation.
High-volume image generation
Produce product visuals, thumbnails, and marketing assets programmatically at scale.
Creative and concept art
Turn text prompts into illustrations, mockups, and design explorations.
Image editing and variations
Provide a reference image to guide edits, restyles, or variations.
Use cases
Nano Banana 2 is documented as suited for text-to-image generation, including creating images from prompts with strong image understanding and generation capabilities.
It is also suited for image-guided editing and iterative image refinement, including multi-turn workflows where a user can keep adjusting the result across turns.
The model is documented for creating clear text-heavy visuals such as posters, marketing mockups, and diagrams.
It is also suited to producing more accurate grounded imagery, including infographics and historically or factually informed scenes.
Capabilities
- Reasoning
- Image editing
- Vision
Nano Banana 2 API pricing
| Usage | Price | Unit |
|---|---|---|
| Input | $0.25 | 1M tokens |
| Output | $60 | 1M tokens |
Prices from the AI/ML API price list, checked on Nov 4, 2026.
Nano Banana 2 vs other models: token prices
AI/ML API input and output rates for 5 models, per million tokens.
| Model | Input | Output |
|---|---|---|
| $0.25 | $60 | |
| $0.3 | $2.5 | |
| $0.75 | $3.75 | |
| $0.75 | $3.75 | |
| $2 | $10 |
How to use the Nano Banana 2 API
View docsBuild with your agent
Give your agent the model details, code and documentation.
1Get your API key
Create API keyexport AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"2Make your first request
curl 'https://api.aimlapi.com/v1/chat/completions' \
-H "Authorization: Bearer $AIMLAPI_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "google/gemini-3.1-flash-image-preview",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}'import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['AIMLAPI_KEY']}",
"Content-Type": "application/json",
}
payload = {
"model": "google/gemini-3.1-flash-image-preview",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}
response = requests.post("https://api.aimlapi.com/v1/chat/completions", headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.aimlapi.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "google/gemini-3.1-flash-image-preview",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());Related articles
Nano Banana 2 FAQ
What inputs and outputs does Nano Banana 2 support?
Nano Banana 2 takes image, text as input and returns image.
When was Nano Banana 2 released?
Nano Banana 2 became available on February 27, 2026.
How much does Nano Banana 2 cost?
Nano Banana 2 costs $0.25 input and $60 output per 1M tokens on AI/ML API, billed as you go with no subscription.
How is Nano Banana 2 billed?
Nano Banana 2 is billed per token, charged separately for input and output.
Can Nano Banana 2 edit an existing image?
Yes, Nano Banana 2 supports image editing as well as generation.
Can Nano Banana 2 take an existing image as input?
Yes, Nano Banana 2 accepts image input as well as a text prompt.
Who created Nano Banana 2?
Nano Banana 2 was built by Google.
How do I call Nano Banana 2 on AI/ML API?
Send a request to https://api.aimlapi.com/v1/images/generations with google/gemini-3.1-flash-image-preview as the model id.
Is Nano Banana 2 available through a single API key?
Yes. Nano Banana 2 is served through AI/ML API, so the same key and endpoint format used for other models applies.
What is the Nano Banana 2 model ID?
Use google/gemini-3.1-flash-image-preview as the model parameter. Requests go to the OpenAI-compatible endpoint with your AI/ML API key.


.webp)