1. Model Specs & Capabilities
- Model Code:
gemini-nano-banana-2.1 - Inputs: Text, Image, Video, and PDF (audio inputs are not supported).
- Outputs: Image + Text by default; set
response_format: { "type": "image", ... }for image-only output. - Supported Features: Thinking, Batch API, Grounding with Google Search (
web_search+image_search). - Multi-Subject Fidelity: Supports character resemblance for up to 4 characters and object fidelity for up to 10 objects in a single workflow.
- Watermarking: All generated images include an invisible SynthID watermark.
Aspect Ratios & Resolutions (response_format)
Configure aspect_ratio and image_size (512, 1K, 2K, 4K) inside response_format:
- Standard ratios:
1:1,2:3,3:2,3:4,4:3,4:5,5:4,9:16,16:9,21:9 - Extreme banner ratios:
8:1(up to12288x1536at 4K),1:8,4:1,1:4
interaction = client.interactions.create(
model="gemini-nano-banana-2.1",
input=prompt,
response_format={
"type": "image",
"mime_type": "image/jpeg",
"aspect_ratio": "16:9",
"image_size": "2K",
},
)2. Official Prompting Best Practices (6 Core Rules)
- Be Hyper-Specific: Replace generic nouns ("fantasy armor") with concrete craft, texture, and form ("ornate elven plate armor, etched with silver leaf patterns, with a high collar and pauldrons shaped like falcon wings").
- Provide Context & Intent: State the purpose of the image ("Create a logo for a high-end, minimalist skincare brand" rather than "Create a logo").
- Use Semantic Negative Prompts: Instead of
"no cars", describe the scene positively ("an empty, deserted street with no signs of traffic"). - Build Complex Scenes Step-by-Step: Layer foreground, midground, and background sequentially: > "First, create a background of a serene, misty forest at dawn. Then, in the foreground, add a moss-covered ancient stone altar. Finally, place a single, glowing sword on top of the altar."
- Control the Camera: Use explicit photography terms (
wide-angle shot,macro shot,low-angle perspective, lens type, lighting direction). - Generate Text First: When an image needs substantial or exact copy, finalize the text first, then ask for the image containing that text (specifying font style descriptively and color scheme).
3. Production Workflows Unique to Nano Banana 2.1
A. Stateful Multi-Turn Editing (previous_interaction_id)
Instead of re-uploading images and rewriting the whole prompt on every tweak, pass previous_interaction_id=interaction.id and give a focused follow-up instruction:
interaction_2 = client.interactions.create(
model="gemini-nano-banana-2.1",
input="Update this infographic to be in Spanish. Do not change any other elements of the image.",
previous_interaction_id=interaction.id,
response_format={"type": "image", "aspect_ratio": "16:9", "image_size": "2K"},
)B. 360° Character Consistency
Pass your previously generated character image(s) back into subsequent prompts and specify the new camera angle/view:
A studio portrait of this man against white, in profile looking right.For complex poses, also include a reference image of the target pose.
C. Grounding with Google Search + Image Search
For real-world species, landmarks, or factual subjects, enable google_search with image_search:
tools=[{"type": "google_search", "search_types": ["web_search", "image_search"]}]- Caveats: Real-world images of people from web search are not supported, and you must display
search_suggestionsfromgoogle_search_resultin your UI per ToS.
4. Reusable Templates
Template A: Photorealistic Camera Scene
A photorealistic [shot type, e.g., wide-angle shot] of [hyper-specific subject] in [setting description]. [Lighting and atmosphere]. Shot from a [camera angle, e.g., low perspective] with a [lens type, e.g., 35mm lens].Template B: Brand / Text Asset
Create a [image type, e.g., minimalist packaging label] for [brand/concept] with the text "[exact text]" in a [descriptive font style]. The design should be [style description], with a [color scheme].Template C: Multi-Turn Refinement Follow-Up
Keep everything the same, but [single focused change, e.g., make the lighting warmer / change the character's expression to be more serious].5. Advanced Production Patterns
system_prompt+ Shot Split (Batch Relighting Pattern): For e-commerce packshots and high-volume relighting pipelines, lock product geometry, materials, and brand invariants insidesystem_prompt(system instructions), and vary only the lighting/environment in the per-shotprompt(e.g., high-key studio, sodium vapor, overcast north-facing window).- Sketch-to-Realism (Multi-Reference Editing): Pass rough sketches or blueprints alongside material references and instruct explicitly: > "Follow the sketch's proportions and lug pattern exactly. Read hatched areas as engineered mesh. Remove every sketch line and annotation from the final image."
- Thinking Levels: Nano Banana 2.1 supports
minimal,medium(new balanced tier), andhighthinking levels—usehighfor dense layouts/typography andminimal/mediumfor rapid creative drafts. - Explicit Reference Role Assignment: > "Image 1 is the woman, image 2 is the jacket, image 3 is the room. Place the woman wearing the jacket from image 2 into the setting of image 3."
- Aspect Ratio, Iteration & Safe-Zone Tips:
- Lock aspect ratio & resolution via config: Set
aspect_ratioandimage_sizeexplicitly inresponse_formatrather than relying solely on prompt text. - High-resolution vs. rapid drafts: Use
2K/4Kwithhighthinking for multi-character consistency, and512/1Kwithminimalthinking for fast ideation grids. - Social & Ad Safe Zones: Front-load the format ("A 9:16 vertical social media product showcase...") so the model automatically leaves clean margins for UI/text overlays.
