Skip to Content
Image ModelsNano Banana 2.1

Nano Banana 2.1

Overview

Nano Banana 2.1 is Google’s high-efficiency AI image model for image generation and editing, with improved visual quality, prompt adherence, character consistency, text rendering, multi-reference support, and up to 4K output.

Test API KEY: key_00000000000000000000000000000000

Endpoints

1. Create Task

Request

POST https://api.pixwithapi.online/api/task/create

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Api-Key{API_KEY}Yes

Request Parameters

ParameterTypeRequiredDescription
promptstringYesA non-empty prompt describing the image to generate or edit.
image_urlsarrayConditionalProvide 1-4 publicly accessible image URLs for image-to-image generation. Each image must not exceed 20 MB. Omit for text-to-image generation.
model_idstringYes0-95
optionsobjectNoGeneration options.
options.prompt_optimizationbooleanNoTranslate and optimize the prompt before generation. Default: false.
options.resolutionstringNoOutput resolution. Valid values: '1K', '2K', '4K'. Default: '1K'.
options.aspect_ratiostringNoOutput aspect ratio. Valid values: 'Auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9'. Default: 'Auto'.

Example Request - Text-to-Image

{ "prompt": "A bright botanical studio with a wooden workbench, detailed natural textures", "model_id": "0-95", "options": { "prompt_optimization": true, "resolution": "2K", "aspect_ratio": "16:9" } }

Example Request - Image-to-Image

{ "prompt": "Keep the product shape and packaging text, use the second image as the studio background", "image_urls": [ "https://cdn.pixwithapi.online/example-product.jpg", "https://cdn.pixwithapi.online/example-background.jpg" ], "model_id": "0-95", "options": { "resolution": "4K", "aspect_ratio": "Auto" } }

Response Parameters

ParameterTypeDescription
codeint1=success, 0=error
messagestringSuccess and failure messages.
dataobjectTask data.
data.task_idstringTask identifier.
data.estimated_timeintEstimated time in seconds.

Response

{ "code": 1, "message": "success", "data": { "task_id": "d425ab4dc256f0ebaa84862b9cea8a3d", "estimated_time": 100 } }

Use the returned task_id to get task results.

Last updated on