> ## Documentation Index
> Fetch the complete documentation index at: https://docs.creatify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Nano Banana 2 Image to Image API

> Ultra-consistent characters with commercial-grade quality.

[← Nano Banana](https://docs.creatify.ai/api-documentation/ai-generation/models/nano-banana.md)

**Model name:** `nano-banana-2/edit`\
**Generation type:** `image_to_image`\
**Endpoint:** [`POST /api/asset_generator/`](https://docs.creatify.ai/api-reference/ai-generation/post-ai-generation)

## Pricing

| Resolution | Credits |
| - | - |
| 0.5K | **1.0** |
| 1K | **1.0** |
| 2K | **1.5** |
| 4K | **2.0** |

Prices are per output. When a request asks for several outputs, the charge is this price times the number of outputs.

## Quick start

The example uses sample media from our CDN. Swap in publicly accessible URLs for your own files.

```bash cURL theme={null}
curl --request POST \
  --url https://api.creatify.ai/api/asset_generator/ \
  --header 'Content-Type: application/json' \
  --header 'X-API-ID: your-api-id' \
  --header 'X-API-KEY: your-api-key' \
  --data '{
    "model_name": "nano-banana-2/edit",
    "input_params": {
      "prompt": "Place her in a bright café with soft morning light.",
      "image_urls": [
        "https://d35ghwdno3nak3.cloudfront.net/tutorial/avatar-aurora/recommendation-4.jpg"
      ]
    }
  }'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://api.creatify.ai/api/asset_generator/",
    headers={"X-API-ID": "your-api-id", "X-API-KEY": "your-api-key"},
    json={
        "model_name": "nano-banana-2/edit",
        "input_params": {
            "prompt": "Place her in a bright café with soft morning light.",
            "image_urls": [
                "https://d35ghwdno3nak3.cloudfront.net/tutorial/avatar-aurora/recommendation-4.jpg"
            ]
        },
    },
)
print(response.json()["id"])
```

## Input parameters

Send these fields in `input_params`.

**prompt** `string` *required*

The prompt for image editing.

Minimum characters: `3`.
Maximum characters: `5000`.

**image\_urls** `string[]` *required*

The URLs of the images to use for image-to-image generation or image editing.

Minimum items: `1`.
Maximum items: `14`.

**num\_images** `integer` (default: 1)

The number of images to generate.

Minimum: `1`.
Maximum: `4`.

**resolution** `string` (default: 1K)

The resolution of the image to generate.

Allowed values: `"0.5K"`, `"1K"`, `"2K"`, `"4K"`.

**aspect\_ratio** `string` (default: 9:16)

The aspect ratio of the generated image.

Allowed values: `"21:9"`, `"16:9"`, `"3:2"`, `"4:3"`, `"5:4"`, `"1:1"`, `"4:5"`, `"3:4"`, `"2:3"`, `"9:16"`.

**output\_format** `string` (default: png)

The format of the generated image.

Allowed values: `"jpeg"`, `"png"`, `"webp"`.

> [accordion] Complete JSON schema
>
> ```json theme={null}
> {
>   "$schema": "http://json-schema.org/draft-07/schema#",
>   "required": [
>     "prompt",
>     "image_urls"
>   ],
>   "properties": {
>     "prompt": {
>       "type": "string",
>       "title": "Prompt",
>       "maxLength": 5000,
>       "minLength": 3,
>       "description": "The prompt for image editing."
>     },
>     "image_urls": {
>       "type": "array",
>       "items": {
>         "type": "string"
>       },
>       "title": "Image URLs",
>       "maxItems": 14,
>       "minItems": 1,
>       "max_file_size": 20971520,
>       "max_pixels": 4194304,
>       "convert_svg": true,
>       "description": "The URLs of the images to use for image-to-image generation or image editing."
>     },
>     "num_images": {
>       "type": "integer",
>       "title": "Number of Images",
>       "default": 1,
>       "maximum": 4,
>       "minimum": 1,
>       "x-ui-name": "output_nums",
>       "description": "The number of images to generate."
>     },
>     "resolution": {
>       "enum": [
>         "0.5K",
>         "1K",
>         "2K",
>         "4K"
>       ],
>       "type": "string",
>       "title": "Resolution",
>       "default": "1K",
>       "description": "The resolution of the image to generate.",
>       "x-advance-settings": true
>     },
>     "aspect_ratio": {
>       "enum": [
>         "21:9",
>         "16:9",
>         "3:2",
>         "4:3",
>         "5:4",
>         "1:1",
>         "4:5",
>         "3:4",
>         "2:3",
>         "9:16"
>       ],
>       "type": "string",
>       "title": "Aspect Ratio",
>       "default": "9:16",
>       "description": "The aspect ratio of the generated image."
>     },
>     "output_format": {
>       "enum": [
>         "jpeg",
>         "png",
>         "webp"
>       ],
>       "type": "string",
>       "title": "Output Format",
>       "default": "png",
>       "description": "The format of the generated image.",
>       "x-advance-settings": true
>     }
>   }
> }
> ```

## Response

The request returns the task with `status: "initializing"`. Poll [GET /api/asset\_generator/\{id}/](https://docs.creatify.ai/api-reference/ai-generation/get-ai-generation-.md) until `status` is `done` or `failed`, or pass a `webhook_url` to be notified. A finished task lists its files in `assets` and the credits it charged in `credits_used`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.