Back to docs

Image-to-Image API

Create an asynchronous image editing task from a prompt and one or more reference images. This same endpoint supports nano, nano2, and nano2pro through the model field.

Nano AI API Base URL: https://nanobnana.com

Authentication

Send your API key as a Bearer token. All image URLs must be publicly accessible.

http
Authorization: Bearer YOUR_API_KEY

Model Selection

Use this same /api/edit endpoint for every image editing model. model is optional only for backward compatibility; new integrations should set it explicitly.

nano

Original Nano AI Fast edit backend. Default when model is omitted.

nano2

Nano AI 2 image editing through the unified generate worker.

nano2pro

Nano AI 2 Pro editing and multi-image workflows.

Endpoint

The endpoint returns a task_id immediately. Poll /api/status to retrieve the edited image URLs.

Request bodyJSON
prompt:string

Editing instruction for the input image or images.

images:string[]

Publicly accessible image URLs. For nano2pro, up to 14 images are supported.

model:optional string

Supported values: nano, nano2, nano2pro. Defaults to nano.

aspect_ratio:optional string

Output aspect ratio for Nano AI 2 models. Defaults to 1:1.

size / resolution:optional string

Resolution. Supported values: 1K, 2K, 4K.

format / output_format:optional string

Output image format. Defaults to png.

Example request

json
{
  "prompt": "Place the wristwatch on a marble counter with soft studio lighting",
  "images": [
    "https://example.com/input-watch.jpg"
  ],
  "model": "nano2pro",
  "aspect_ratio": "1:1",
  "resolution": "1k",
  "output_format": "png"
}

Example response

{
  "code": 200,
  "message": "success",
  "task_id": "n82b71e549f645122eb8db5f75af2c11nb2",
  "model": "nano2pro",
  "data": {
    "task_id": "n82b71e549f645122eb8db5f75af2c11nb2",
    "type": "edit",
    "status": "IN_PROGRESS"
  }
}

Image Input Notes

  • nano2pro accepts up to 14 reference image URLs.
  • nano2 uses the same unified endpoint and receives image URLs through images.
  • For legacy nano, the request body is preserved as closely as possible for backward compatibility.

Next Step

Save the returned task_id and poll the status endpoint until the task reaches a final state.

View Query Status API

Common Errors

{
  "code": 400,
  "message": "Bad Request: 'prompt' and 'images' are required.",
  "data": null
}