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

# Gemini 3.1 Flash Lite Image

> Gemini 3.1 Flash Lite Image: image generation model. Request examples and parameters for MixRoute.

Gemini 3.1 Flash Lite Image is available through the native image API described below.

Uses the native Gemini Content/Part structure. Request IMAGE output and read the returned image parts rather than treating the response as a text-only chat completion.

<Tip>
  [Native image parameters](/api-reference/endpoint/nano-banana) | [Streaming responses](/api-reference/endpoint/nano-banana-stream)
</Tip>

`POST https://api.mixroute.ai/v1/models/gemini-3.1-flash-lite-image:generateContent`

## Examples

Use your MixRoute key in the `MIXROUTE_API_KEY` environment variable. Requests use `Authorization: Bearer ...`. Replace source-image placeholders with accessible images or local files before editing.

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/models/gemini-3.1-flash-lite-image:generateContent" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "A clean product photograph of a red ceramic mug on a white background."
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ],
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    }
  }
}'
```

### Python

```python theme={null}
import json
import os
import requests

payload = json.loads(r'''
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "A clean product photograph of a red ceramic mug on a white background."
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ],
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    }
  }
}
''')
response = requests.post(
    "https://api.mixroute.ai/v1/models/gemini-3.1-flash-lite-image:generateContent",
    headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
    json=payload,
    timeout=180,
)
response.raise_for_status()
result = response.json()
import base64
from pathlib import Path

image_index = 0
for candidate in result.get("candidates", []):
    for part in candidate.get("content", {}).get("parts", []):
        if part.get("thought"):
            continue
        inline = part.get("inlineData")
        if inline and inline.get("data"):
            extension = {"image/png": "png", "image/jpeg": "jpg", "image/webp": "webp"}.get(inline.get("mimeType"), "bin")
            Path(f"image_{image_index}.{extension}").write_bytes(base64.b64decode(inline["data"]))
            image_index += 1
        elif "text" in part:
            print(part["text"])
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.