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

# Nano Banana 2 Lite API

> Nano Banana 2 Lite API docs for gemini-3.1-flash-lite-image: $0.025/call, 1K generation and editing, 14 ratios, plus OpenAI and Gemini code.

<Note>
  **Nano Banana 2 Lite: the low-cost, high-frequency image route**

  * **Stable model ID**: `gemini-3.1-flash-lite-image`
  * **LaoZhang API price**: currently **\$0.025/call**; confirm final pricing and charges in the console
  * **Model fit**: 1K text-to-image, image editing, batch drafts, real-time interaction, and high-concurrency workflows
  * **API contracts**: OpenAI-compatible `/v1/chat/completions` or Gemini-native `generateContent`
</Note>

<CardGroup cols={2}>
  <Card title="Create an API Key" icon="key" href="https://api.laozhang.ai/token">
    Create a per-call token and inspect every call record
  </Card>

  <Card title="View the Image API Selection Guide" icon="banana" href="/en/api-capabilities/image-generation-guide">
    Compare Standard, Lite, Nano Banana 2, and Pro
  </Card>
</CardGroup>

## Why Lite fits low-cost, high-throughput workloads

Nano Banana 2 Lite is the market name for Google Gemini 3.1 Flash Lite Image. [Google's image generation guide](https://ai.google.dev/gemini-api/docs/image-generation) positions it as the image family's efficiency specialist for low-latency, high-volume interactive applications. Its stable model ID is `gemini-3.1-flash-lite-image`.

| Item                      | Nano Banana 2 Lite                                                       |
| ------------------------- | ------------------------------------------------------------------------ |
| Model ID                  | `gemini-3.1-flash-lite-image`                                            |
| Version                   | Stable (GA), not preview                                                 |
| LaoZhang API price        | **\$0.025/call**                                                         |
| Google Standard reference | \$0.0336/image at 1K                                                     |
| Resolution                | 1K (1024px) only                                                         |
| Aspect ratios             | 14 discrete ratios                                                       |
| Input                     | Text and image                                                           |
| Output                    | Image and text                                                           |
| Image editing             | Supported                                                                |
| Batch API                 | Supported by the Google model; this LaoZhang route is currently per-call |
| Google Search grounding   | Not supported                                                            |

<Tip>
  For 2K/4K, video-to-image, or Google Image Search grounding, use [Nano Banana 2 API](/en/api-capabilities/nano-banana2-image). For the most complex professional assets and precise brand control, use [Nano Banana Pro API](/en/api-capabilities/nano-banana-pro-image).
</Tip>

## Why the price fits batch workloads

LaoZhang API currently provides a per-call Nano Banana 2 Lite route at \$0.025 each. [Google's July 2026 Standard reference](https://ai.google.dev/gemini-api/docs/pricing) is \$0.0336 per 1K image. A simple 10,000-call price calculation looks like this:

| Route                |       Unit price | Static estimate for 10,000 calls |
| -------------------- | ---------------: | -------------------------------: |
| LaoZhang API Lite    | **\$0.025/call** |                        **\$250** |
| Google Standard Lite |   \$0.0336/image |                            \$336 |

<Info>
  This is a unit-price multiplication, not a total-cost guarantee. It excludes retries, input tokens, exchange rates, promotions, taxes, and storage. “Cheapest” should never be treated as a permanent claim across every date, region, provider, and contract.
</Info>

## OpenAI-compatible request

### Curl

```bash theme={null}
curl -X POST "https://api.laozhang.ai/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-lite-image",
    "stream": false,
    "messages": [
      {
        "role": "user",
        "content": "Create a square minimalist coffee product image on warm white with soft shadows"
      }
    ]
  }'
```

### Python SDK

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="sk-YOUR_API_KEY",
    base_url="https://api.laozhang.ai/v1",
)

response = client.chat.completions.create(
    model="gemini-3.1-flash-lite-image",
    messages=[
        {
            "role": "user",
            "content": "Create a clean blue SaaS illustration for a mobile landing page",
        }
    ],
)

print(response.choices[0].message.content)
```

## Gemini-native request

The Gemini-native contract uses this route:

```text theme={null}
POST https://api.laozhang.ai/v1beta/models/gemini-3.1-flash-lite-image:generateContent
```

```bash theme={null}
curl -X POST \
  "https://api.laozhang.ai/v1beta/models/gemini-3.1-flash-lite-image:generateContent" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "parts": [{"text": "Create a 16:9 concept image of a modern logistics dashboard on dark gray with cyan highlights"}]
    }],
    "generationConfig": {
      "responseModalities": ["IMAGE"],
      "imageConfig": {
        "aspectRatio": "16:9",
        "imageSize": "1K"
      }
    }
  }'
