Generate images from text prompts using the Google Nano Banana 2 model (Gemini 3.1 Flash Image Preview). Supports up to 4K resolution output and 14 different aspect ratios.
resolution up to 4K)Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Text to image generation request body
Text prompt for image generation. For best results, describe the scene narratively rather than listing keywords.
Include details such as:
Example: "A photorealistic close-up portrait of an elderly Japanese ceramicist with deep, sun-etched wrinkles and a warm, knowing smile. Captured with an 85mm portrait lens, resulting in soft bokeh."
Aspect ratio of the generated image (width:height).
1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9 Output resolution preset.
Note: Must use uppercase K (e.g. 1K, 2K, 4K). Lowercase will be rejected.
1K, 2K, 4K Enable Google Search grounding for image generation. When enabled, the model can use Google Search (including Web Search and Image Search) to verify facts and generate imagery based on real-time data such as current weather, stock charts, recent events, or accurate depictions of real-world subjects.
Accepted - Task created successfully