Nano Banana 2
Nano Banana 2 is Google’s latest image generation and editing model, also called Gemini 3.1 Flash Image, built to combine fast “Flash” speed with stronger visual quality, sharper instruction-following, and more precise edits.
Nano Banana 2 Text to Image API
Describe the image you want to generate (max 20,000 chars)
Output image aspect ratio
Output image resolution
Result
Results will appear here
Cost: $0.08/image
Nano Banana 2 API Implementation Guide
Get API Key
Generate your API key from the dashboard and set it as an environment variable.
export MODELHUNTER_KEY="your_api_key"Make Your First Call
Follow the API documentation for complete code examples in cURL, JavaScript, and Python, including request format, polling, and error handling.
View API Documentation →Nano Banana 2 Key Info
Capabilities
- Text to Image API
- Image to Image API
Pricing
Price per image by resolution
| 1K | 2K | 4K |
|---|---|---|
| $0.08/image | $0.12/image | $0.16/image |
$0.08 per image (1K)
Use Cases
Output Formats
Nano Banana 2 API Documentation
Run the playground first, then open the full API docs for integration details.
About
Generate images from text prompts with excellent text rendering
Code Examples
1curl -X POST https://api.modelhunter.ai/api/v1/gemini/text-to-image \2-H "Authorization: Bearer YOUR_API_KEY" \3-H "Content-Type: application/json" \4-d '{5"model": "nano-banana-2",6"input": {7"prompt": "A futuristic cityscape at sunset with neon signs",8"aspect_ratio": "auto",9"resolution": "1K"10}11}'
Schema
View Full API DocsInput
modelModel ID for this capability.
Value: nano-banana-2
promptDescribe the image you want to generate (max 20,000 chars)
aspect_ratioOutput image aspect ratio
Options: auto, 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, 4:5, 5:4, 21:9
Default: auto
resolutionOutput image resolution
Options: 1K, 2K, 4K
Default: 1K
google_searchEnable real-time web grounding for the prompt
Default: false
output_formatImage file format
Options: jpg, png
Default: jpg
webhookUrlURL to receive a webhook notification when the task completes.
metadataCustom key-value metadata to attach to the task for tracking.
Response (HTTP 202)
successWhether the request was accepted successfully.
data.idUnique task ID. Use this to poll GET /api/v1/tasks/{id} for results.
data.statusTask status: pending, processing, completed, failed.
data.typeGeneration type: text-to-image.
data.providerProvider name: gemini.
data.modelModel ID used for generation.
data.created_atISO 8601 timestamp of when the task was created.
data.estimated_secondsEstimated time in seconds until the task completes.