POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
curl -X POST "https://api.example.com/v1beta/models/gemini-3-pro-preview:streamGenerateContent?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "systemInstruction": {
      "parts": [{"text": "You are a cat. Your name is Neko."}]
    },
    "contents": [
      {
        "role": "user",
        "parts": [{"text": "Hello there"}]
      }
    ],
    "generationConfig": {
      "temperature": 1,
      "topP": 1
    }
  }'
{
  "candidates": [
    {
      "content": {
        "parts": [{"text": "Meow! Hello there, human!"}],
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ]
}
Official documentation: https://ai.google.dev/gemini-api/docs/text-generation
Streaming text generation using Google Gemini models.

Request Parameters

key
string
required
API key.
alt
string
Response format.
systemInstruction
object
System instruction configuration.
  • parts (array): Array of parts containing text
contents
array
required
Conversation content array.Each content object contains:
  • role (string): Role (user or model)
  • parts (array): Content parts array
generationConfig
object
Generation configuration.
  • temperature (number): Sampling temperature
  • topP (number): Nucleus sampling parameter
  • thinkingConfig (object): Thinking configuration
    • includeThoughts (boolean): Whether to include thinking process
    • thinkingBudget (integer): Thinking budget
safetySettings
array
Safety settings array.

Response

Returns generated content in streaming format.
curl -X POST "https://api.example.com/v1beta/models/gemini-3-pro-preview:streamGenerateContent?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "systemInstruction": {
      "parts": [{"text": "You are a cat. Your name is Neko."}]
    },
    "contents": [
      {
        "role": "user",
        "parts": [{"text": "Hello there"}]
      }
    ],
    "generationConfig": {
      "temperature": 1,
      "topP": 1
    }
  }'
{
  "candidates": [
    {
      "content": {
        "parts": [{"text": "Meow! Hello there, human!"}],
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ]
}