Gemini 3.1 Flash Image
gemini-3.1-flash-imageUse the Gemini 3.1 Flash Image API for AI image generation. Describe the subject, composition, and style in the image request. Create illustrations, design concepts, and visual assets. Compare the available provider routes, request examples, and usage prices on OpenAny.
Auto route pricing
Route source: Tencent
- Input / Output
- Input: Price not suppliedOutput: $1.379
- Cache read / write
- Cache read: Price not suppliedCache write: Price not supplied
- Context / Max output
- — / —
- Live routes
- 1
Rates / 1M tokens
Image output: Price not supplied
These are separate usage rates, not a total request price.
On this page
Overview
Use the Gemini 3.1 Flash Image API for AI image generation. Describe the subject, composition, and style in the image request. Create illustrations, design concepts, and visual assets. Compare the available provider routes, request examples, and usage prices on OpenAny.
Playground
Result preview
Tencent · 150ms
Response example. Run to see the actual response.

{
"candidates": [
{
"index": 0,
"content": {
"role": "model",
"parts": [
{
"inlineData": {
"data": "https://openmodels.market/api/v1/public/files/download?key=key-market%2Fplaygrounds%2F2026%2F09%2F11%2Faa082ba4-54a5-4471-a909-40b00915891e.jpg",
"mimeType": "image/jpeg"
}
}
]
},
"finishReason": "STOP"
}
],
"request_id": "bcf44ed5-7552-435b-a45a-6e3ba5887091",
"modelVersion": "gemini-3.1-flash-image",
"tokenhub_usage": {
"total_tokens": 67543
},
"openmodels_cost": 100045
}Agent handoff preview
Providers
| Provider | Pricing | Latency | Uptime | Supply | Route |
|---|---|---|---|---|---|
Live | Output $1.379 / 1M tokens Input — Cache read — Cache write — | 150ms | — | Verified |
- Output
- $1.379
Source: the selected provider route in OpenAny's public model catalog. A price update timestamp is not supplied.
API
- Base URL
https://api.openany.si/v1- POST
/v1/images- Authentication
Authorization: Bearer $OPENANY_API_KEY
Request parameters
| Parameter | Type / range | Default value | Required | Description |
|---|---|---|---|---|
contents | array | — | Yes | Gemini input content. Each entry contains a parts array. |
model | string | — | Yes | Public model name used by OpenAny. |
generationConfig | object | — | No | Output modalities and image generation settings for Gemini. |
route | object | — | No | OpenAny routing settings. |
route_mode | string | — | No | OpenAny route selection mode. |
Request example
curl 'https://api.openany.si/v1/images' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"parts": [
{
"text": "Generate an image of a Chinese Li Hua cat in a modern studio product-photo style."
}
]
}
],
"generationConfig": {
"responseFormat": {
"image": {
"aspectRatio": "9:16",
"imageSize": "2K"
}
},
"responseModalities": [
"IMAGE"
]
},
"model": "gemini-3.1-flash-image"
}'Response example
Configured response example · not a live result
{
"candidates": [
{
"index": 0,
"content": {
"role": "model",
"parts": [
{
"inlineData": {
"data": "https://openmodels.market/api/v1/public/files/download?key=key-market%2Fplaygrounds%2F2026%2F09%2F11%2Faa082ba4-54a5-4471-a909-40b00915891e.jpg",
"mimeType": "image/jpeg"
}
}
]
},
"finishReason": "STOP"
}
],
"request_id": "bcf44ed5-7552-435b-a45a-6e3ba5887091",
"modelVersion": "gemini-3.1-flash-image",
"tokenhub_usage": {
"total_tokens": 67543
},
"openmodels_cost": 100045
}Error handling
400Check the model ID and request fields.429Retry with exponential backoff.5xxRetry only temporary provider failures.JSON Schema
{
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"model",
"contents"
],
"properties": {
"model": {
"type": "string",
"description": "Public model name used by OpenAny."
},
"route": {
"type": "object",
"properties": {
"provider": {
"type": "string"
}
},
"description": "OpenAny routing settings."
},
"contents": {
"type": "array",
"items": {
"type": "object",
"required": [
"parts"
],
"properties": {
"role": {
"enum": [
"user",
"model"
],
"type": "string"
},
"parts": {
"type": "array",
"items": {
"type": "object",
"anyOf": [
{
"required": [
"text"
]
},
{
"required": [
"inlineData"
]
},
{
"required": [
"fileData"
]
}
],
"properties": {
"text": {
"type": "string"
},
"fileData": {
"type": "object",
"required": [
"fileUri"
],
"properties": {
"fileUri": {
"type": "string"
},
"mimeType": {
"type": "string"
}
}
},
"inlineData": {
"type": "object",
"required": [
"mimeType",
"data"
],
"properties": {
"data": {
"type": "string"
},
"mimeType": {
"type": "string"
}
}
},
"thoughtSignature": {
"type": "string"
}
}
},
"minItems": 1
}
}
},
"minItems": 1,
"description": "Gemini input content. Each entry contains a parts array."
},
"route_mode": {
"type": "string",
"description": "OpenAny route selection mode."
},
"generationConfig": {
"type": "object",
"properties": {
"imageConfig": {
"type": "object",
"properties": {
"imageSize": {
"enum": [
"512",
"1K",
"2K",
"4K"
],
"type": "string"
},
"aspectRatio": {
"enum": [
"1:1",
"2:3",
"3:2",
"3:4",
"4:3",
"4:5",
"5:4",
"9:16",
"16:9",
"21:9",
"1:4",
"4:1",
"1:8",
"8:1"
],
"type": "string"
}
}
},
"responseFormat": {
"type": "object",
"properties": {
"image": {
"type": "object",
"properties": {
"mimeType": {
"type": "string"
},
"imageSize": {
"enum": [
"512",
"1K",
"2K",
"4K"
],
"type": "string"
},
"aspectRatio": {
"enum": [
"1:1",
"2:3",
"3:2",
"3:4",
"4:3",
"4:5",
"5:4",
"9:16",
"16:9",
"21:9",
"1:4",
"4:1",
"1:8",
"8:1"
],
"type": "string"
}
}
}
}
},
"responseModalities": {
"type": "array",
"items": {
"enum": [
"TEXT",
"IMAGE"
],
"type": "string"
},
"minItems": 1
}
},
"description": "Output modalities and image generation settings for Gemini."
}
}
}Examples
Request example
POST /v1/imagescurl 'https://api.openany.si/v1/images' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"parts": [
{
"text": "Generate an image of a Chinese Li Hua cat in a modern studio product-photo style."
}
]
}
],
"generationConfig": {
"responseFormat": {
"image": {
"aspectRatio": "9:16",
"imageSize": "2K"
}
},
"responseModalities": [
"IMAGE"
]
},
"model": "gemini-3.1-flash-image"
}'