⌘K

Google Nano Banana 2 Lite

nano_banana_2_lite

Google Nano Banana 2 Lite provides low-latency and cost-efficient image generation and editing through Gemini 3.1 Flash Lite Image for high-throughput workloads.

API Notes

nano_banana_2_lite maps to the official Gemini model gemini-3.1-flash-lite-image and supports text-to-image generation and image editing

nano_banana_2_lite is optimized for low-latency, cost-efficient, high-throughput workloads and uses 1K image output size

Authentication

authorization string required

All APIs require authentication via Bearer Token.

Get API Key:

Visit API Key Management Page to get your API Key.

Usage:

Add to request header:

Authorization: Bearer YOUR_API_KEY

Parameters

model string required

Model ID to use for the request

Value: nano_banana_2_lite


prompt string required

Text prompt describing the image to generate or edit


image_urls array

List of input image URLs used for image editing


aspect_ratio string

Image aspect ratio

Options: 1:8, 1:4, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 8:1, 4:1, 9:16, 16:9, 21:9


image_size string

Image output size

Options: 1K


Synchronous generation

Send the same request body to POST /model/v1/generation/sync. The request waits for the task to finish and returns the terminal response directly without an additional task submission

Polling

Since result generation takes time, you need to poll the task status after creating the task.

The initial response only returns information such as the task ID and initial status. The final result must be obtained by polling the task status endpoint using the task ID.

See the examples on the right for polling requests and responses.

Response Format

error object

Error information, only present when status is failed

code string

Error code

message string

Detailed error message


output array

Generation results, only present when status is completed

content array

List of generated resource content

type string

Resource type

Value: image|video

url string

Processed resource URL

jobId string

Remote task ID


usage object

Usage statistics, only present when status is completed

cost string

Total cost in USD

discount number

Discount amount


metadata object

Metadata information

Nano Banana 2 Lite also returns the following token fields in usage

prompt_tokens integer

Number of tokens consumed by the input prompt and images

completion_tokens integer

Number of tokens consumed by the generated result

total_tokens integer

Total token count

Error Codes

Error CodeDescription
005001095Internal generation error
005001096Result parsing error
005001097HTTP error response
005001098Synchronous generation error