Nano Banana API

nano banana api

Image generation endpoints for text-to-image and image-to-image. Authenticate with `Authorization: Bearer YOUR_API_KEY`. Credits are charged and refunded automatically. See /docs/nano-banana-api for details.

Before you call

  • Endpoints are in-site Next APIs and require `Authorization: Bearer YOUR_API_KEY`.
  • Credits per model: nano-banana-fast 5, nano-banana 15, nano-banana-pro 20; failed jobs refund automatically.
  • For image-to-image, the reference image is uploaded to storage before calling Nano Banana.

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 cases400: 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
  }
}

Check result

POST /api/v1/image/nano-banana/result to fetch progress and URLs; failed tasks auto-refund.

Method: POSTPath: /api/v1/image/nano-banana/result
Payload: taskId or id (string). Response fields mirror the generation endpoint; when status=failed, credits are already refunded.
Failure cases400: missing task ID.;401: not logged in.;500: downstream query failure or service error.

Sample request

curl -X POST https://nanobananapro.cloud/api/v1/image/nano-banana/result \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer api-key" \
  -d '{
    "taskId": "task-id-xxx"
  }'

Sample response

{
  "data": {
    "id": "task-id-xxx",
    "results": [
      {
        "url": "https://example.com/generated.png",
        "content": "A banana cat in a spacesuit on the moon"
      }
    ],
    "progress": 100,
    "status": "succeeded",
    "failure_reason": null,
    "error": null
  }
}

Start calling

Call the in-site API with your key. For more details, read /docs/nano-banana-api.