BeeRoute logoBeeRoute.

Home / Docs / Nano-banana Image Generation API

Nano-banana Image Generation API

Download this document as MD file

Endpoint Path: POST /v1/images/generations

Recommended Models:

nano-banana-2.1 (latest, based on Gemini 3.6 Flash: 1K–4K output, up to 14 reference images, about half the price of the previous generation)

nano-banana-pro (highest quality, based on Gemini 3 Pro Image: best for 4K posters and text-heavy images)

Older models (nano-banana, nano-banana-2, nano-banana-2-lite) can still be called for existing integrations; new projects should use the two models above.

Note: Generated image URLs are temporary links (valid for 2 hours). Please save important works locally.


Model Comparison

Featurenano-banana-2.1nano-banana-pro
Best forFast, low-cost generation and editingHighest quality, 4K, text rendering
Supported EndpointImage generation endpointImage generation endpoint
Return FormatURL or Base64URL or Base64
Aspect Ratio Setting✅ Supported✅ Supported
Image Size Setting✅ Supported (1K/2K/4K)✅ Supported (1K/2K/4K)
Native Web Access✅ Supported✅ Supported
Image-to-Image✅ Supported (up to 14 images)✅ Supported
Charge on Failure✅ No charge✅ No charge
Compatible FormatDALL·E formatDALL·E format

To call Google's native Gemini image API instead, see Gemini Native (generateContent).


Request Parameters

ParameterTypeRequiredDefaultDescription
Authorizationstring✅Bearer {{YOUR_API_KEY}}API authentication token
Content-Typestring✅application/jsonRequest body type

Body (application/json)

ParameterTypeRequiredDefaultDescription
modelstring✅-Model name: nano-banana-2.1 or nano-banana-pro
promptstring✅-Image description text (supports both Chinese and English)
aspect_ratioenum[string]✅autoImage aspect ratio: auto, 1:1, 4:3, 3:4, 16:9, 9:16, 2:3, 3:2, 4:5, 5:4, 21:9
response_formatstring❌urlReturn format: url or b64_json
imagearray[string]❌-Image-to-image reference image list (URL or Base64), one or more images
image_sizeenum[string]❌1KOutput size: 1K, 2K, 4K
searchboolean❌falseWhether to enable native web access

📌 Usage Scenario Examples


1. Text-to-Image

Generate an image using only a text prompt, without passing the image parameter.

1.1 Basic Text-to-Image

JSON Body

{
    "model": "nano-banana-2.1",
    "prompt": "An orange cat lying on a windowsill basking in the sun, with cherry blossoms in full bloom outside the window in spring",
    "aspect_ratio": "16:9"
}

cURL

curl -X POST 'https://beeroute.ai/v1/images/generations' \
  -H 'Authorization: Bearer {{YOUR_API_KEY}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "nano-banana-2.1",
    "prompt": "An orange cat lying on a windowsill basking in the sun, with cherry blossoms in full bloom outside the window in spring",
    "aspect_ratio": "16:9"
}'

1.2 High-Definition Text-to-Image (4K Quality)

JSON Body

{
    "model": "nano-banana-pro",
    "prompt": "A cyberpunk-style futuristic city at night, neon lights reflected on rain-soaked streets, 4K ultra HD",
    "aspect_ratio": "21:9",
    "image_size": "4K"
}

cURL

curl -X POST 'https://beeroute.ai/v1/images/generations' \
  -H 'Authorization: Bearer {{YOUR_API_KEY}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "nano-banana-pro",
    "prompt": "A cyberpunk-style futuristic city at night, neon lights reflected on rain-soaked streets, 4K ultra HD",
    "aspect_ratio": "21:9",
    "image_size": "4K"
}'

1.3 Web-Connected Text-to-Image (Real-Time Information)

After enabling search, the model can fetch real-time web information to assist generation.

JSON Body

{
    "model": "nano-banana-2.1",
    "prompt": "Generate a promotional image of the latest 2025 Porsche 911 Turbo S, set on a race track",
    "aspect_ratio": "16:9",
    "image_size": "2K",
    "search": true
}

cURL

curl -X POST 'https://beeroute.ai/v1/images/generations' \
  -H 'Authorization: Bearer {{YOUR_API_KEY}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "nano-banana-2.1",
    "prompt": "Generate a promotional image of the latest 2025 Porsche 911 Turbo S, set on a race track",
    "aspect_ratio": "16:9",
    "image_size": "2K",
    "search": true
}'

1.4 Returning Base64 Format

JSON Body

