Nano banana2 Image Generation
Supports text-to-image and image-to-image, up to 4K resolution output
Вся документация/v1/images/generations- Up to 14 reference images for style/character consistency
- Supports extreme aspect ratios (1:4, 4:1, 1:8, 8:1)
- Integrated Google Search enhancement for more realistic image generation
Note
Model name compatibility note: This endpoint also accepts the alias
nano-banana-2-ext, which is equivalent togemini-3.1-flash-image-preview. The two are interchangeable and produce identical results.
Примеры запросов
# model can be "gemini-3.1-flash-image-preview", or the compatible alias "nano-banana-2-ext"
curl --request POST \
--url https://api.apisea.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-3.1-flash-image-preview",
"prompt": "Cyberpunk cityscape at night with neon lights",
"size": "16:9",
"resolution": "2K",
"n": 1
}'Authorizations
AuthorizationstringrequiredAll API endpoints require Bearer Token authentication
Get your API Key:
Visit the API Key Management Page to get your API Key
Add it to the request header:
Authorization: Bearer YOUR_API_KEYBody
modelstringrequireddefault: gemini-3.1-flash-image-previewImage generation model name
Supported models:
gemini-3.1-flash-image-preview- Standard version (compatible aliasnano-banana-2-ext)gemini-3.1-flash-image-preview-official- Official version (compatible aliasnano-banana-2)
Example: "gemini-3.1-flash-image-preview" or "gemini-3.1-flash-image-preview-official"
Note
For backward compatibility, the aliases
nano-banana-2-ext(forgemini-3.1-flash-image-preview) andnano-banana-2(forgemini-3.1-flash-image-preview-official) remain usable.
nsfw_checkbooleandefault: falseWhether to run content moderation before submitting the image task.
true: useomni-moderation-latestto review prompts and input imagesfalseor omitted: do not send a moderation request, adding no moderation cost or latency (default)
promptstringrequiredText description for image generation
sizestringImage aspect ratio
Supported ratios:
auto- Automatically choose the aspect ratio1:1- Square, avatars, social media3:2/2:3- Standard photos4:3/3:4- Traditional display ratio16:9/9:16- Widescreen / vertical video covers5:4/4:5- Instagram images21:9- Ultra-wide banner1:4/4:1- Long poster / banner1:8/8:1- Extreme long images / banner ads
Warning
For text-to-image, when
sizeisauto, the default is1:1or16:9; for image-to-image, the aspect ratio follows the upstream response. We recommend specifying an aspect ratio.
resolutionstringdefault: 1KOutput image resolution
Supported values:
0.5K- ~512px, low-resolution preview1K- ~1024px, standard resolution (default)2K- ~2048px, high resolution4K- ~4096px, ultra-high resolution
Note: Different resolutions have different pricing. 4K costs more than 1K.
nintegerNumber of images to generate
Range: 1
Default: 1
⚠️ Note: Must enter a plain number (e.g., 1), do not use quotes or it will cause an error
official_fallbackbooleandefault: falseWhether to use the official channel fallback
false: Do not use (default)true: Use official channel
Warning
When using the official channel (
gemini-3.1-flash-image-preview-official), this parameter cannot be used.
image_urlsarrayReference image URL list for image-to-image generation
Two formats are supported:
1. Full image URL
- Publicly accessible image URL (http:// or https://)
- Example:
https://example.com/image.jpg
2. Base64 encoded format
- Must use the full Data URI format
- Format:
data:image/{format};base64,{base64data} - Supported image formats: jpeg, png, webp
- Example:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABg... - ⚠️ Note: Must include the
data:image/jpeg;base64,prefix
Limitations:
- Maximum 14 reference images (recommended: up to 10 object refs + 4 character refs)
- Single image size: not exceeding 10MB
- Supported formats: jpeg, png, webp
google_searchbooleandefault: falseEnable Google text search enhancement
true: The model will search web text information to assist image generation, suitable for scenarios requiring real-world informationfalse: Disabled (default)
google_image_searchbooleandefault: falseEnable Google image search enhancement
true: In addition to text search, will also search for reference images to assist generation, suitable for scenarios requiring visual referencesfalse: Disabled (default)
Note: Must be used together with
google_search: true
Response
codeintegerResponse status code
dataarrayResponse data array
Properties
statusstringTask status
submitted- Submitted
task_idstringUnique task identifier
Ответы
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}Модели, использующие эту конечную точку
Нашли ошибку в документации? Напишите на support@apisea.ai.