# Google Nano Banana 2 Model Specification

Google Nano Banana 2 is a high-speed, versatile generative image synthesis model. It excels in photorealistic generation, complex multi-element compositions, rich typography, dynamic lighting, and reference image guidance across a comprehensive range of aspect ratios and resolutions.

---

## 1. Quick Overview

* **Model Slug:** `nano-banana-2`
* **Endpoint:** `POST https://api.amandevelops.com/v1/nano-banana-2/`
* **Category:** Text-to-Image & Image-to-Image Diffusion
* **Output Formats:** JPEG (`jpg`) or PNG (`png`)
* **Resolution Tiers:** `1K` ($0.0400), `2K` ($0.0600), `4K` ($0.0900)
* **Status Polling:** Pure-database polling at `GET /v1/tasks/{task_id}`
* **Webhooks:** Optional signed webhook callbacks upon job completion

---

## 2. API Request Specification

* **HTTP Method:** `POST`
* **Path:** `/v1/nano-banana-2/`
* **Headers:**
  ```http
  Authorization: Bearer <YOUR_API_KEY>
  Content-Type: application/json
  ```

### Full JSON Request Schema

```json
{
  "prompt": "Comic poster: cool banana hero in shades leaps from sci-fi pad. Six panels: 1) 4K mountain landscape, 2) banana holds page of long multilingual text with auto translation, 3) Gemini 3 hologram for search/knowledge/reasoning, 4) camera UI sliders for angle focus color, 5) frame trio 1:1-9:16, 6) consistent banana poses. Footer shows Google icons.",
  "aspect_ratio": "16:9",
  "resolution": "1K",
  "output_format": "jpg",
  "image_input": [],
  "webhook_url": "https://your-domain.com/api/webhooks/image-completed"
}
```

---

## 3. Parameter Reference

| Parameter | Type | Required? | Default | Description |
|---|---|---|---|---|
| `prompt` | `string` | **Required** | — | Detailed text description of the image to generate (up to 20,000 characters). |
| `aspect_ratio` | `string` | Optional | `"auto"` | Target canvas proportion. See table below for supported values. |
| `resolution` | `string` | Optional | `"1K"` | Output detail tier: `"1K"` ($0.0400), `"2K"` ($0.0600), or `"4K"` ($0.0900). |
| `output_format` | `string` | Optional | `"jpg"` | Target file format: `"jpg"` or `"png"`. |
| `image_input` | `array` | Optional | `[]` | Array of public HTTP/HTTPS image URLs to use as visual references or for image-to-image transformations (Max 14 URLs). |
| `webhook_url` | `string` | Optional | `null` | Your webhook URL to receive an automated HTTP POST notification when generation completes. |

---

## 4. Supported Aspect Ratios

Nano Banana 2 provides native framing calibration across 15 aspect ratio configurations:

| Aspect Ratio | Orientation | Ideal Use Cases |
|---|---|---|
| `auto` | Adaptive | Dynamic automatic composition based on prompt semantics |
| `1:1` | Square | Instagram posts, avatars, product thumbnails, icons |
| `16:9` | Widescreen Landscape | YouTube thumbnails, desktop wallpapers, cinematic scenes |
| `9:16` | Vertical / Story | TikTok, Instagram Stories, YouTube Shorts, mobile wallpapers |
| `4:3` | Standard Landscape | Editorial photography, classic compositions |
| `3:4` | Standard Portrait | Portrait photography, posters, magazine layouts |
| `3:2` | Classic 35mm Photo | Professional DSLR photography format |
| `2:3` | Classic 35mm Portrait | Full-body fashion portraits, book covers |
| `4:5` | Social Portrait | Standard Instagram feed vertical photo |
| `5:4` | Large Format Landscape | Fine-art landscape photography |
| `21:9` | Ultrawide Cinematic | Anamorphic cinematic panoramas, dual-monitor banners |
| `1:4` | Ultra-tall Vertical | Skyscraper banners, web page sidebars |
| `4:1` | Ultra-wide Banner | Website hero headers, panoramic landscape strips |
| `1:8` | Extreme Tall Banner | Vertical timeline strips, architectural towers |
| `8:1` | Extreme Wide Banner | Ultra-panoramic panoramic headers |

---

