Gemini 3.1 Flash Image

gemini-3.1-flash-image

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.

Published price
Output $1.379 / 1M tokens
Billing unit
/ 1M tokens
Context / Max output
— / —
Listed routes
1
Base URL
https://api.openany.si/v1
POST
/v1/images
Authentication
Authorization: Bearer $OPENANY_API_KEY

Provider

Published price Output $1.379 / 1M tokens

Request parameters

ParameterType / rangeDefault valueRequiredDescription
contentsarray—YesGemini input content. Each entry contains a parts array.
modelstring—YesPublic model name used by OpenAny.
generationConfigobject—NoOutput modalities and image generation settings for Gemini.
routeobject—NoOpenAny routing settings.
route_modestring—NoOpenAny 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

JSON
{
  "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."
    }
  }
}

Model API questions

How do I call Gemini 3.1 Flash Image through OpenAny?

Use model ID gemini-3.1-flash-image with an OpenAny key and the operation published in this model's API tab. The model API base is https://api.openany.si/v1. Confirm the protocol and request schema; model availability does not imply every OpenAI API operation is supported.

How is Gemini 3.1 Flash Image billed?

Compare the published rate and billing unit of the selected provider route. Input, output and cache token rates may differ. Image, audio and video models can use other units. Recorded usage determines the charge under that route's billing contract.

Are Community and Verified routes the same as an official publisher API?

No. Inspect the provider name and supply classification for the specific route. A marketplace listing or a supply label is not a claim of publisher endorsement, identical service or measured uptime. Different route prices may reflect different supply and conditions.

Where do these prices come from, and when were they updated?

Rates come from the provider routes in OpenAny's public model catalog, not an independent quote from the model publisher. The catalog does not supply a price update timestamp. A page or catalog snapshot date is not a price revision date. Compare supply, billing units, tiers and conditions; a lower listed rate alone does not establish equivalent service or explain the price difference.

Use Gemini 3.1 Flash Image with your agent

Inspect endpoint contracts and confirm availability and pricing before a paid call.