Developer Dashboard

New Model Added: Gemini 3.1 Flash Lite Image (Nano Banana 2 Lite)

Date: 2026-07-01 / (1405-04-10)

Summary

We announce the addition of Google's Gemini 3.1 Flash Lite Image (gemini-3.1-flash-lite-image), also known as "Nano Banana 2 Lite". This model is the efficiency specialist of the Gemini image generation family, delivering ultra-low latency and cost-effective image generation and editing through the v1/chat/completions endpoint, making it well suited for high-volume interactive and real-time applications.


Details

Google Gemini 3.1 Flash Lite Image (Nano Banana 2 Lite)

Google's gemini-3.1-flash-lite-image (also known as "Nano Banana 2 Lite") is now available through AvalAI. This model targets sub-2 second latency and significantly reduced compute costs, enabling high-volume interactive developer use cases and real-time consumer applications while maintaining Nano Banana quality.

Model Name: gemini-3.1-flash-lite-image
Alias: Nano Banana 2 Lite

Key Features

  • Sub-2 Second Latency: Optimized for ultra-low, end-to-end latency for rapid, interactive iteration
  • Cost-Efficient at Scale: Generate thousands of images at a fraction of the cost of heavier production models
  • Interleaved Generation and Editing: Native support for Text → Text + Image(s) and Image + Text → Text + Image(s)
  • Fast Multi-Turn Local Edits: Swap colors, create stickers, and adjust backgrounds in rapid conversational turns
  • Character Consistency: Maintains high character alignment matching original Nano Banana standards
  • 14 Aspect Ratios: Supports 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, and additional standard formats
  • Optimized for 1K Resolution: image_size value 1024px (1K) is supported (2K and 4K are not supported)
  • Function Calling & Thinking: Function calling and thinking (minimal and high) supported
  • SynthID + C2PA Watermarking: Always-on watermarking for AI-generated images

Pricing

TypeCost
Input Text$0.25 per 1M tokens
Input Image$0.25 per 1M tokens
Cached Input$0.05 per 1M tokens
Output Text$1.50 per 1M tokens
Output Image (1K)$0.0336 per image
Output Image (2048x2048)$0.0672 per image
Output Image (4096x4096)$0.1344 per image

Note: Image output is priced at $30 per 1M tokens. Output images at 1K (1024x1024px) consume approximately 1,120 tokens, equivalent to $0.0336 per image.

Understanding the Nano Banana Family

Nano Banana is the name for Gemini's native image generation capabilities. Gemini can generate and process images conversationally with text, images, or a combination of both:

  • Nano Banana 2 Lite (gemini-3.1-flash-lite-image): The efficiency specialist, optimized for ultra-low latency and cost-effective, high-volume image generation and editing at 1K resolution
  • Nano Banana 2 (gemini-3.1-flash-image): The high-efficiency counterpart to Gemini 3 Pro Image, optimized for speed and high-volume developer use cases with up to 4K resolution
  • Nano Banana Pro (gemini-3-pro-image): Designed for professional asset production with advanced reasoning ("Thinking") for complex instructions and high-fidelity text
  • Nano Banana (gemini-2.5-flash-image): Designed for speed and efficiency, optimized for high-volume, low-latency tasks

API Request/Response Examples

Using Chat Completions Endpoint:

bash
curl https://api.avalai.ir/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -d '{
    "model": "gemini-3.1-flash-lite-image",
    "messages": [
      {
        "role": "user",
        "content": "Create a photorealistic macro photograph of a colorful spider covered in water droplets on its web"
      }
    ],
    "modalities": ["image", "text"]
  }' | jq '.choices[0].message.images[0].image_url.url |= (.[0:100] + "...[TRUNCATED]")'

Response:

json
{
  "id": "chatcmpl-abc789",
  "created": 1782000000,
  "model": "gemini-3.1-flash-lite-image",
  "object": "chat.completion",
  "system_fingerprint": null,
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "I've created a photorealistic macro photograph of a colorful spider covered in water droplets on its web.",
        "role": "assistant",
        "images": [
          {
            "image_url": {
              "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zU...[TRUNCATED]",
              "detail": "auto"
            },
            "index": 0,
            "type": "image_url"
          }
        ],
        "thinking_blocks": [],
        "annotations": []
      }
    }
  ],
  "usage": {
    "completion_tokens": 1120,
    "prompt_tokens": 24,
    "total_tokens": 1144,
    "completion_tokens_details": null,
    "prompt_tokens_details": {
      "audio_tokens": null,
      "cached_tokens": null,
      "text_tokens": 24,
      "image_tokens": null
    }
  },
  "estimated_cost": {
    "unit": "0.0336060000",
    "irt": 3851.24,
    "exchange_rate": 114600
  }
}

