Nano Banana 2
Nano Banana 2
Next-generation image generation and editing with Google Search grounding, up to 14 reference images, and 4K output
- Endpoint
- POST /api/v1/images/generate
- model
- nano-banana-2
- Output
- Image
- Credits
- from 7
Aufgabe senden
/api/v1/images/generateParameter
modelstringErforderlichMust be "nano-banana-2"
typestringOptionalStandardtext-to-image"text-to-image" or "image-to-image" (default: text-to-image)
text-to-imageimage-to-imagepromptstringErforderlichText description of the image to generate. Supports up to 20,000 characters.
resolutionstringOptionalStandard1K"1K", "2K", or "4K" (default: 1K)
1K2K4Kaspect_ratiostringOptional"auto", "1:1", "16:9", "9:16", "4:3", "3:4", "1:4", "1:8", "4:1", "8:1", "21:9"
auto1:116:99:164:33:41:41:84:18:121:9image_urlsstring[]OptionalInput image URLs or base64 for image-to-image. Supports up to 14 images.
input_imagestringOptionalDeprecated. Alias for image_urls[0]
google_searchbooleanOptionalEnable Google Search grounding for real-time information
truefalsegoogle_image_searchbooleanOptionalEnable image search grounding. Requires google_search=true.
truefalseoutput_formatstringOptionalStandardjpg"jpg" or "png" (default: jpg)
jpgpngnum_imagesnumberOptionalMust be 1
Anfrage
curl -X POST https://www.bananapro.site/api/v1/images/generate \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"prompt": "A cinematic product photo of a transparent smart speaker on a glass table",
"resolution": "2K",
"aspect_ratio": "16:9"
}'Antwort200
{
"success": true,
"data": {
"task_id": "task_nb2_abc123",
"credits_used": 11,
"remaining_credits": 489,
"model": "nano-banana-2"
}
}Die credits_used-Werte in diesen Beispielen dienen nur zur Veranschaulichung. Der tatsächliche Verbrauch wird beim Senden berechnet und von der API zurückgegeben.
Aufgabe abfragen
/api/v1/images/{task_id}status
pending- Accepted and waiting to start. Keep polling.
processing- Running. Keep polling.
completed- Finished. Read image_url; output holds the full result.
failed- Ended without a result. error_message says why and credits_refunded shows what was returned.
Poll every 5 to 10 seconds and stop at completed or failed, or register a webhook to be notified instead. Failed tasks are refunded automatically.
Anfrage
curl https://www.bananapro.site/api/v1/images/task_abc123 \
-H "Authorization: Bearer sk-your-api-key"Antwort200
{
"success": true,
"data": {
"task_id": "task_abc123",
"model": "nano-banana-2",
"status": "completed",
"output": { "images": [{ "url": "https://..." }] },
"primary_url": "https://...",
"image_url": "https://...",
"error_message": null,
"credits_used": 11,
"credits_refunded": 0,
"created_at": "2026-10-04T10:00:00.000Z",
"updated_at": "2026-10-04T10:01:12.000Z",
"completed_at": "2026-10-04T10:01:12.000Z"
},
"request_id": "req_abc123"
}Auf das Ergebnis warten
TASK_ID=task_abc123
while true; do
TASK=$(curl -s https://www.bananapro.site/api/v1/images/$TASK_ID \
-H "Authorization: Bearer sk-your-api-key")
STATUS=$(echo "$TASK" | jq -r '.data.status')
if [ "$STATUS" = "completed" ] || [ "$STATUS" = "failed" ]; then
echo "$TASK" | jq
break
fi
sleep 10
donePreise
| Resolution | Credits |
|---|---|
| 1K | 7 |
| 2K | 11 |
| 4K | 15 |
Funktionen
- Text-to-image generation
- Image-to-image transformation
- Google Search grounding
- Up to 14 reference images
- Extreme aspect ratios and up to 4K resolution