Skip to main content
Model ID
Calling method: sync

Gemini Nano Banana 2.1 API Usage Guide

Overview

Gemini Nano Banana 2.1 is an update to Nano Banana 2 (Gemini 3.1 Flash Image) and the primary high-efficiency model for image generation and conversational editing. It keeps Flash-level speed and cost while improving visual quality, text rendering and multi-turn character consistency at 1K, 2K and 4K resolutions. It supports text-to-image, image-guided editing, and multi-turn iterative workflows via contents. Reference: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/models/gemini/nano-banana-2-1

Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header:

Submit Image Generation Request

Base URL

Endpoint

Request Format

Request Parameters

Response

Check Request Status

Endpoint

Example

Response

Request Status Values

List Your Requests

Endpoint

Example

Get Model Information

Endpoint

Example

List Available Models

Endpoint

Example

Gemini Native Interface (alternative)

In addition to the GMI-shape /requests endpoint above, this model accepts the Vertex-native generateContent shape — request body matches what Google’s generateContent uses. Customers already running on google-genai SDK or any HTTP client that follows Google’s REST contract can plug in by changing only the base_url and Authorization header. Notes for this model:
  • temperature, topP, topK and seed are not supported by Nano Banana 2.1 and are ignored.
  • thinkingConfig is not forwarded on this interface; the model uses its default thinking level (medium). Use the /requests endpoint with thinking to choose a level.
  • tools (including Google Search grounding) are not supported on this interface.

Endpoint

Curl example

google-genai SDK example

Multi-turn

Pass contents as user/model/user alternation. The last turn must be role: "user". Reference images on user turns go in parts[].inlineData (base64) — same field shape as Google’s generateContent.

Multi-turn Conversation (Iterative Image Editing)

This model supports multi-turn conversations for iterative image editing. After generating an image, you can continue refining it by providing additional instructions.

How It Works

  1. First Turn: Send a regular request with prompt (and optional image)
  2. Response: The response includes next_turn_contents with prior conversation context
  3. Next Turn: Copy next_turn_contents into payload contents, then append your new user instruction
  4. Repeat: Continue until the result is satisfactory

Model Specifications

Capabilities

  • Supported: System instructions, Count Tokens, Thinking, Implicit context caching
  • Not supported: Code execution, Function calling, Gemini Live API, Structured output, URL context, Vertex AI RAG Engine, Chat completions, Tuning

Pricing

  • Input (text, image): $1.50 per 1M tokens
  • Text output (response/reasoning): $7.50 per 1M tokens
  • Image output: $30 per 1M tokens
    • 1K output image: 1120 tokens (about $0.0336/image)
    • 2K output image: 1680 tokens (about $0.0504/image)
    • 4K output image: 3780 tokens (about $0.113/image)

Tips for Better Results

  1. Use specific and descriptive prompts for stable outputs.
  2. For complex edits, use multi-turn mode with contents for iterative refinement.
  3. Use high-quality reference images and keep composition/style instructions explicit.
  4. For text-heavy images (infographics, menus, posters), use thinking: "high" and spell out the exact text you want rendered.