Skip to main content
POST
/
v1beta
/
models
/
gemini-3-pro-image-preview:streamGenerateContent
Image Generation (Streaming)
curl --request POST \
  --url https://www.anyfast.ai/v1beta/models/gemini-3-pro-image-preview:streamGenerateContent \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Generate an image of a sunset over mountains"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ],
    "imageConfig": {
      "aspectRatio": "16:9",
      "imageSize": "1K"
    }
  }
}
'
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {
            "inlineData": {
              "mimeType": "image/png",
              "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
            }
          }
        ]
      }
    }
  ],
  "usageMetadata": {
    "trafficType": "ON_DEMAND"
  },
  "modelVersion": "gemini-3-pro-image-preview"
}

Documentation Index

Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt

Use this file to discover all available pages before exploring further.

Query Parameters

key
string
required

API Key

alt
enum<string>

Set to sse for explicit Server-Sent Events mode (optional, streaming is the default behaviour of this endpoint)

Available options:
sse

Body

application/json
contents
object[]
required

Array of conversation turns. Each turn has a role and parts. A part can be a text prompt, or an inline_data image (base64). To use a reference image, include both a text part and an inline_data part in the same parts array.

Example:
[
{
"role": "user",
"parts": [
{
"text": "Generate an image of a sunset over mountains"
}
]
}
]
generationConfig
object
required

Response

Streaming SSE response. Each line starts with "data:" followed by a JSON chunk. Three chunk types are delivered in order: (1) Thinking chunks — parts[0].thought is true; (2) Image chunk — parts[0].inlineData contains mimeType and base64 data (camelCase); (3) Final usage chunk — top-level usageMetadata with thoughtsTokenCount.

A single SSE chunk. Three variants are possible: thinking chunk (parts[].thought=true), image chunk (parts[].inlineData), or usage chunk (no candidates).

candidates
object[]

Present in thinking and image chunks; absent in the final usage chunk.

usageMetadata
object

Token usage. Final chunk contains full details including thoughtsTokenCount.

modelVersion
string
Example:

"gemini-3-pro-image-preview"

createTime
string
Example:

"2025-01-01T00:00:00Z"

responseId
string
Example:

"abc123"