Generate image
POST /api/v1/image/nano-banana for text-to-image or image-to-image.
Method: POSTPath: /api/v1/image/nano-banana
Payload fields
- prompt (required): description to generate.
- model (required): nano-banana-fast | nano-banana | nano-banana-pro.
- mode (optional): text-to-image (default) or image-to-image; image mode needs a reference image.
- aspectRatio (optional): default auto; accepts 1:1, 16:9, 9:16, etc.
- imageSize (optional): default 1K; accepts 1K/2K/4K.
- imageData (optional): base64 data URL with data:image/xxx;base64, prefix.
- imageUrl (optional): reference image URL used when imageData is absent.
Failure cases:400: missing required fields / no reference image for image-to-image / invalid model.;401: not logged in.;402: insufficient credits.;500: service configuration or downstream error.
Sample request
curl -X POST https://nanobananapro.cloud/api/v1/image/nano-banana \
-H "Content-Type: application/json" \
-H "Authorization: Bearer api-key" \
-d '{
"prompt": "A banana cat in a spacesuit on the moon",
"model": "nano-banana-pro",
"mode": "text-to-image",
"aspectRatio": "auto",
"imageSize": "1K"
}'Sample response
{
"data": {
"id": "task-id-xxx",
"results": [],
"progress": 0,
"status": "running",
"failure_reason": null,
"error": null,
"credits_cost": 20
}
}