Skip to content
Open CastalyConsole

Image

gemini-3.1-flash-lite-image API

Call gemini-3.1-flash-lite-image through Modelflare with the exact model ID shown on this page.

Use the exact model ID gemini-3.1-flash-lite-image. The model field must match this page exactly.

Steam braiding into coral and violet ribbons above a late-night noodle counter.

Sample outputgemini-3.1-flash-lite-imagePOST /v1beta/models/gemini-3.1-flash-lite-image:generateContent

Parameters: ratio=16:9

Prompt: A late-night noodle counter, six stools and a steel pass, rain on the window behind. A cook in an orange quilted jacket has just lifted the lid off a stock pot. The steam is not dispersing: it has gathered into solid braided ribbons of coral and ultraviolet that rope up past her face and press flat along the ceiling. One hard tungsten bulb directly overhead, the street outside cold and blue. Wide camera at counter height, real density in the steam, film grain, slight vignette, no text.

Request that produced this sample
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "A late-night noodle counter, six stools and a steel pass, rain on the window behind. A cook in an orange quilted jacket has just lifted the lid off a stock pot. The steam is not dispersing: it has gathered into solid braided ribbons of coral and ultraviolet that rope up past her face and press flat along the ceiling. One hard tungsten bulb directly overhead, the street outside cold and blue. Wide camera at counter height, real density in the steam, film grain, slight vignette, no text."
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
],
"imageConfig": {
"aspectRatio": "16:9"
}
}
}

Use a Modelflare API key with https://modelflare.dev. The gateway entry point is POST /v1/models/{model}:generateContent.

HTTP
Authorization: Bearer YOUR_MODELFLARE_API_KEY
Terminal windowbash
curl "https://modelflare.dev/v1/models/gemini-3.1-flash-lite-image:generateContent" \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role": "user", "parts": [{"text": "A white cat runs through a neon-lit street in the rain"}]}],
"generationConfig": {"responseModalities": ["TEXT", "IMAGE"], "imageConfig": {"aspectRatio": "16:9", "imageSize": "1K"}}
}'

Gemini image models use native contents and generationConfig; edits send the text instruction and inline_data in the same parts[].

Gemini image models use native Gemini generateContent. Put text and reference images in the same contents[].parts[]; images use inline_data. Do not send these models to /v1/images/generations, /v1/images/edits, or OpenAI /v1/responses. The imageSize enum is model-specific and shown below.

Field Required Notes
contents[].parts[].text Yes Text prompt or edit instruction
contents[].parts[].inline_data No Base64 image data and MIME type
contents[].parts[].inline_data.mime_type No image/jpeg / image/png / image/webp
contents[].parts[].inline_data.data No Base64-encoded reference image content
generationConfig.responseModalities Yes ["IMAGE"] or ["TEXT", "IMAGE"]
generationConfig.imageConfig.aspectRatio No 1:1 / 3:2 / 2:3 / 3:4 / 4:3 / 4:5 / 5:4 / 9:16 / 16:9 / 21:9
generationConfig.imageConfig.imageSize No 1K

Lite supports only 1K with 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, and 21:9. The official documentation does not publish a reference-image count cap, so the gateway adds no local cap and returns the service error when the service limit is exceeded.

Put the edit instruction and the reference image in the same contents[].parts[]. inline_data.data is the Base64 image content; do not send Gemini image models to the OpenAI Images or Responses endpoints.

Terminal windowbash
curl "https://modelflare.dev/v1/models/gemini-3.1-flash-lite-image:generateContent" \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role": "user", "parts": [
{"text": "Keep the subject and lighting, but replace the background with a misty pine forest."},
{"inline_data": {"mime_type": "image/jpeg", "data": "BASE64_IMAGE_DATA"}}
]}],
"generationConfig": {"responseModalities": ["TEXT", "IMAGE"], "imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}}
}'

Read candidates[].content.parts[]; do not assume every part is an image because the response may contain text and image parts together.

Field Notes
candidates[].content.parts[].inline_data Generated image MIME type and Base64 data
candidates[].content.parts[].text Text caption returned when TEXT was requested
candidates[].finishReason Completion or safety reason
usageMetadata Input/output token usage when returned by the service

Modelflare preserves the native Gemini response shape for gemini-3.1-flash-lite-image and persists usable image parts.

Field errors, size/ratio limits, and safety refusals from the native Gemini request remain Gemini-compatible error responses. The gateway does not rewrite them as OpenAI Images responses.

This page covers Modelflare model generation and editing calls. Search or map enrichment, voice management, and element-library management are resource APIs outside this public model-call surface and are not required request fields.

This model uses token-based billing. See the model pricing page for the current customer price, reference list price, and complete specification.

Media contract · v1

Contract ID: media.gemini-3-1-flash-lite-image.v1Adapter: image.gemini.native.v1@v1Fingerprint: 3eb181032c0d879a99b4c879c0ee28f714c72bf3d9c228ccc50eb61a3778b79e

Official source: Google

Contract parameters

Intent fieldControlOptions
sizeselect1K
ratioselect1:1 / 3:2 / 2:3 / 3:4 / 4:3 / 4:5 / 5:4 / 9:16 / 16:9 / 21:9

Supported capability

  • allowed_values · size · 1K
  • allowed_values · ratio · 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9

Structured request example

text

Intent

{
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "ratio": "1:1",
  "size": "1K"
}

Provider request

{
  "contents": [
    {
      "parts": [
        {
          "text": "A red paper kite over a quiet harbour at dusk."
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    },
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ]
  },
  "systemInstruction": {
    "parts": [
      {
        "text": "Generate an image for the user's request. If details are missing, choose reasonable defaults and still return an image. Do not ask clarifying questions."
      }
    ]
  }
}

reference

Intent

{
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "ratio": "1:1",
  "size": "1K"
}

Provider request

{
  "contents": [
    {
      "parts": [
        {
          "text": "A red paper kite over a quiet harbour at dusk."
        },
        {
          "inline_data": {
            "data": "AAAA",
            "mime_type": "image/png"
          }
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    },
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ]
  },
  "systemInstruction": {
    "parts": [
      {
        "text": "Generate an image for the user's request. If details are missing, choose reasonable defaults and still return an image. Do not ask clarifying questions."
      }
    ]
  }
}