{
    "model": "nano-banana-2.1",
    "prompt": "Watercolor-style sunrise over Mount Fuji, with its reflection on the lake in the foreground",
    "aspect_ratio": "3:2",
    "response_format": "b64_json"
}

2. Image-to-Image

Pass the image parameter (the reference image's URL or Base64), and combine it with a prompt to perform style transfer, editing, extension, and other operations on the image.

2.1 Image-to-Image — Passing an Image URL

JSON Body

{
    "model": "nano-banana-2.1",
    "prompt": "Convert this photo into Studio Ghibli animation style, keeping the original composition while making the colors warmer and brighter",
    "aspect_ratio": "auto",
    "image": [
        "https://example.com/my-photo.jpg"
    ]
}

cURL

curl -X POST 'https://beeroute.ai/v1/images/generations' \
  -H 'Authorization: Bearer {{YOUR_API_KEY}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "nano-banana-2.1",
    "prompt": "Convert this photo into Studio Ghibli animation style, keeping the original composition while making the colors warmer and brighter",
    "aspect_ratio": "auto",
    "image": [
        "https://example.com/my-photo.jpg"
    ]
}'

2.2 Image-to-Image — Passing a Base64 Image

JSON Body Example (Base64 shown truncated)

{
    "model": "nano-banana-2.1",
    "prompt": "Turn this portrait photo into a cyberpunk-style illustration with neon lighting effects",
    "aspect_ratio": "1:1",
    "image": [
        "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA..."
    ]
}

2.3 Image-to-Image — Multi-Image Reference Fusion

Pass multiple reference images, and the model will create based on a comprehensive reference of all images.

JSON Body

{
    "model": "nano-banana-pro",
    "prompt": "Blend the person from the first image into the scene of the second image, keeping it natural and harmonious with consistent lighting",
    "aspect_ratio": "4:3",
    "image_size": "2K",
    "image": [
        "https://example.com/person.jpg",
        "https://example.com/background.jpg"
    ]
}

cURL

curl -X POST 'https://beeroute.ai/v1/images/generations' \
  -H 'Authorization: Bearer {{YOUR_API_KEY}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "nano-banana-pro",
    "prompt": "Blend the person from the first image into the scene of the second image, keeping it natural and harmonious with consistent lighting",
    "aspect_ratio": "4:3",
    "image_size": "2K",
    "image": [
        "https://example.com/person.jpg",
        "https://example.com/background.jpg"
    ]
}'

2.4 Image-to-Image — High-Definition Image Editing

JSON Body

{
    "model": "nano-banana-2.1",
    "prompt": "Add a vivid rainbow to this landscape photo and shift the sky to warm sunset tones",
    "aspect_ratio": "16:9",
    "image_size": "4K",
    "image": [
        "https://example.com/landscape.jpg"
    ]
}

3. Response Format

Success Response (HTTP 200)

Returning URL Format (default)

{
    "data": [
        {
            "url": "https://example.com/generated_image.png"
        }
    ]
}

Returning Base64 Format

{
    "data": [
        {
            "b64_json": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
        }
    ]
}

4. Common Scenarios Quick Reference

ScenarioRecommended ModelKey ParametersPrompt Example
Basic Text-to-Imagenano-banana-2.1aspect_ratio"A corgi running on the grass"
4K Posternano-banana-proimage_size: "4K""Cinematic sci-fi poster, space station scene"
Style Transfernano-banana-2.1image: [url]"Convert to oil painting style"
Image Editingnano-banana-proimage: [url], image_size"Remove the background and replace it with a beach"
Multi-Image Fusionnano-banana-proimage: [url1, url2]"Combine the two images into one"
Web-Connected Generationnano-banana-2.1search: true"Concept design of the latest 2025 iPhone"
Phone Wallpapernano-banana-2.1aspect_ratio: "9:16""Aurora and starry sky wallpaper, dreamy purple tones"
Social Covernano-banana-2.1aspect_ratio: "16:9", image_size: "2K""Minimalist tech-style profile cover"

5. Key Notes

  1. Image Link Validity: The returned URL is a temporary link that expires after 2 hours. Please download and save it promptly.
  2. No Charge on Failure: No quota is deducted when generation fails.
  3. Image-to-Image image Parameter: Supports passing image URLs or Base64 strings, which can be mixed, with one or more images.
  4. image_size: 1K, 2K, or 4K (uppercase K).
  5. search: set to true to let the model use real-time web information.
  6. Prompt Tips: The more detailed the description, the better the generated result; mixed Chinese-English prompts are supported.

Last updated 2026-11-29 · Markdown source · llms.txt