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

# Nano Banana Pro

> Professional Google image generation API with 4K output and multi-reference editing

## Overview

Nano Banana Pro is a Google image model for high-quality text-to-image generation and reference-guided image editing. Use this page when you are ready to call the API after trying the model in the APIXO playground.

| Capability       | Value                                                                   |
| ---------------- | ----------------------------------------------------------------------- |
| Model ID         | `nano-banana-pro`                                                       |
| Modes            | `text-to-image`, `image-to-image`                                       |
| Prompt length    | 1-5000 characters                                                       |
| Reference images | Up to 10 URLs for `image-to-image`                                      |
| Aspect ratios    | `1:1`, `4:3`, `3:4`, `3:2`, `2:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9` |
| Resolution tiers | `1K`, `2K`, `4K`                                                        |
| Output formats   | `png`, `jpg`                                                            |

## Endpoint and authentication

Base URL:

```text theme={null}
https://api.apixo.ai/api/v1
```

| Method | Endpoint                                      | Purpose                               |
| ------ | --------------------------------------------- | ------------------------------------- |
| `POST` | `/generateTask/nano-banana-pro`               | Submit a generation task              |
| `GET`  | `/statusTask/nano-banana-pro?taskId={taskId}` | Poll task status and retrieve results |

All requests require your APIXO API key:

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

Submit requests also require:

```http theme={null}
Content-Type: application/json
```

## Copy-paste async quickstart

This minimal request submits a text-to-image task and returns a `taskId`.

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/nano-banana-pro" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-image",
      "prompt": "a cozy cyberpunk cafe with neon lights, ultra detailed",
      "aspect_ratio": "3:2",
      "resolution": "2K",
      "output_format": "png"
    }
  }'
```

Successful response:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

Save the `taskId`; you need it to poll for the final result.

## Poll for result

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/nano-banana-pro?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Processing response:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
```

Success response:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/xxx.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

Failed response:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
```

Parse `resultJson` after `state` becomes `success`:

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const imageUrls = payload.resultUrls;
```

## Request body

### Text-to-image

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "text-to-image",
    "prompt": "a fox in watercolor style, crisp details",
    "aspect_ratio": "16:9",
    "resolution": "2K",
    "output_format": "png"
  }
}
```

### Image-to-image

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "prompt": "combine these references into a futuristic cityscape",
    "image_urls": [
      "https://example.com/ref1.png",
      "https://example.com/ref2.jpg"
    ],
    "aspect_ratio": "16:9",
    "resolution": "4K",
    "output_format": "jpg"
  }
}
```

## Parameters

<ParamField body="request_type" type="string" required default="async">
  Result delivery mode. Use `async` for polling with `statusTask`, or `callback` for webhook delivery.
</ParamField>

<ParamField body="callback_url" type="string">
  Required when `request_type` is `callback`. Must be a public HTTPS URL that can receive the final task payload. See [Webhooks](/api-reference/webhooks).
</ParamField>

<ParamField body="input" type="object" required>
  Nano Banana Pro input parameters.

  <Expandable title="properties">
    <ParamField body="mode" type="string" required>
      Generation mode. Supported values: `text-to-image`, `image-to-image`.
    </ParamField>

    <ParamField body="prompt" type="string" required>
      Text prompt describing the desired image or edit. Supports 1-5000 characters and cannot be empty after trimming whitespace.
    </ParamField>

    <ParamField body="image_urls" type="string[]">
      Reference image URLs. Required for `image-to-image`. Supports up to 10 URLs; each item must be a non-empty string. Use public direct JPG, PNG, or WebP URLs. If sent with `text-to-image`, the URLs are validated but are not forwarded to the text generation route.
    </ParamField>

    <ParamField body="aspect_ratio" type="string" required>
      Output aspect ratio. Supported values: `1:1`, `4:3`, `3:4`, `3:2`, `2:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`.
    </ParamField>

    <ParamField body="resolution" type="string" required>
      Output resolution tier. Supported values: `1K`, `2K`, `4K`. Values are case-sensitive.
    </ParamField>

    <ParamField body="output_format" type="string" default="png">
      Output image format. Supported values: `png`, `jpg`. Default is `png`.
    </ParamField>
  </Expandable>
</ParamField>

## Response format

### Submit task response

`POST /generateTask/nano-banana-pro` returns a task ID when the task is accepted:

<ResponseField name="code" type="integer">
  API status code. `200` means the task was accepted.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable status message.
</ResponseField>

<ResponseField name="data.taskId" type="string">
  Unique task identifier used with the status endpoint.
</ResponseField>

### Status response fields

<ResponseField name="taskId" type="string">
  Unique task identifier.
</ResponseField>

<ResponseField name="state" type="string">
  Current task state: `pending`, `processing`, `success`, or `failed`.
</ResponseField>

<ResponseField name="resultJson" type="string">
  JSON string containing the generated image URLs. Present when `state` is `success`.
</ResponseField>

<ResponseField name="failCode" type="string">
  Machine-readable failure code. Present when `state` is `failed`.
</ResponseField>

<ResponseField name="failMsg" type="string">
  Human-readable failure message. Present when `state` is `failed`.
