# Gemini API image generation (Nano Banana / Imagen) — card for AI agents

Gemini image models (Nano Banana) for generation and editing via the Gemini API.

Maker: Google · category: Image generation APIs

## Price (official page)
- Free tier: none listed
- Usage price: Nano Banana 2.1: $0.0336 per 1K image, $0.0504 per 2K, $0.113 per 4K
- Pricing page: https://ai.google.dev/gemini-api/docs/pricing (checked 2026-10-09)
- Note: Imagen 4 endpoints are deprecated and shut down on August 17, 2026; it no longer appears on the pricing page. Image output is $30 per 1M tokens (Batch $15). Free tier 'Not available' for image models. Gemini 3.1 Flash Image: $0.067 per 1K image.

## Connect
- npm: `npm install @google/genai`
- PyPI: `pip install google-genai`
- Repository: https://github.com/googleapis/js-genai

## For AI agents on Google's own site (AgentGid check 2026-11-13: 3 of 6)
- llms.txt: none found
- OpenAPI description: none found at the usual places
- Official MCP server: no · official SDK: yes · status page: yes
- robots.txt lets AI assistants (ChatGPT-User, Claude-User) read the site: yes

## A year of price history (Internet Archive copies of the pricing page, read by rules)
- Months read: 14 (2025-10 to 2026-11) of https://ai.google.dev/gemini-api/docs/pricing
- A figure is any "$X/month" on the page (plans, seats and add-ons alike); open the archived copy to see which plan it is.

## Price history in AgentGid's catalog (since 2026-10-09)
- Changes recorded: 0 (a vendor price change or an editor's correction; the evidence archive keeps the pricing page of each date)

## Other APIs in this category
- OpenAI Image API (GPT Image): https://agentgid.com/apis/openai-gpt-image/agent.md
- Leonardo API: https://agentgid.com/apis/leonardo/agent.md
- Prodia: https://agentgid.com/apis/prodia/agent.md
- Recraft API: https://agentgid.com/apis/recraft/agent.md
- FLUX API: https://agentgid.com/apis/bfl-flux/agent.md

## Links
- AgentGid page: https://agentgid.com/apis/google-gemini-image/


## Gemini image models (Nano Banana): make and edit pictures

Nano Banana is the name for Google's Gemini image models. Your app describes a picture in words, or sends a photo with a change to make, and gets back a finished image. It can mix several reference pictures, write readable text into the image, and make large images; every image carries an invisible Google watermark.

### Where to use it
- Product photos for your shop: Make clean product shots for an online shop, an ad or a brand page from a short description.
- Edit a photo with words: Upload a photo and ask to remove an object, add something, change the style or adjust the colors.
- Logos, menus and infographics: Make images that contain readable words, such as a cafe menu, a simple logo idea or a diagram for a post.
- Backgrounds for websites and slides: Make a calm background picture with empty space where your page title or slide text will go, in a wide format.
- Comic panels and storyboards: Draw a short story in several panels with the same characters, for a comic, a lesson or a video plan.
- Cover images for blog posts: Make a matching cover picture for each new article from its title, in the same style every time. (idea, not from the official pages)

### How to start
- Get a Gemini API key in Google AI Studio and set up billing; the image models have no free tier.

```
export GEMINI_API_KEY="YOUR_API_KEY"
```

- Install the official Google GenAI package.

```
pip install -U google-genai
```

- Ask a Nano Banana model for an image and save the returned picture to a file.

```
from google import genai
import base64
client = genai.Client()
interaction = client.interactions.create(
 model="gemini-3.1-flash-image",
 input="Generate an image of a futuristic city skyline at sunset",
)
with open("generated_image.png", "wb") as f:
 f.write(base64.b64decode(interaction.output_image.data))
```


### License
It is a paid Google service, meant for business use by adults. Google does not claim ownership of the images, but may make similar ones for others. You need the rights to any photo you upload, and every image carries a hidden watermark.

### Good to know
- There is no free tier for the image models; every image is paid.
- Older Imagen models are shut down; use the Nano Banana models instead.
- The model may not make the exact number of pictures you ask for.
- Images count against a separate per-minute image limit on top of request limits.
- Requests that break the safety rules are blocked and return no image.

Checked 2026-11-10 against: https://aistudio.google.com/docs/image-generation, https://aistudio.google.com/docs/get-started, https://aistudio.google.com/docs/pricing, https://aistudio.google.com/docs/rate-limits, https://aistudio.google.com/docs/api-errors, https://aistudio.google.com/docs/api-key, https://aistudio.google.com/docs/terms, https://aistudio.google.com/docs/zdr, https://aistudio.google.com/docs/models, https://aistudio.google.com/docs/troubleshooting, https://aistudio.google.com/docs/libraries, https://aistudio.google.com/docs/billing, https://aistudio.google.com/docs/coding-agents, https://pypi.org/pypi/google-genai/3.0.0/json

### Mistakes to avoid
- Don't: Calling an Imagen model such as imagen-4.0-generate. → Do: Use a Nano Banana model, for example gemini-nano-banana-2.1. (Imagen is shut down on the Gemini API.)
- Don't: Asking for a long headline and the image in one step and getting misspelled text. → Do: First generate the exact text, then ask for an image that uses that text. (The docs say this order works best.)
- Don't: Reading only output_image when the answer mixes text and several pictures, such as an illustrated story. → Do: Loop over interaction.steps and save every image block. (The convenience property returns only the last image.)
- Don't: Asking Nano Banana 2.1 for small 512px images to save money. → Do: Use gemini-3.1-flash-image for 512px, or 1K on Nano Banana 2.1. (The 0.5K size is not supported on Nano Banana 2.1.)
- Don't: Calling the image model from browser code with the key inside. → Do: Generate on your server and send the finished image (or its stored address) to the page. (Keys in web or mobile apps can be extracted and spent by anyone.)

### Questions
- Is there a free tier for images? No. The pricing page lists the image models as not available on the free tier, so you need billing set up.
- Which model should I start with? Google recommends Nano Banana 2.1 for new projects; Nano Banana Pro is the premium choice for complex layouts and text.
- Are the images marked as AI-made? Yes. Every generated image carries a SynthID watermark.
- Can I choose the shape and size of the image? Yes, with aspect_ratio and image_size; by default the output matches your input image or is square.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
