Nano Banana Pro API
Complete API reference for Nano Banana Pro models powered by Google Gemini.
Model Variants
This API supports two model variants:
Quick Comparison
Supported Aspect Ratios
Both models support 11 aspect ratios:
16:9 (default), 9:16, 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 5:4, 21:9, 9:21
Nano Banana Pro (Text-to-Image)
Endpoint
POST /api/v1/image/task
Authentication
Authorization: Bearer YOUR_API_KEY
Request Parameters
Required
Note: The width:height ratio must be one of: "21:9", "9:21", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "1:1"
Example Request
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'nano-banana-pro',
prompt: 'A serene mountain landscape at sunset',
width: 16,
height: 9,
resolution: '2k'
})
});
const { data } = await response.json();
const taskId = data.task_id;
const pollResponse = await fetch(
`https://api.flaq.ai/api/v1/image/${taskId}`,
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
}
);
const result = await pollResponse.json();
console.log(result.data.task_result.images[0].url);
Nano Banana Pro Edit (Image Editing)
Endpoint
POST /api/v1/image/task
Request Parameters
Required
Note: The width:height ratio must be one of: "21:9", "9:21", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "1:1"
Single Image Edit Example
{
model_name: 'nano-banana-pro-edit',
prompt: 'Change the sky to sunset colors',
width: 16,
height: 9,
resolution: '2k',
image_url_list: ['https://example.com/image.jpg']
}
Multi-Image Composition Example
{
model_name: 'nano-banana-pro-edit',
prompt: 'Combine these images into a cohesive landscape',
width: 16,
height: 9,
resolution: '2k',
image_url_list: ['https://example.com/image1.jpg', 'https://example.com/image2.jpg', 'https://example.com/image3.jpg']
}
Initial Response
Both models return a task_id for polling:
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "submitted",
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}"
},
"message": "success"
}
Polling Response
Poll /api/v1/image/{taskId} to check status:
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}",
"task_result": {
"credit": 0.0997,
"images": [
{
"url": "https://example.com/generated-image.jpeg"
}
]
}
},
"message": "success"
}
Status Values
submitted: Task accepted
processing: Generation in progress
succeed: Generation completed successfully
failed: Generation failed
Error Handling
Common Errors
Invalid Resolution
{
"code": 400,
"message": "Resolution must be one of: 1k, 2k, 4k"
}
Invalid Aspect Ratio
{
"code": 400,
"message": "Ratio must be one of: 16:9, 9:16, 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 5:4, 21:9, 9:21"
}
Missing Image URL (Edit Mode)
{
"code": 400,
"message": "image_url_list is required for nano-banana-pro-edit"
}
Best Practices
Text-to-Image Tips
- Be Specific: Include subject, style, lighting, composition details
- Choose Resolution Wisely: 2K is default and cost-effective, use 4K for highest quality
- Aspect Ratio Selection: Choose ratio based on your use case (16:9 for web, 9:16 for mobile)
- Prompt Quality: More detailed prompts generally produce better results
Image Editing Tips
- Clear Instructions: Be specific about what to change
- Multi-Image Composition: Can combine up to 14 images in a single request
- Resolution Matching: Output resolution can differ from input
- Prompt Guidance: Describe the desired outcome, not just the changes
Example Use Cases
Product Photography
{
model_name: 'nano-banana-pro',
prompt: 'Professional product shot of luxury watch on marble surface',
width: 4,
height: 3,
resolution: '4k'
}
Multi-Image Collage
{
model_name: 'nano-banana-pro-edit',
image_url_list: [
'photo1.jpg',
'photo2.jpg',
'photo3.jpg'
],
prompt: 'Create a seamless collage with these vacation photos',
width: 16,
height: 9,
resolution: '2k'
}
Image Enhancement
{
model_name: 'nano-banana-pro-edit',
image_url_list: ['photo.jpg'],
prompt: 'Enhance colors and add dramatic lighting',
width: 1,
height: 1,
resolution: '2k'
}