Skip to main content
POST
Note for users in mainland China: Please use https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.

Version Options

The reference image count is the total number of input images; it does not represent the number of output images. The versions use different model IDs, so follow the parameters and examples on the corresponding page.

Current Version

Use model: "gemini-nano-banana-2.1-official" to select Official. It supports text-to-image and image-to-image generation or editing with up to 14 reference images and 1K, 2K, or 4K output. It uses Google Vertex AI and supports native extension parameters such as temperature, topP, thinkingConfig, safetySettings, and Google Search grounding; see the fields below. Requests run asynchronously. After submission, use the task ID to query the result.
image_urls accepts image URLs only, not base64 data. Use the Upload Image endpoint first to obtain an accessible URL.

Authentication

string
required
All endpoints require Bearer Token authenticationGet API Key: Visit the API Key Management page to obtain your API KeyAdd to request headers:

Request Parameters

string
default:"gemini-nano-banana-2.1-official"
required
Image generation model nameExample: "gemini-nano-banana-2.1-official"
string
required
Text description for image generation
string
Image aspect ratioSupported formats:
  • 1:1 - Square
  • 3:2 / 2:3
  • 3:4 / 4:3
  • 4:5 / 5:4
  • 9:16 / 16:9
  • 21:9 / 9:21
  • 1:4 / 4:1
  • 1:8 / 8:1
integer
default:1
Number of images to generateFixed at 1
string[]
Reference image URL array for image-to-image generation or editing⚠️ Only URL format is supported (base64 is not supported)
  • Publicly accessible image URLs (http:// or https://)
  • Use the Upload Image endpoint to upload local images and get URLs
Limits:
  • Maximum 14 images
  • Maximum file size per image: 10MB
  • Supported formats: .jpeg, .jpg, .png, .webp
object
Vertex AI native extension parameters

Response Fields

string
Unique task identifier for querying task status
string
Object type, always generation.task
string
Model name used
string
Task status
  • queued - Queued for processing
  • in_progress - Processing
  • completed - Successfully completed
  • failed - Failed
integer
Task progress percentage (0-100)
integer
Task creation timestamp (Unix timestamp)
object
Task metadata

Query Results

The id in the submission response is the task ID. Use the Image Task Status endpoint to retrieve the status and final images. When grounding is enabled, the task result also returns grounding_metadata with search queries and cited sources. Task status queries and Webhook callbacks follow the standard asynchronous image API conventions.