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.
  • Use multipart/form-data to send up to 14 reference images (≤10 MB each); they are uploaded to storage before calling Nano Banana.

Generate image

POST /api/v1/image/nano-banana for text-to-image or image-to-image. Send multipart/form-data when uploading reference images.

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.
  • imageFile (optional, FormData): upload reference files for image-to-image; up to 14 files, each ≤10 MB.
  • imageUrl (optional): reference image URL(s); accepts string or string[], counts toward the 14-image cap.
  • imageData (optional, legacy): base64 data URL is still accepted for compatibility, but multipart upload is recommended.
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 "Authorization: Bearer api-key" \
  -F "prompt=A banana cat in a spacesuit on the moon" \
  -F "model=nano-banana-pro" \
  -F "mode=image-to-image" \
  -F "aspectRatio=auto" \
  -F "imageSize=1K" \
  -F "imageFile=@/path/to/ref.png"

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.