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

# Image introduction

# Gemini Image Generation (Nano Banana)

Create and edit high-quality images using Google's **Nano Banana** models. Supports text-to-image generation and image editing with multiple aspect ratios and resolutions up to 4K.

## Supported Models

| Model              | Description                                                         | Max Resolution |
| ------------------ | ------------------------------------------------------------------- | -------------- |
| `nano-banana-fast` | Fast generation (default) — balanced quality & speed                | 1K             |
| `nano-banana-pro`  | Professional quality — supports up to 4K                            | 4K             |
| `nano-banana-2`    | Latest model — supports extended aspect ratios (1:4, 4:1, 1:8, 8:1) | 4K             |

## Features

<CardGroup cols={2}>
  <Card title="Text-to-Image" icon="wand-magic-sparkles">
    Generate images from text prompts with `action: "generate"`
  </Card>

  <Card title="Image Editing" icon="pen">
    Edit existing images using reference URLs with `action: "edit"`
  </Card>

  <Card title="Flexible Aspect Ratios" icon="expand">
    21:9, 16:9, 9:16, 4:3, 3:2, 5:4, 1:1, and more — up to 1:8 / 8:1 on nano-banana-2
  </Card>

  <Card title="High Resolution" icon="image">
    1K / 2K / 4K output on Pro and 2 models
  </Card>
</CardGroup>

## How to Use

<Steps>
  <Step title="Create an image task">
    Call `POST /gemini/image/generate` with your prompt, model, and aspect ratio. You'll receive a `taskId`.
  </Step>

  <Step title="Poll for results">
    Use `GET /gemini/task/result?taskId=xxx` to poll until status is `completed`. The result contains the generated image.
  </Step>
</Steps>

## Quick Example

<CodeGroup>
  ```bash Generate Image theme={null}
  curl -X POST "https://api.mountsea.ai/gemini/image/generate" \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "prompt": "A futuristic city skyline at night, neon lights reflecting on wet streets",
      "action": "generate",
      "model": "nano-banana-pro",
      "aspect_ratio": "16:9",
      "resolution": "2K"
    }'
  ```

  ```bash Edit Image theme={null}
  curl -X POST "https://api.mountsea.ai/gemini/image/generate" \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "prompt": "Add snow to the scene",
      "action": "edit",
      "model": "nano-banana-fast",
      "image_urls": ["https://example.com/source.jpg"],
      "aspect_ratio": "1:1"
    }'
  ```

  ```bash Poll Task Status theme={null}
  curl -X GET "https://api.mountsea.ai/gemini/task/result?taskId=your-task-id" \
    -H "Authorization: Bearer your-api-key"
  ```
</CodeGroup>

## Aspect Ratios

| Ratio                                               | Standard Models | nano-banana-2 Only |
| --------------------------------------------------- | --------------- | ------------------ |
| 1:1, 4:3, 3:2, 5:4, 3:4, 4:5, 16:9, 9:16, 21:9, 2:3 | ✅               | ✅                  |
| 1:4, 4:1, 1:8, 8:1                                  | ❌               | ✅                  |

## Resolution Options

* **`nano-banana-fast`** — fixed 1K resolution
* **`nano-banana-pro`** — `1K` / `2K` / `4K`
* **`nano-banana-2`** — `1K` / `2K` / `4K`

<Tip>
  Use `nano-banana-2` when you need unusual aspect ratios like 1:8 (vertical banner) or 8:1 (horizontal banner). Use `nano-banana-pro` for the highest quality output at 4K.
</Tip>

## Available Endpoints

| Endpoint                 | Method | Description                               |
| ------------------------ | ------ | ----------------------------------------- |
| `/gemini/image/generate` | POST   | Generate or edit images with Nano Banana  |
| `/gemini/task/result`    | GET    | Shared poll for image **and** video tasks |

***

### Explore the API Documentation

* [Generate Image](image) — Create or edit images with Nano Banana
* [Get Task Result](/api-reference/gemini/task) — Shared poll for video & image tasks

<Info>
  Looking for Gemini API SDK compatibility? See [Gemini Compat](/api-reference/gemini/compat-introduction) to use the official **@google/genai** library directly.
</Info>