</ResponseField>

<ResponseField name="createTime" type="integer">
  Task creation timestamp in Unix milliseconds.
</ResponseField>

<ResponseField name="completeTime" type="integer">
  Task completion timestamp in Unix milliseconds. Present after completion.
</ResponseField>

<ResponseField name="costTime" type="integer">
  Processing duration in milliseconds. Nano Banana Pro normalizes provider timing to milliseconds.
</ResponseField>

## Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/nano-banana-pro" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "image-to-image",
      "prompt": "create a polished advertising image while preserving the product shape",
      "image_urls": [
        "https://example.com/product.png"
      ],
      "aspect_ratio": "1:1",
      "resolution": "4K",
      "output_format": "png"
    }
  }'
```

See [Webhooks](/api-reference/webhooks) for delivery requirements and retry behavior.

## Billing

Nano Banana Pro is billed per generated image. The selected `resolution` determines the unit price.

| Resolution  | APIXO price     | Market price    |
| ----------- | --------------- | --------------- |
| `1K` / `2K` | `$0.08 / image` | `$0.15 / image` |
| `4K`        | `$0.14 / image` | `$0.30 / image` |

For current route and market comparison pricing, see [Pricing](https://apixo.ai/pricing).

## Latency and polling

Actual latency may vary by prompt complexity, reference image availability, provider route, and current queue load.

| Resolution | Typical generation time | Recommended first poll  | Poll interval |
| ---------- | ----------------------- | ----------------------- | ------------- |
| `1K`       | 20s-30s                 | 20s after task creation | 3s            |
| `2K`       | 30s-45s                 | 20s after task creation | 3s            |
| `4K`       | 45s-60s                 | 20s after task creation | 3s-5s         |

<Tip>
  For high-concurrency production workloads, use callback mode to avoid frequent polling. Result URLs are valid for 15 days; download and store important outputs promptly.
</Tip>

Rate limits and concurrency can vary by account, API key, and route. If you receive `429`, slow down requests and retry with backoff. For account-level details, see [System APIs](/api-reference/system).

## Errors and troubleshooting

### HTTP errors

| Code  | Meaning                                                            | What to do                                       |
| ----- | ------------------------------------------------------------------ | ------------------------------------------------ |
| `400` | Invalid request body, mode, parameter, balance, or image URL shape | Fix the request before retrying                  |
| `401` | Missing or invalid API key                                         | Check the `Authorization` header                 |
| `402` | Insufficient balance or quota                                      | Add balance or switch account/key                |
| `403` | Key or route cannot access the model                               | Check permissions and route strategy             |
| `429` | Rate limit or concurrency limit reached                            | Retry with exponential backoff                   |
| `500` | Server error                                                       | Retry with backoff                               |
| `502` | Upstream provider error                                            | Retry with backoff                               |
| `504` | Upstream timeout                                                   | Retry or use callback mode for long-running jobs |

### Task failure codes

| Fail code              | Meaning                                               | What to do                                                                              |
| ---------------------- | ----------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `CONTENT_VIOLATION`    | Prompt or reference image failed safety checks        | Change the prompt or input image                                                        |
| `INVALID_IMAGE_URL`    | A reference image URL could not be fetched or decoded | Use a public, direct image URL                                                          |
| `INVALID_PARAMETER`    | A model parameter is unsupported or malformed         | Check `mode`, `prompt`, `aspect_ratio`, `resolution`, `image_urls`, and `output_format` |
| `INSUFFICIENT_BALANCE` | The account does not have enough balance for the task | Add balance before retrying                                                             |
| `UPSTREAM_ERROR`       | Provider-side failure                                 | Retry with backoff or try another route                                                 |
| `TIMEOUT`              | Generation did not finish in time                     | Retry, reduce input complexity, or use callback mode                                    |

### Parameter troubleshooting

| Symptom                            | Likely cause                                                             | Fix                                           |
| ---------------------------------- | ------------------------------------------------------------------------ | --------------------------------------------- |
| `Invalid mode type`                | `input.mode` is missing or unsupported                                   | Use `text-to-image` or `image-to-image`       |
| `aspect_ratio` validation error    | The value is missing or not one of the supported ratios                  | Send an exact supported ratio, such as `16:9` |
| `resolution` validation error      | The value is missing, lowercase, or unsupported                          | Send `1K`, `2K`, or `4K` exactly              |
| `output_format` validation error   | The format is unsupported or malformed                                   | Use `png` or `jpg`                            |
| Image-to-image task fails upstream | `image_urls` is empty, unreachable, too large, or not a direct image URL | Use 1-10 public direct image URLs             |

See [Error Codes](/api-reference/errors) for the full error reference.

## Related links

* [Generation API Overview](/models)
* [Generate Task](/api-reference/generate-task)
* [Status Task](/api-reference/status-task)
* [Webhooks](/api-reference/webhooks)
* [Error Codes](/api-reference/errors)
* [Parameter Specification](/api-reference/parameters)
* [Routing Strategies](/concepts/routing-strategies)
* [Pricing](https://apixo.ai/pricing)
