Nanobanana
Nanobanana 2 Lite Image Generation
- Nano Banana 2 Lite (gemini-3.1-flash-lite-image) model supports text-to-image, image-to-image, image editing and other generation modes
- Asynchronous processing mode, use the returned task ID to query
- Generated image links are valid for 24 hours, please save them promptly
POST
Nano Banana 2 Lite Interface
Authorizations
##All APIs require Bearer Token authentication##
Get API Key:
Visit API Key Management Page to get your API Key
Add to request header:
Body
application/json
model
enum<string>default:gemini-3.1-flash-lite-imagerequired
Image generation model name, official channel, better stability and controllability, suitable for commercial scenarios
Available options:
gemini-3.1-flash-lite-imageExample:
"gemini-3.1-flash-lite-image"prompt
stringrequired
Prompt describing the image to be generated, or describing how to edit the input image, limited to 2000 tokens
Maximum string length:
2000Example:
"A cat playing in the grass"size
enum<string>
Aspect ratio of the generated image, default is
autoAvailable options:
auto, 1:1, 1:4, 4:1, 1:8, 8:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9quality
enum<string>
Quality of the generated image, default is
1KAvailable options:
1Kimage_urls
string<uri>[]
Reference image URL list for image-to-image and image editing functions
Note:
- Maximum number of input images per request:
14 - Image size: not exceeding
20MB - Supported file formats:
.jpeg,.jpg,.png,.webp - Image URLs must be directly accessible by the server, or the image URL should directly download when accessed (typically these URLs end with image file extensions, such as
.png,.jpg)
Example:
model_params
object
Model extension parameters
callback_url
string<uri>
HTTPS callback address after task completion
Callback Timing:
- Triggered when task is completed, failed, or cancelled
- Sent after billing confirmation is completed
Security Restrictions:
- Only HTTPS protocol is supported
- Callback to internal IP addresses is prohibited (127.0.0.1, 10.x.x.x, 172.16-31.x.x, 192.168.x.x, etc.)
- URL length must not exceed
2048characters
Callback Mechanism:
- Timeout:
10seconds - Maximum
3retries on failure (retries after1second/2seconds/4seconds) - Callback response body format is consistent with the task query API response format
- Callback address returning 2xx status code is considered successful, other status codes will trigger retry
Example:
"https://your-domain.com/webhooks/image-task-completed"Response
200 - application/json
Image generation task created successfully
created
integer
Task creation timestamp
Example:
1757165031id
string
Task ID
Example:
"task-unified-1757165031-uyujaw3d"model
string
Actual model name used
Example:
"gemini-3.1-flash-lite-image"object
enum<string>
Specific task type
Available options:
image.generation.taskprogress
integer
Task progress percentage (0-100)
Required range:
0 <= x <= 100Example:
0status
enum<string>
Task status
Available options:
pending, processing, completed, failedExample:
"pending"task_info
object
Asynchronous task information
type
enum<string>
Task output type
Available options:
text, image, audio, videoExample:
"image"usage
object
Usage and billing information