SDK Usage Examples

bash
curl https://api.avalai.ir/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -d '{
    "model": "gemini-3.1-flash-lite-image",
    "messages": [
      {
        "role": "user",
        "content": "Create a modern logo for a tech company called \"AvalAI\" with clean typography and a minimalist design"
      }
    ],
    "modalities": ["image", "text"]
  }'
python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

response = client.chat.completions.create(
    model="gemini-3.1-flash-lite-image",
    messages=[
        {
            "role": "user",
            "content": 'Create a modern logo for a tech company called "AvalAI" with clean typography and a minimalist design',
        }
    ],
    extra_body={"modalities": ["image", "text"]},
)

# Access the generated image
if hasattr(response.choices[0].message, "images"):
    images = getattr(response.choices[0].message, "images")
    for img in images:
        print(f"Image URL: {img.image_url.url[:100]}...")

print(response.choices[0].message.content)
javascript
import { OpenAI } from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
});

const response = await client.chat.completions.create({
  model: "gemini-3.1-flash-lite-image",
  messages: [
    {
      role: "user",
      content: "Create a modern logo for a tech company called \"AvalAI\" with clean typography and a minimalist design",
    },
  ],
  modalities: ["image", "text"],
});

// Access the generated image
if (response.choices[0].message.images) {
  const images = response.choices[0].message.images;
  images.forEach((img, idx) => {
    console.log(`Image ${idx}: ${img.image_url.url.substring(0, 100)}...`);
  });
}

console.log(response.choices[0].message.content);

Image Editing Example

Because Nano Banana 2 Lite supports interleaved generation and editing, you can perform fast multi-turn local edits by sending an existing image alongside a text instruction:

bash
curl https://api.avalai.ir/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -d '{
    "model": "gemini-3.1-flash-lite-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Change the background of this product photo to a soft studio gradient"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://example.com/original-image.jpg"
            }
          }
        ]
      }
    ],
    "modalities": ["image", "text"]
  }'
python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

response = client.chat.completions.create(
    model="gemini-3.1-flash-lite-image",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Change the background of this product photo to a soft studio gradient",
                },
                {
                    "type": "image_url",
                    "image_url": {"url": "https://example.com/original-image.jpg"},
                },
            ],
        }
    ],
    extra_body={"modalities": ["image", "text"]},
)
javascript
import { OpenAI } from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
});

const response = await client.chat.completions.create({
  model: "gemini-3.1-flash-lite-image",
  messages: [
    {
      role: "user",
      content: [
        {
          type: "text",
          text: "Change the background of this product photo to a soft studio gradient",
        },
        {
          type: "image_url",
          image_url: { url: "https://example.com/original-image.jpg" },
        },
      ],
    },
  ],
  modalities: ["image", "text"],
});

Setting Aspect Ratio

Nano Banana 2 Lite supports 14 aspect ratios at 1K resolution. When using the OpenAI-compatible endpoint, pass Gemini-specific settings via extra_body:

python
response = client.chat.completions.create(
    model="gemini-3.1-flash-lite-image",
    messages=[
        {
            "role": "user",
            "content": "A dynamic action shot of a swimmer performing the butterfly stroke",
        }
    ],
    modalities=["image", "text"],
    extra_body={
        "generationConfig": {"imageConfig": {"aspectRatio": "16:9", "imageSize": "1K"}}
    },
)

Native Gemini SDK Example

You can also use the native Gemini API (v1beta) to access this model with Google's official SDK:

python
from google import genai
from google.genai import types

client = genai.Client(
    api_key="your-avalai-api-key",
    http_options=types.HttpOptions(base_url="https://api.avalai.ir/v1beta"),
)

prompt = (
    "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"
)
response = client.models.generate_content(
    model="gemini-3.1-flash-lite-image",
    contents=[prompt],
)

for part in response.parts:
    if part.text is not None:
        print(part.text)
    elif part.inline_data is not None:
        image = part.as_image()
        image.save("generated_image.png")