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

# nanobanana

> Public nano-banana image generation and image editing API

`nanobanana` is the API model ID for the public nano-banana catalog model. It supports asynchronous image generation and image editing through the same `POST /v1/generate` endpoint.

| Field               | Value                      |
| ------------------- | -------------------------- |
| Public catalog name | `nano-banana`              |
| API model ID        | `nanobanana`               |
| Processing          | Async task                 |
| Generate task type  | `image_generate`           |
| Edit task type      | `image_edit`               |
| Base cost           | `$0.0100` per output image |

## Generate an Image

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.eggapi.ai/v1/generate \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "nanobanana",
      "prompt": "A clean editorial photo of a lemon tart on a steel table",
      "aspect_ratio": "16:9",
      "num_outputs": 1
    }'
  ```

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

  response = requests.post(
      "https://api.eggapi.ai/v1/generate",
      headers={"Authorization": "Bearer YOUR_API_KEY"},
      json={
          "model": "nanobanana",
          "prompt": "A clean editorial photo of a lemon tart on a steel table",
          "aspect_ratio": "16:9",
          "num_outputs": 1,
      },
  )

  task = response.json()["data"]
  print(task["id"])
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.eggapi.ai/v1/generate", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "nanobanana",
      prompt: "A clean editorial photo of a lemon tart on a steel table",
      aspect_ratio: "16:9",
      num_outputs: 1
    })
  });

  const { data: task } = await response.json();
  console.log(task.id);
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "data": {
    "id": "gen_abc123def456",
    "status": "pending",
    "model": "nanobanana",
    "type": "image_generate",
    "cost": "$0.00",
    "created_at": "2026-05-08T10:30:00Z"
  },
  "error": null
}
```

Poll `GET /v1/tasks/{id}` for the final output.

## Edit an Image

Send `image_urls` to switch into image editing mode:

```bash theme={null}
curl -X POST https://api.eggapi.ai/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nanobanana",
    "prompt": "Replace the background with a quiet marble kitchen",
    "image_urls": ["https://example.com/input.png"]
  }'
```

Response:

```json theme={null}
{
  "data": {
    "id": "gen_edit123456",
    "status": "pending",
    "model": "nanobanana",
    "type": "image_edit",
    "cost": "$0.00",
    "created_at": "2026-05-08T10:30:00Z"
  },
  "error": null
}
```

## Completed Output

```json theme={null}
{
  "data": {
    "id": "gen_abc123def456",
    "status": "completed",
    "model": "nanobanana",
    "type": "image_generate",
    "output": {
      "url": "https://file.eggapi.ai/images/gen_abc123def456/0.png",
      "urls": ["https://file.eggapi.ai/images/gen_abc123def456/0.png"]
    },
    "cost": "$0.0100",
    "created_at": "2026-05-08T10:30:00Z",
    "started_at": "2026-05-08T10:30:01Z",
    "completed_at": "2026-05-08T10:30:10Z"
  },
  "error": null
}
```
