Theme
Text Generation + Thinking - Stream
POST
https://www.kkiai.com/v1beta/models/gemini-2.5-pro:streamGenerateContent
Official Documentation: https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations
Request Parameters
Authorization
Add the Authorization parameter to the Header. Its value is the Token concatenated after Bearer.
Example: Authorization: Bearer ********************
Query Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
key | string | Required | {{YOUR_API_KEY}} | |
alt | string | Optional | sse |
Header Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
Content-Type | string | Required | application/json |
Body Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
contents | array[object] | Required | |
└ parts | array[object] | Optional |
Request Example
json
{
"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
}
}
}cURL Example
bash
curl --location -g --request POST 'https://www.kkiai.com/v1beta/models/gemini-2.5-pro:streamGenerateContent?key=&alt=sse' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"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
}
}
}'Response
🟢 200 Success
Response Example
json
{}