AIAPIAIAPI API

Nano Banana 2 Edit

Model ID google/nano-banana-2/edit

Overview

Image generation with reasoning, web search and image search controls.

Google · image-to-image

Endpoint

POST /v1/images/generations/async

Authentication

Authorization: Bearer <AIAPIAIAPI_API_KEY>

Request Body

ParameterTypeRequiredNullableDefaultConstraintsDescription
modelstringYesNo-values: google/nano-banana-2/editModel ID used to route the request.
promptstringYesNo--Text prompt describing the desired output.
imagesarrayYesNo-min_items: 1; max_count: 14; accepts: URL, Base64 data URLSource images; optional alongside the source video in reference-to-image mode.
resolutionstringNoNo`1k`values: 1k, 2k, 4kOutput image resolution.
aspect_ratiostringNoNo-values: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9Output image aspect ratio.
seedintegerNoNo`-1`-Random seed; -1 selects a random seed. Determinism is not guaranteed.
output_formatstringNoNo`default`values: default, png, jpegOutput file format.
enable_web_searchbooleanNoNo`false`-Ground generation with web search.
enable_image_searchbooleanNoNo`false`-Use image search results as visual context.
thinking_levelstringNoNo`default`values: default, high, minimalInternal reasoning level; higher levels may improve quality but increase latency.
media_resolutionstringNoNo`default`values: default, low, medium, highInput media processing detail.
top_pnumberNoNo`0.95`range: 0-1Top-p sampling probability threshold.
temperaturenumberNoNo`1`range: 0-1Sampling temperature controlling creativity.

model

Type: string · Required: Yes · Nullable: No

Model ID used to route the request.

prompt

Type: string · Required: Yes · Nullable: No

Text prompt describing the desired output.

images

Type: array · Required: Yes · Nullable: No

Source images; optional alongside the source video in reference-to-image mode.

resolution

Type: string · Required: No · Nullable: No

Output image resolution.

aspect_ratio

Type: string · Required: No · Nullable: No

Output image aspect ratio.

seed

Type: integer · Required: No · Nullable: No

Random seed; -1 selects a random seed. Determinism is not guaranteed.

output_format

Type: string · Required: No · Nullable: No

Output file format.

Type: boolean · Required: No · Nullable: No

Ground generation with web search.

Type: boolean · Required: No · Nullable: No

Use image search results as visual context.

thinking_level

Type: string · Required: No · Nullable: No

Internal reasoning level; higher levels may improve quality but increase latency.

media_resolution

Type: string · Required: No · Nullable: No

Input media processing detail.

top_p

Type: number · Required: No · Nullable: No

Top-p sampling probability threshold.

temperature

Type: number · Required: No · Nullable: No

Sampling temperature controlling creativity.

Request Example

curl --request POST \
  --url https://aiapiaiapi.com/v1/images/generations/async \
  --header 'Authorization: Bearer $AIAPIAIAPI_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
      "model": "google/nano-banana-2/edit",
      "prompt": "A cinematic camera movement through a forest",
      "images": ["https://example.com/reference.jpg"],
      "resolution": "1k"
    }'

JSON

{
  "model": "google/nano-banana-2/edit",
  "prompt": "A cinematic camera movement through a forest",
  "images": ["https://example.com/reference.jpg"],
  "resolution": "1k"
}

Response

{
  "code": "success",
  "message": "",
  "data": { "task_id": "image_01K2ABC123" }
}

Task Status

Use the task_id from the create response:

GET /v1/images/generations/async/{task_id}

{
  "code": "success",
  "message": "",
  "data": {
    "task_id": "image_01K2ABC123",
    "status": "SUCCESS",
    "progress": "100%",
    "outputs": ["https://cdn.example.com/images/image_01K2ABC123.png"],
    "start_time": 1786960805,
    "finish_time": 1786960900,
    "submit_time": 1786960800,
    "fail_reason": ""
  }
}

Error Responses

Validation errors return HTTP 400 with a stable error code.

{
  "code": "unsupported_parameter",
  "message": "The parameter is not supported by this model.",
  "data": null
}

Documentation Index

Fetch the complete documentation index at:

https://aiapiaiapi.com/llms.txt

Use this file to discover all available API documentation.