gemini-3.1-flash-image API

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

gemini-3.1-flash-image API

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

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

Authentication and endpoint

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

Authorization: Bearer YOUR_MODELFLARE_API_KEY

Generate an image

curl "https://modelflare.dev/v1beta/models/gemini-3.1-flash-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"]}
  }'

Request notes

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

Request parameters

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.

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

Response and input limits

Read candidates[].content.parts[] from the response; image output is in inline_data and text output is in text. For editing, send the instruction and image in the same parts[] array. The public contract is native Gemini generateContent, not OpenAI Images or /v1/responses.

Supported scope

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.

Pricing and billing

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

This page documents Modelflare’s public interface; the fields and limits shown here are the current contract.