Skip to main content
The Nano Banana image generation endpoint creates an async task that generates high-quality AI images from a text prompt. You’ll receive a task ID to poll for the result. Because generation happens asynchronously, your application can continue doing other work while the image is being produced.

Base URL

Endpoint

Authentication

Include your API key as a Bearer token in the Authorization header on every request:

Models

Choose the model that best fits your quality and speed requirements.

Request Parameters

string
required
The model to use for image generation. See the Models table above for valid values.
string
required
A text description of the image you want to generate. Clear, descriptive prompts produce the best results. Example: "A cute orange cat sitting on a windowsill, golden hour lighting".
string
default:"1k"
The output resolution of the generated image. Defaults to 1k for all models.nano-banana, nano-banana-2, and nano-banana-2-stable have limited resolution capability — use 1k for these models.
string
The aspect ratio of the generated image. If omitted, the model uses its default aspect ratio.Supported values: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5, 21:9
array
An array of reference image URLs used to guide the style of the generated image. You may provide up to 6 images. Reference images are optional but can significantly improve style consistency.

Response Fields

string
The unique task ID for this generation job. Use this value to poll the Query Image Task endpoint for the result.
string
The object type. Always nanobanana.
integer
Unix timestamp indicating when the task was created.
string
The model name used for this task.
string
The initial task status. Will be queued or processing immediately after creation.
string
An error message describing what went wrong. Only present when status is failed.

Code Example

Success Response

Failure Response


Image generation is processed asynchronously. The create endpoint returns a task id immediately — use that ID with the Query Image Task endpoint (GET /v1/result/{id}) to check task status and retrieve your image URL when generation is complete.
Polling interval: Check the task status every 2–5 seconds. Polling too frequently may result in rate limiting, while longer intervals simply delay when you first see the result. Stop polling as soon as status is completed or failed.