Skip to main content
POST
/
v1beta
/
models
/
gemini-3-pro-preview:streamGenerateContent
Text Generation (Streaming)
curl --request POST \
  --url https://www.anyfast.ai/v1beta/models/gemini-3-pro-preview:streamGenerateContent \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hello, tell me about yourself."
        }
      ]
    }
  ],
  "systemInstruction": {
    "parts": [
      {
        "text": "You are a helpful assistant."
      }
    ]
  },
  "safetySettings": [
    {
      "category": "<string>",
      "threshold": "<string>"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "topP": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    }
  }
}
'
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "Hello!"
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 123,
    "candidatesTokenCount": 123,
    "totalTokenCount": 123
  }
}

Query Parameters

key
string
required

API Key

alt
string

Set to sse for Server-Sent Events streaming

Body

application/json
contents
object[]
required

Array of conversation contents with user and model messages.

Example:
[
  {
    "role": "user",
    "parts": [
      { "text": "Hello, tell me about yourself." }
    ]
  }
]
systemInstruction
object

System instruction

Example:
{
  "parts": [{ "text": "You are a helpful assistant." }]
}
safetySettings
object[]

Safety filter settings

generationConfig
object

Response

Streaming response generated successfully

candidates
object[]
usageMetadata
object