Skip to content
GoogleImageChatgemini-3.1-flash-image-preview

Gemini 3.1 Flash Image (Preview)

Gemini 3.1 Flash Image (Preview) for OpenAI-style Image Generation, Image editing, OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses.

Explore Gemini 3.1 Flash Image (Preview) for OpenAI-style Image Generation, Image editing, OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses through the unified API. Supported interfaces and current availability are shown below.

  • OpenAI-style Image Generation
  • Image editing
  • OpenAI-style Chat Completions
  • Anthropic-style Messages
  • OpenAI-style Responses

Model details

Context window
131K tokens
Max output
33K tokens
Input
Text, images
Output
Text, images
Capabilities
Vision, Streaming
Interfaces
OpenAI-style Image Generation, Image editing, OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses

Pricing

What each generation costs. The Cloakray price is what you are charged — no gateway fee is added on top of it.

Gemini 3.1 Flash Image (Preview) pricing.
ResolutionPrice
0.5K / image$0.04482
1K / image$0.0672
2K / image$0.1008
4K / image$0.1512
/ 1M input tokens$0.5
/ 1M output tokens$3
/ 1M image input tokens$0.5

Why teams pick it

  • Gemini 3.1 Flash Image (Preview) for OpenAI-style Image Generation, Image editing, OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses.

Call Gemini 3.1 Flash Image (Preview)

Gemini 3.1 Flash Image (Preview) answers on any of the APIs below — pick the one your code already speaks and just swap in your Cloakray key.

/v1/images/generationsOpenAI-style Image Generation · openai SDK or plain HTTP
curl https://api.cloakray.com/v1/images/generations \
  -H "Authorization: Bearer ckr_..." \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini-3.1-flash-image-preview",
  "prompt": "A quartz crystal on a workbench"
}'
/v1/images/editsImage editing · openai SDK or plain HTTP
curl https://api.cloakray.com/v1/images/edits \
  -H "Authorization: Bearer ckr_..." \
  -F 'model=gemini-3.1-flash-image-preview' \
  -F 'prompt=Make the background blue' \
  -F 'image=@input.png'
/v1/chat/completionsOpenAI-style Chat Completions · openai SDK or plain HTTP
curl https://api.cloakray.com/v1/chat/completions \
  -H "Authorization: Bearer ckr_..." \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini-3.1-flash-image-preview",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}'
/v1/messagesAnthropic-style Messages · @anthropic-ai/sdk SDK or plain HTTP
curl https://api.cloakray.com/v1/messages \
  -H "Authorization: Bearer ckr_..." \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini-3.1-flash-image-preview",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}'
/v1/responsesOpenAI-style Responses · openai SDK or plain HTTP
curl https://api.cloakray.com/v1/responses \
  -H "Authorization: Bearer ckr_..." \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini-3.1-flash-image-preview",
  "input": "Hello"
}'

Conversation compaction is also available at POST /v1/responses/compact.

More from Google