Skip to main content

model guide

Nano Banana 2

gemini-3.1-flash-image

Balanced

A balanced image route for everyday generation and image editing, with multiple output sizes and aspect ratios exposed by the current Studio configuration.

0.5K to 4KImage editingHigh throughput
Route receipt
Model ID
gemini-3.1-flash-image
Configured estimate
$0.055/ call
Output sizes
512 · 1K · 2K · 4K
API family
Gemini native

Prompt presets

These controls are read directly from YingTu’s model registry.

Product photo

A clean product photo of a matte ceramic coffee mug on a light stone table, soft window light, natural shadows, minimal styling.

Editorial landscape

An editorial travel photograph of a mountain lake at sunrise, layered atmospheric depth, natural color, fine detail.

Reference edit

Preserve the main subject and composition. Replace the background with a quiet modern studio using soft directional daylight.

Actual route configuration

Values on this page come from the same model registry used by the Image Studio.

Best for

  • Everyday image generation
  • Reference-guided edits
  • Testing several output sizes

Review before use

  • The listed speed is an estimate, not a delivery guarantee.
  • Editing quality depends on the reference image and instruction.
  • Check text, logos, hands, and small details before use.
Image editing: Supported

API quickstart

The sample is generated by the same code helper used in the existing Studio.

View API page
gemini-3.1-flash-image
import requests
import base64

# Configuration
API_KEY = "sk-YOUR_API_KEY"  # Replace with your API Key
API_URL = "https://api2.laozhang.ai/v1beta/models/gemini-3.1-flash-image:generateContent"

# Request headers
headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Build request payload
payload = {
    "contents": [{
        "parts": [{"text": "A clean product photo of a matte ceramic coffee mug on a light stone table, soft window light, natural shadows, minimal styling."}]
    }],
    "generationConfig": {
        "responseModalities": ["IMAGE"],
        "imageConfig": {
            "imageSize": "2K"
        }
    }
}

# Send request
print("Generating image...")
response = requests.post(API_URL, headers=headers, json=payload, timeout=180)

if response.status_code != 200:
    print(f"Error: {response.status_code} - {response.text}")
    exit(1)

# Extract and save image
result = response.json()

image_part = None
for candidate in result.get("candidates", []):
    for part in candidate.get("content", {}).get("parts", []):
        inline_data = part.get("inlineData") or part.get("inline_data")
        if inline_data and inline_data.get("data"):
            image_part = inline_data
            break
    if image_part:
        break

if not image_part:
    print("No image data in response")
    print(result)
    exit(1)

mime_type = image_part.get("mimeType") or image_part.get("mime_type") or "image/png"
extension = "jpg" if mime_type == "image/jpeg" else "webp" if mime_type == "image/webp" else "png"
output_path = f"output.{extension}"

with open(output_path, "wb") as f:
    image_data = image_part["data"]
    f.write(base64.b64decode(image_data))

print(f"✅ Image saved: {output_path}")

Existing Studio gallery

These legacy gallery images have no model or prompt provenance. They are visual examples only, not evidence for the route on this page.

Unattributed Studio example
Unattributed Studio example
Unattributed Studio example