```

<Warning>
  Lite only supports 1K. Passing 2K or 4K does not turn it into a high-resolution model; use `gemini-3.1-flash-image` or `gemini-3-pro-image` instead.
</Warning>

## Image editing request

In the OpenAI-compatible format, place the instruction and reference image URL in the same message:

```python theme={null}
response = client.chat.completions.create(
    model="gemini-3.1-flash-lite-image",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Keep the product unchanged and replace the background with a light-gray studio"},
            {
                "type": "image_url",
                "image_url": {"url": "https://example.com/product.jpg"},
            },
        ],
    }],
)
```

## High-concurrency integration guidance

Lite is designed for high-frequency interaction, but production throughput still requires engineering controls:

1. Reuse HTTP connections instead of creating one client per image.
2. Apply jittered exponential backoff to 429s, 5xx responses, and network timeouts.
3. Use business timeouts and idempotency controls to avoid duplicate billing after uncertain retries.
4. Log request IDs, model, status code, latency, and console order state.
5. Before sustained high-volume launch, share peak concurrency, daily calls, prompt size, and input image size with support for capacity confirmation.

<Warning>
  The LaoZhang gateway does not publish a fixed low-concurrency plan, but Google upstream can still enforce RPM/IPM, project quota, real-time capacity, and safety policy. This documentation does not promise unconditional permanent unthrottled access.
</Warning>

## Global network and CDN note

Applications use the single `https://api.laozhang.ai` endpoint, while documentation and static assets are CDN-delivered. CDN can improve DNS, TLS setup, and static transfer paths; image generation latency still includes gateway processing, upstream queueing, model inference, and response delivery. Test from your real deployment region.

## FAQ

<AccordionGroup>
  <Accordion title="How much does the Nano Banana 2 Lite API cost?">
    LaoZhang API currently charges \$0.025 per call; confirm the price in the console. Google's July 2026 Standard reference is \$0.0336 per 1K image.
  </Accordion>

  <Accordion title="Is Nano Banana 2 Lite stable?">
    Yes. The current stable model ID is `gemini-3.1-flash-lite-image`, not a preview ID.
  </Accordion>

  <Accordion title="Does Lite support 2K or 4K?">
    No. Lite is 1K-only. Use `gemini-3.1-flash-image` or `gemini-3-pro-image` for 2K/4K output.
  </Accordion>

  <Accordion title="Does Lite support image editing?">
    Yes. It accepts text and image input for local edits, background changes, color replacement, sticker generation, and rapid iteration.
  </Accordion>

  <Accordion title="Does Lite support Google Search grounding?">
    No. Use Nano Banana 2 for Web/Image Search grounding, or Pro for complex professional generation.
  </Accordion>

  <Accordion title="Can I use Lite at high concurrency?">
    Lite targets high-volume use cases, and LaoZhang API does not publish a fixed low gateway concurrency plan. Actual capacity still depends on upstream and account state; confirm capacity before a large launch.
  </Accordion>

  <Accordion title="Are failed calls billed?">
    Billing follows the console order state. Review 429s, 5xx errors, timeouts, and validation failures against call logs; a policy-triggered successful response with no image needs separate review.
  </Accordion>
</AccordionGroup>

<CardGroup cols={2}>
  <Card title="Nano Banana Standard API" icon="banana" href="/en/api-capabilities/nano-banana-image">
    Use the existing Nano Banana API entry and model comparison
  </Card>

  <Card title="Nano Banana 2 API" icon="citrus" href="/en/api-capabilities/nano-banana2-image">
    0.5K–4K, high throughput, and Search grounding
  </Card>

  <Card title="Nano Banana Pro API" icon="cherry" href="/en/api-capabilities/nano-banana-pro-image">
    Complex composition, professional assets, and 4K
  </Card>

  <Card title="Live Test" icon="play" href="https://yingtu.ai">
    Validate prompts and output before integration
  </Card>
</CardGroup>
