v1

latestOpenAPI 3.0.02026-07-265013.1 KB

Generate Image (Nanobanana 2)

post/api/v1/nanobanana/generate-2

Request body

promptstring required

Text prompt for image generation (required). Controls the content and style of the generated image. Maximum length: 20,000 characters.

imageUrlsstring[]

Image URLs for image-to-image mode. Use an empty array for pure text-to-image generation. Supports up to 14 reference images.

aspectRatio'1:1' | '1:4' | '1:8' | '2:3' | '3:2' | '3:4' | '4:1' | '4:3' | '4:5' | '5:4' | '8:1' | '9:16' | '16:9' | '21:9' | 'auto'

Aspect ratio of the generated image.

resolution'1K' | '2K' | '4K'

Output resolution quality. Higher values produce larger and sharper images at higher cost.

googleSearchboolean

Use Google Web Search grounding to generate images based on real-time information.

outputFormat'png' | 'jpg'

Output image format.

callBackUrlstring uri

Optional callback URL for async notifications when the task is completed.

Example request

{
  "prompt": "a happy dog running in the park",
  "imageUrls": [],
  "aspectRatio": "auto",
  "resolution": "1K",
  "googleSearch": false,
  "outputFormat": "jpg",
  "callBackUrl": "https://example-callback.com"
}

Response

Request successful

codeinteger

Response status code

messagestring

Response message

Example response

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}