## 5. Pricing & Wallet Economics

Requests to `nano-banana-2` are billed dynamically in USD from your prepaid wallet balance based on the requested resolution:

| Resolution Tier | Price (USD) | Description |
|---|---|---|
| **1K** | **$0.0400** | High-efficiency standard resolution ($0.04 per image) |
| **2K** | **$0.0600** | Enhanced resolution for professional print & presentation ($0.06 per image) |
| **4K** | **$0.0900** | Ultra-high definition with maximum fine texture detail ($0.09 per image) |

> [!TIP]
> **Automated Failure Refund:**
> If an upstream generation encounters an unforeseen failure, the reserved funds are automatically returned to your wallet balance immediately.

---

## 6. Asynchronous Request Lifecycle

Nano Banana 2 runs on an asynchronous non-blocking engine:

### 1. Ingress Response (`HTTP 202 Accepted` in < 20ms)
```json
{
  "status": "success",
  "code": "TASK_QUEUED",
  "message": "Generation task accepted and queued for inference.",
  "task_id": "task_nb2_8f2a1b9c3e4d5678",
  "model": "nano-banana-2",
  "state": "queued",
  "cost_usd": 0.0400,
  "remaining_balance_usd": 14.9600,
  "poll_url": "https://api.amandevelops.com/v1/tasks/task_nb2_8f2a1b9c3e4d5678",
  "created_at": "2026-09-18 04:00:00"
}
```

### 2. Status Polling (`GET /v1/tasks/{task_id}`)
Poll the task status from our high-speed database index:

```http
GET /v1/tasks/task_nb2_8f2a1b9c3e4d5678
Authorization: Bearer <YOUR_API_KEY>
```

**Completed Response:**
```json
{
  "status": "success",
  "state": "completed",
  "task_id": "task_nb2_8f2a1b9c3e4d5678",
  "model": "nano-banana-2",
  "result_url": "https://api.amandevelops.com/storage/nano-banana-2/img_nb2_7c8d9e0f1a2b.jpg",
  "is_expired": false,
  "expires_at": "2026-09-20T04:01:25Z",
  "webhook_status": "delivered",
  "created_at": "2026-09-18 04:00:00",
  "completed_at": "2026-09-18 04:00:18"
}
```

---

## 7. Runnable Code Examples

### cURL
```bash
curl -X POST "https://api.amandevelops.com/v1/nano-banana-2/" \
  -H "Authorization: Bearer ak_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Cyberpunk street market at dusk, neon signs reflecting in puddles, cinematic lighting, 8k",
    "aspect_ratio": "16:9",
    "resolution": "1K",
    "output_format": "jpg"
  }'
```

### JavaScript (Fetch API)
```javascript
const response = await fetch("https://api.amandevelops.com/v1/nano-banana-2/", {
  method: "POST",
  headers: {
    "Authorization": "Bearer ak_live_YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    prompt: "Futuristic solar-powered metropolis with hanging gardens, aerial view, volumetric sun rays",
    aspect_ratio: "16:9",
    resolution: "2K",
    output_format: "png"
  })
});

const data = await response.json();
console.log("Task ID:", data.task_id);
console.log("Cost USD:", data.cost_usd);
console.log("Poll URL:", data.poll_url);
```

### Python (Requests)
```python
import requests
import time

API_KEY = "ak_live_YOUR_API_KEY"
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# 1. Enqueue task
payload = {
    "prompt": "An astronaut riding a glowing translucent jellyfish in deep space, cosmic nebula, highly detailed",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "output_format": "jpg"
}

response = requests.post("https://api.amandevelops.com/v1/nano-banana-2/", json=payload, headers=HEADERS)
task_data = response.json()
task_id = task_data["task_id"]
print(f"Enqueued Task ID: {task_id}, Charged: ${task_data['cost_usd']:.4f}")

# 2. Poll for result
while True:
    status_res = requests.get(f"https://api.amandevelops.com/v1/tasks/{task_id}", headers=HEADERS).json()
    state = status_res.get("state")
    print(f"Current State: {state}")
    
    if state == "completed":
        print(f"Image ready: {status_res['result_url']}")
        break
    elif state == "failed":
        print(f"Task failed: {status_res.get('error')}")
        break
        
    time.sleep(2)
```