# Nano Banana 2.1

> Closed-weight Google model accepting text and image input, with tool calling, reasoning mode and structured output. It has no benchmark results, and its blended price sits well above the registry median.

Use it with Pydantic AI as `gateway/google-cloud:gemini-nano-banana-2.1`.

## Spec sheet

- **Family:** Gemini
- **Released:** 6 Oct 2026
- **Weights:** closed
- **Context window:** 65,536 tokens
- **Largest response:** 58,982 tokens
- **Accepts:** text, image
- **Tool calling:** yes
- **Knowledge cutoff:** unknown
- **Intelligence index:** not enough benchmark results yet
- **Price:** $1.5 input, $7.5 output, $3 blended per 1M tokens
- **Index points per $:** – (rank –)
- **Speed:** – (rank –)
- **Popularity:** rank 150 of 194 by usage
- **Pydantic AI Gateway:** built in

## Benchmarks

No results yet on the benchmarks we track.

## Providers and prices

US dollars per million tokens.

| Provider | Gateway | Pydantic AI string | Input | Cached input | Output |
| --- | --- | --- | --- | --- | --- |
| Google Vertex | built in | `gateway/google-cloud:gemini-nano-banana-2.1` | $1.5 | – | $7.5 |
| OpenRouter | BYOK | `openrouter:google/gemini-nano-banana-2.1` | $1.5 | – | $7.5 |

## Example code

### hello.py

Ask Nano Banana 2.1 a question with a Pydantic AI agent and print the answer. Run it with uv run hello.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os

from pydantic_ai import Agent

os.environ['PYDANTIC_AI_GATEWAY_API_KEY'] = '...'

agent = Agent('gateway/google-cloud:gemini-nano-banana-2.1', instructions='Be concise, reply with one sentence.')

result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
```

### structured_output.py

Get validated, typed output from Nano Banana 2.1 by giving the agent a Pydantic model. Run it with uv run structured_output.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os

from pydantic import BaseModel
from pydantic_ai import Agent

os.environ['PYDANTIC_AI_GATEWAY_API_KEY'] = '...'


class CityLocation(BaseModel):
    city: str
    country: str


agent = Agent('gateway/google-cloud:gemini-nano-banana-2.1', output_type=CityLocation)

result = agent.run_sync('Where were the olympics held in 2012?')
print(result.output)
#> city='London' country='United Kingdom'
```

### tools.py

Give Nano Banana 2.1 two tools to call, one of which reads the agent's dependencies. Run it with uv run tools.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os
import random

from pydantic_ai import Agent, RunContext

os.environ['PYDANTIC_AI_GATEWAY_API_KEY'] = '...'

agent = Agent(
    'gateway/google-cloud:gemini-nano-banana-2.1',
    deps_type=str,
    instructions="You're a dice game, roll the die and see if it matches the user's guess.",
)


@agent.tool_plain
def roll_dice() -> str:
    """Roll a six-sided die and return the result."""
    return str(random.randint(1, 6))


@agent.tool
def get_player_name(ctx: RunContext[str]) -> str:
    """Get the player's name."""
    return ctx.deps


result = agent.run_sync('My guess is 4', deps='Anne')
print(result.output)
```

### streaming.py

Stream Nano Banana 2.1's reply to the terminal as it is generated. Run it with uv run streaming.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import asyncio
import os

from pydantic_ai import Agent

os.environ['PYDANTIC_AI_GATEWAY_API_KEY'] = '...'

agent = Agent('gateway/google-cloud:gemini-nano-banana-2.1')


async def main():
    async with agent.run_stream('Explain prompt caching in three bullet points.') as response:
        async for text in response.stream_text(delta=True):
            print(text, end='', flush=True)


asyncio.run(main())
```

### pax.sh

Chat with Nano Banana 2.1 in your terminal using pax, the TUI for pydantic-ai-harness. Coming soon.

```sh
export PYDANTIC_AI_GATEWAY_API_KEY='...'

uvx pax --model 'gateway/google-cloud:gemini-nano-banana-2.1'
```

### ai_sdk.ts

Call Nano Banana 2.1 from TypeScript with the Vercel AI SDK, through Pydantic AI Gateway.

```ts
// npm install ai @ai-sdk/google-vertex
import { createVertex } from '@ai-sdk/google-vertex'
import { generateText } from 'ai'

process.env.PYDANTIC_AI_GATEWAY_API_KEY = '...'

const googleCloud = createVertex({
  baseURL: 'https://gateway.pydantic.dev/proxy/google-vertex',
  apiKey: process.env.PYDANTIC_AI_GATEWAY_API_KEY,
})

const { text } = await generateText({
  model: googleCloud('gemini-nano-banana-2.1'),
  system: 'Be concise, reply with one sentence.',
  prompt: 'Where does "hello world" come from?',
})
console.log(text)
```

## About Nano Banana 2.1

Nano Banana 2.1 is a closed-weight model from Google, offered through Google Vertex and OpenRouter. It accepts text and image input and supports tool calling, reasoning mode and structured output. Its 65k-token context window is small, though responses can run to 58,982 tokens.

The registry holds no benchmark results for it, so its quality cannot be compared with other models. Pricing is $1.5 per million input tokens and $7.5 per million output tokens, giving a blended price of $3, roughly three times the registry median of about $1.

Its popularity ranks 150 of 194 and its price ranks 132 of 194. No knowledge cutoff is recorded. It is built into the Pydantic AI Gateway, so it can be used there without a separate integration.

**Strengths**

- Supports tool calling, reasoning mode and structured output
- Accepts both text and image input
- Responses can run to 58,982 tokens, the largest response length listed
- Built into the Pydantic AI Gateway

**Weaknesses**

- No benchmark results, so its quality cannot be ranked
- Blended price of $3 per million tokens, about three times the median
- Context window of 65k tokens is small for long documents

**Best for:** Agents that need tool calling, image input and structured output, and can proceed without benchmark evidence.

Prices come from [genai-prices](https://github.com/pydantic/genai-prices), in US dollars per million tokens. Benchmark scores come from Epoch AI and LMArena (CC BY 4.0); the index and its sources are described at https://models.pydantic.dev/methodology.md. Data built 2026-11-25. Compare with other models: https://models.pydantic.dev/models.md
