Developer Guide: Nano Banana 2 with the Gemini Interactions API
This developer guide walks through using Google’s Nano Banana 2 image generation model (gemini-3.1-flash-image-preview) via the new Gemini Interactions API to build a personalized Japan travel brochure in four progressive steps. It starts with basic text-to-image generation, then adds Google Search web grounding for factual accuracy, Image Search grounding for visual fidelity to real locations, and finally reference photo integration for subject-consistent personalization — compositing a real person into a photorealistic scene. The Interactions API serves as a unified interface that combines these capabilities in single API calls, with the model able to maintain resemblance for up to 5 characters and 14 reference objects. All four examples are provided as runnable Python code snippets using the google-genai SDK.
Source: Developer Guide: Nano Banana 2 with the Gemini Interactions API