Text Generation + Thinking - Streaming
Endpoint: POST https://4zapi.com/v1beta/models/gemini-3.8-flash:streamGenerateContent
Official documentation: https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations
Parameters
key(query, string, required)alt(query, string)Content-Type(header, string, required)
Request body (application/json)
contents(array<object>, required)
Request example
{
"contents": [
{
"parts": [
{
"text": "1+2+3+4+5+....+999?"
}
],
"role": "user"
}
],
"generationConfig": {
"temperature": 1,
"thinkingConfig": {
"includeThoughts": true,
"thinkingBudget": 26240
},
"topP": 1
},
"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"
}
],
"systemInstruction": {
"parts": [
{
"text": "hi"
}
],
"role": "user"
},
"tools": []
}