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

# Gemini 3.1 Flash Image

Gemini 3.1 Flash Image combines Gemini 3.1 Flash Preview’s reasoning with Nano Banana 2’s image generation. It balances cost and performance for image generation and editing and improves generation speed and concurrency over Nano Banana Pro.

### Model capabilities

* **High-resolution output:** Native generation at 0.5K, 1K, 2K, and 4K.
* **Advanced text rendering:** Generate clear, stylized text for infographics, menus, diagrams, and marketing materials.
* **Grounding with Google Search:** Verify facts and generate images based on real-time data such as weather maps, stock quotes, and recent events. Image search is supported.
* **Thinking mode:** The model analyzes complex prompts and generates intermediate “thinking images” to refine the composition before producing the final image. These intermediate images are visible only in the backend and are not billed. You can configure the reasoning level.
* **Multiple reference images:** Combine up to 14 reference images into one final image.
* **Additional aspect ratios:** Four new ratios (1:4, 4:1, 1:8, and 8:1) give you more composition options.

### Model parameters

* Model ID: `gemini-3.1-flash-image`
* Pricing: Check the [model details page](https://geekai.co/models/gemini-3.1-flash-image) for current prices.
* Endpoint: `https://geekai.co/api/v1/chat/completions`
* Parameters: See the [Chat API reference](https://docs.geekai.co/en/api/chat/completions.md).
* Authentication: [Get an API key](https://geekai.co/user/api_keys).

### Pricing

Gemini 3.1 Flash Image generates images at 0.5K, 1K, 2K, and 4K. Prices vary by resolution:

| Resolution | Dimensions | Price (CNY/image) |
| - | - | - |
| 0.5K | 512x512 | 0.35 |
| 1K | 1024x1024 | 0.5 |
| 2K | 2048x2048 | 0.75 |
| 4K | 4096x4096 | 1.15 |

Relative to the 1K base price, 2K costs 1.5 times as much, 4K approximately 2.3 times as much, and 0.5K 0.7 times as much.

When using a GeekAI [discounted proxy channel](https://docs.geekai.co/en/docs/model_price.md), multiply the listed price by the channel’s discount factor. For example, the default high-availability channel has a factor of `0.5`. An image with `size` set to `1K` costs `0.5 x 0.5 = 0.25` CNY. Applying the same calculation, 2K costs 0.375 CNY, 0.5K costs 0.175 CNY, and 4K costs 0.575 CNY.

### Image generation

Generate an image from a descriptive prompt:

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Create an image of a Nano Banana dish in an upscale restaurant with a Gemini theme."
          }
        ]
      }
    ]
}'
```

### Image editing

Combine an image with a text prompt to edit it, change the composition, or transform its style:

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Using the supplied image of my cat, add a small knitted wizard hat to its head. Make the hat sit comfortably and match the soft lighting of the photo."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://ai.google.dev/static/gemini-api/docs/images/cat.png"
            }
          }
        ]
      }
    ]
}'
```

### Multi-turn image editing

Keep generating and editing images in the same conversation. Multi-turn chat is the best way to refine an image. Start by generating an infographic about photosynthesis:

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Create a lively infographic explaining photosynthesis as a plant’s favorite recipe. Show the ‘ingredients’ (sunlight, water, CO₂) and the ‘finished dish’ (sugar/energy). Style it like a page from a colorful children’s cookbook for fourth graders."
          }
        ]
      }
    ]
}'
```

In the same chat, ask the model to change the language in the image to Spanish:

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Create a lively infographic explaining photosynthesis as a plant’s favorite recipe. Show the ‘ingredients’ (sunlight, water, CO₂) and the ‘finished dish’ (sugar/energy). Style it like a page from a colorful children’s cookbook for fourth graders."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://static.geekai.co/image/2026/02/27/bfc778edb67fefcc629e0f92bb1fb137.png"
            }
          },
          {
            "type": "text",
            "text": "Update this infographic to Spanish. Do not change any other element of the image."
          }
        ]
      }
    ]
}'
```

### Combine multiple images

Gemini 3.1 Flash Image can combine up to 14 reference images, including:

* Up to 10 images of objects to reproduce with high fidelity in the final image.
* Up to 4 images of people to maintain character consistency.

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Create an office group photo of these people making funny faces."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "$IMG1_BASE64"
            }
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "$IMG2_BASE64"
            }
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "$IMG3_BASE64"
            }
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "$IMG4_BASE64"
            }
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "$IMG5_BASE64"
            }
          }
        ]
      }
    ]
}'
```

### Ground images with Google Search

Use the Google Search tool to generate images based on real-time information, such as weather forecasts, stock charts, or recent events.

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Visualize the current five-day forecast for San Francisco as a clean, modern weather chart. Include visual suggestions for what to wear each day."
          }
        ]
      }
    ],
    "enable_search": true,
    "image": {
      "aspect_ratio": "5:4"
    }
}'
```

> [!NOTE]
>
> Use `enable_search` to enable the model’s built-in search tool (Google Search for Gemini). Use `image` to configure output resolution (`image_size`) and aspect ratio (`aspect_ratio`). These are currently the only two supported configuration options.

### Generate high-resolution 4K images

Gemini 3.1 Flash Image generates 1K images by default and also supports 0.5K, 2K, and 4K output. To generate higher-resolution assets, specify `image_size` in `image`:

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Draw a Leonardo da Vinci-style anatomical study of a monarch butterfly. Render the head, wings, and legs in detail on textured parchment, with annotations in English."
          }
        ]
      }
    ],
    "enable_search": true,
    "image": {
      "aspect_ratio": "1:1",
      "image_size": "4K"
    },
    "background": true
}'
```

> [!NOTE]
>
> Set `background` to `true` to [run long tasks in the background](https://docs.geekai.co/en/docs/chat/background.md), such as high-resolution image generation. The chat endpoint returns a `id` that uniquely identifies the request. Poll `https://geekai.co/api/v1/chat/{id}` for the latest status and retrieve the final image when the conversation completes.


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