Nano Banana
Nano Banana
支持文生图与图生图的快速图像生成
- Endpoint
- POST /api/v1/images/generate
- model
- nano-banana
- Output
- Image
- Credits
- from 4
1
提交任务
POST
/api/v1/images/generate参数
modelstring必需Must be "nano-banana"
typestring可选默认text-to-image"text-to-image" or "image-to-image" (default: text-to-image)
text-to-imageimage-to-imagepromptstring必需Text description of the image to generate
aspect_ratiostring可选"1:1", "16:9", "9:16", "4:3", "3:4"
1:116:99:164:33:4image_urlsstring[]可选Input image URLs or base64 for image-to-image
input_imagestring可选Deprecated. Alias for image_urls[0]
num_imagesnumber可选Must be 1
请求
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",
"prompt": "A futuristic city at night with neon lights",
"aspect_ratio": "16:9"
}'响应200
{
"success": true,
"data": {
"task_id": "task_abc123",
"credits_used": 4,
"remaining_credits": 496,
"model": "nano-banana"
}
}示例中的 credits_used 数值仅供说明。实际消耗会在提交时计算,并由 API 返回。
2
查询任务
GET
/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.
请求
curl https://www.bananapro.site/api/v1/images/task_abc123 \
-H "Authorization: Bearer sk-your-api-key"响应200
{
"success": true,
"data": {
"task_id": "task_abc123",
"model": "nano-banana",
"status": "completed",
"output": { "images": [{ "url": "https://..." }] },
"primary_url": "https://...",
"image_url": "https://...",
"error_message": null,
"credits_used": 4,
"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"
}等待结果
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
done定价
4Per image
功能特性
- 文生图生成
- 图像到图像的转换
- 多种宽高比
- 快速生成(约5秒)