---
name: nano-banana
description: Generate images and videos with Nano Banana through its REST API or MCP server. Use when the user asks to create, edit or animate images or videos with Nano Banana, check a Nano Banana task, list its models and prices, or check the credit balance.
---

# Nano Banana

Nano Banana generates images and videos. Every generation spends the account's credits.

## Connect

- MCP server: `https://nanobanana0.com/api/mcp` (Streamable HTTP). Sign in with OAuth when the client offers it, or send `Authorization: Bearer nb0_...` with an API key that has "Allow MCP" turned on.
- REST API: `https://nanobanana0.com/api/v1`, with `Authorization: Bearer nb0_...`.
- API keys are created at https://nanobanana0.com/app/settings/api-keys. Never print a key or write it into files.

## MCP tools

- `nb_list_models` {kind?}: models, their parameters and credit prices.
- `nb_quote` {kind, prompt, ...}: validates and prices a generation without charging.
- `nb_generate_image` / `nb_generate_video` {prompt, model?, params?, count?, reference_ids?, mode?}: start a task; credits are charged up front and refunded for failed outputs.
- `nb_get_task` {id}: status and output URLs.
- `nb_get_balance`: credit balance.

## REST endpoints

| Method | Path | Purpose |
|---|---|---|
| POST | /images | Start an image task (202) |
| POST | /videos | Start a video task (202) |
| GET | /tasks/{id} | Task status and outputs |
| GET | /models | Models, parameters, prices |
| GET | /credits | Credit balance |

Body for POST: `prompt` (required, up to 4000 characters), `model`, `params`, `count`, `reference_ids` (up to 16), `mode` (text, image or reference), `dry_run` (true returns a quote and charges nothing).

```bash
curl -X POST https://nanobanana0.com/api/v1/images \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "a lighthouse at dawn", "dry_run": true}'
```

## Workflow

1. If cost matters, quote first (`nb_quote` or `dry_run: true`) and tell the user the total.
2. Start the task, then poll it every few seconds until `status` is `succeeded`, `partial` or `failed`.
3. Show the output URLs. For `partial`, say which outputs failed; their credits are refunded.

## Errors

Errors are `{"error": "...", "code": "..."}`: `invalid_request` and `model_unavailable` (400), `unauthorized` (401), `insufficient_credits` (402), `forbidden` (403), `not_found` (404), `rate_limited` (429, honour Retry-After), `upstream_unavailable` (502), `internal_error` (500). Each key allows 60 requests per minute.
