Text Generation Thinking Stream

Official Documentation: https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations

Endpoint

POST http://v98store.com/v1beta/models/gemini-2.5-pro:streamGenerateContent

cURL Command

curl -X POST 'http://v98store.com/v1beta/models/gemini-2.5-pro:streamGenerateContent' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -d '{ "contents": [ { "parts": [ { "text": "1+2+3+4+5+....+999?" } ], "role": "user" } ], "systemInstruction": { "parts": [ { "text": "hi" } ], "role": "user" }, "safetySettings": [ { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "OFF" }, { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "OFF" }, { "category": "HARM_CATEGORY_HARASSMENT", "threshold": "OFF" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "OFF" }, { "category": "HARM_CATEGORY_CIVIC_INTEGRITY", "threshold": "BLOCK_NONE" } ], "tools": [], "generationConfig": { "temperature": 1, "topP": 1, "thinkingConfig": { "includeThoughts": true, "thinkingBudget": 26240 } } }'

Parameters

NameInDescriptionRequired
keyqueryYes
altqueryNo
Content-TypeheaderYes

Request Body

Example

{
  "contents": [
    {
      "parts": [
        {
          "text": "1+2+3+4+5+....+999?"
        }
      ],
      "role": "user"
    }
  ],
  "systemInstruction": {
    "parts": [
      {
        "text": "hi"
      }
    ],
    "role": "user"
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
      "threshold": "BLOCK_NONE"
    }
  ],
  "tools": [],
  "generationConfig": {
    "temperature": 1,
    "topP": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    }
  }
}

Responses

200 -

Example

undefined