Nano Banana Image API

Nano Banana Pro Image API

Generate an API key in Member Center -> API Keys and send it via Authorization: Bearer <api-key>.

1) Create Image

  • Method: POST /api/v1/image/nano-banana
  • Headers: Authorization: Bearer api-key (send multipart/form-data when uploading reference files)
  • Notes: Supports both text-to-image and image-to-image. For image-to-image, upload files directly via FormData to avoid base64 payload limits; backend stores references and forwards them to Nano Banana.

Request (multipart/form-data)

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" \
  -F "imageUrl=https://example.com/ref.png"
  • prompt (required): Description for generation.
  • model (required): nano-banana-fast | nano-banana | nano-banana-pro. Costs 5/15/20 credits respectively.
  • mode (optional): text-to-image (default) or image-to-image. Image-to-image requires imageFile or imageUrl.
  • aspectRatio (optional): Default auto; forward any ratio Nano Banana supports (e.g., 1:1, 16:9, 9:16).
  • imageSize (optional): Default 1K; options 1K/2K/4K.
  • imageFile (optional, FormData): Reference image file(s) for image-to-image. Supports up to 14 files, each ≤10 MB.
  • imageUrl (optional): Direct reference URLs when imageFile is absent; counts toward the 14-image cap.
  • imageData (optional, legacy): Base64 data URL is still accepted for compatibility, but FormData upload is recommended to prevent oversized payloads.

Success Response

{
  "data": {
    "id": "task-id-xxx",
    "results": [],
    "progress": 0,
    "status": "running",
    "failure_reason": null,
    "error": null,
    "credits_cost": 20
  }
}
  • id: Task ID (used for follow-up queries).
  • results: Generated results (usually empty while running); items contain url and optional content.
  • progress: Progress from 0-100.
  • status: running | succeeded | failed.
  • failure_reason / error: Failure reason.
  • credits_cost: Credits deducted for this request.

Common Failures

  • 400: Missing required params / image-to-image without reference image / invalid model.
  • 401: Not authenticated.
  • 402: Insufficient credits.
  • 500: Service misconfiguration (e.g., Nano Banana API key missing).

2) Get Generation Result

  • Method: POST /api/v1/image/nano-banana/result
  • Headers: Content-Type: application/json
  • Notes: Fetch the generation status and sync the task record. Failed tasks automatically refund credits.

Request Body

{
  "taskId": "task-id-xxx"
}

The id field is also accepted as the task ID.

Success 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
  }
}
  • Task status and field meanings match the create endpoint. When status: failed, credits have already been refunded.

Common Failures

  • 400: Missing task ID.
  • 401: Not authenticated.
  • 500: Downstream query failure or service error.