Skip to main content
POST

Banana 2.1 (gemini-nano-banana-2.1)

Use native generateContent for text-to-image, image-to-image, PDF reference, and short video reference. Always set generationConfig.responseModalities to include IMAGE.

PDF reference (complete)

Short video reference (complete)

Read output images from candidates[].content.parts[].inlineData (scan all parts; skip thought: true). Prefer short H.264 MP4 and small PDFs; Base64 expands roughly one third.

Optional: Thinking

Banana 2.1 supports thinkingLevel: minimal / medium (default) / high. Omit for typical use; when needed, set generationConfig.thinkingConfig:
includeThoughts only controls whether thought text is returned; it does not disable internal thinking. See Overview · Thinking.

Headers

Authorization
string
required

Bearer API key.

Example:

"Bearer sk-..."

Path Parameters

model
string
required

Gemini image model id. Examples: gemini-nano-banana-2.1, gemini-3.1-flash-image-preview.

Example:

"gemini-nano-banana-2.1"

Body

application/json

Native Gemini image-generation request body.

contents
object[]
required

Conversation turns. Mix text with one or more inlineData media parts.

generationConfig
object

Response

OK — read text/images from candidates[].content.parts.