Skip to main content
POST
Note for users in mainland China: Use https://toapis.cn as the Base URL. Replace https://toapis.com with https://toapis.cn in the examples below.

Model Selection

Both models use the same endpoint and request parameters. Switch versions using the model field. Text-to-image and image-to-image requests run asynchronously. Query results using the task ID returned after submission.
image_urls only accepts publicly accessible image URLs, not base64 data. Use the Upload Image API to upload local images and obtain URLs first.

Authentication

string
required
All requests require a Bearer Token. Get your API Key from the API Key Management Page.

Request Parameters

string
default:"gemini-nano-banana-2.1"
required
Model name. Use gemini-nano-banana-2.1 or gemini-nano-banana-2.1-vip.
string
required
Text description for image generation or editing.
string
Output image aspect ratio. Supported values:
  • 1:1
  • 3:2, 2:3
  • 4:3, 3:4
  • 16:9, 9:16
  • 5:4, 4:5
  • 21:9
  • 1:4, 4:1
  • 1:8, 8:1
integer
default:1
The output count is fixed at the number 1. Do not use the string "1".
string[]
Array of reference image URL strings for image-to-image generation or editing. Maximum 14 images. Each URL must be publicly accessible. The reference image count is not the output image count.Maximum 10MB per image. Supported formats: .jpeg, .jpg, .png, .webp.
object
Additional configuration options.

Response Fields

string
Task ID used to query task status and results.
string
Always generation.task.
string
Model ID used in the request.
string
Task status: queued, in_progress, completed, failed.
integer
Task progress as a percentage from 0 to 100.
integer
Task creation time as a Unix timestamp in seconds.
object
Task metadata.

Query Results

The id in the submission response is the task ID. Use the Image Task Status API to retrieve task status and final images. See Task Webhooks for asynchronous notifications.