gemini-3.1-flash-image-preview
Gemini 3.1 Flash Image (1K) generates images quickly for product mockups, thumbnails, and creative drafts.
Auth: Authorization: Bearer sk-… from the Console. Use this model id exactly in the model field.
Only parameters relevant to gemini-3.1-flash-image-preview are listed below.
| Field | Type | Req | Description |
|---|---|---|---|
| model | string | ✓ | gemini-3.1-flash-image-preview | …-2k | google/gemini-3-pro-image-preview |
| messages | array | ✓ | OpenAI multimodal messages. Text + optional image_url parts for edit/style reference. |
| messages[].content[] | object[] | — | [{type:"text",text:"…"},{type:"image_url",image_url:{url:"https://…"}}] — attach 1+ reference images |
| image_config.image_size | string | — | 2K tier: use *-2k model ids |
curl https://api.lumeapi.site/v1/chat/completions \
-H "Authorization: Bearer sk-…" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image-preview",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Keep the bottle layout; change background to sunset beach"},
{"type": "image_url", "image_url": {"url": "https://cdn.example.com/ref.png"}}
]
}]
}'POST https://api.lumeapi.site/v1/images/generations or /v1/chat/completions with Authorization: Bearer sk-…. Obtain keys at the LumeAPI Console (/console). Catalog: GET /api/models on the LumeAPI portal API.
images/generations: gpt-image-2, gpt-image-2-2k, doubao-seedream-5.0, grok-4-image, grok-4.2-image. images/edits: grok-4-image, grok-4.2-image (multipart). chat/completions for Gemini Flash / Nano Banana: gemini-3.1-flash-image-preview, gemini-3.1-flash-image-preview-2k, google/gemini-3-pro-image-preview.
One POST returns sync OpenAI { data: [{ url }] } after the gateway finishes (typically 30–90s). Do NOT poll /v1/tasks yourself. size = aspect ratio (16:9); 2K → model gpt-image-2-2k. With image_urls: pass reference images (gateway enforces max). Grok: aspect_ratio or size; resolution 1k|2k; quality low|medium|high; n 1–10. For Grok edits use POST /v1/images/edits with one image file. HTTP read timeout ≥ 180s.
doubao-seedream-5.0: POST /v1/images/generations with aspect ratio size + resolution 2K (default). Sync { data: [{ url }] } after 30–90s. gemini-3.1-flash-image-preview*: POST /v1/chat/completions with modalities + image_config.
Flat USD per image (see pricing tables). 402 insufficient_user_quota when balance empty. Failed generations return 4xx/5xx with error message.
Contact support — success should be { data: [{ url }] } after 30–90s. Your request format is likely correct.