Gemini Stream Generate Content
curl --request POST \
--url https://api.acedata.cloud/v1beta/models/{model}:streamGenerateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"parts": [
{
"text": "<string>",
"inlineData": {
"mimeType": "<string>",
"data": "<string>"
},
"fileData": {
"mimeType": "<string>",
"fileUri": "<string>"
},
"functionCall": {
"name": "<string>",
"args": {}
},
"functionResponse": {
"name": "<string>",
"response": {}
}
}
]
}
]
}
'import requests
url = "https://api.acedata.cloud/v1beta/models/{model}:streamGenerateContent"
payload = { "contents": [{ "parts": [
{
"text": "<string>",
"inlineData": {
"mimeType": "<string>",
"data": "<string>"
},
"fileData": {
"mimeType": "<string>",
"fileUri": "<string>"
},
"functionCall": {
"name": "<string>",
"args": {}
},
"functionResponse": {
"name": "<string>",
"response": {}
}
}
] }] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contents: [
{
parts: [
{
text: '<string>',
inlineData: {mimeType: '<string>', data: '<string>'},
fileData: {mimeType: '<string>', fileUri: '<string>'},
functionCall: {name: '<string>', args: {}},
functionResponse: {name: '<string>', response: {}}
}
]
}
]
})
};
fetch('https://api.acedata.cloud/v1beta/models/{model}:streamGenerateContent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"candidates": [
{
"content": {
"parts": [
{
"text": "<string>",
"thought": true
}
],
"role": "<string>"
},
"finishReason": "STOP",
"index": 123,
"safetyRatings": [
{
"category": "<string>",
"probability": "<string>",
"blocked": true
}
]
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123,
"thoughtsTokenCount": 123,
"promptTokensDetails": [
{
"modality": "<string>",
"tokenCount": 123
}
],
"candidatesTokensDetails": [
{
"modality": "<string>",
"tokenCount": 123
}
]
},
"modelVersion": "<string>",
"responseId": "<string>"
}
]API Reference
Gemini Stream Generate Content
V1Beta Models Model Generatecontent
POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
Gemini Stream Generate Content
curl --request POST \
--url https://api.acedata.cloud/v1beta/models/{model}:streamGenerateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"parts": [
{
"text": "<string>",
"inlineData": {
"mimeType": "<string>",
"data": "<string>"
},
"fileData": {
"mimeType": "<string>",
"fileUri": "<string>"
},
"functionCall": {
"name": "<string>",
"args": {}
},
"functionResponse": {
"name": "<string>",
"response": {}
}
}
]
}
]
}
'import requests
url = "https://api.acedata.cloud/v1beta/models/{model}:streamGenerateContent"
payload = { "contents": [{ "parts": [
{
"text": "<string>",
"inlineData": {
"mimeType": "<string>",
"data": "<string>"
},
"fileData": {
"mimeType": "<string>",
"fileUri": "<string>"
},
"functionCall": {
"name": "<string>",
"args": {}
},
"functionResponse": {
"name": "<string>",
"response": {}
}
}
] }] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contents: [
{
parts: [
{
text: '<string>',
inlineData: {mimeType: '<string>', data: '<string>'},
fileData: {mimeType: '<string>', fileUri: '<string>'},
functionCall: {name: '<string>', args: {}},
functionResponse: {name: '<string>', response: {}}
}
]
}
]
})
};
fetch('https://api.acedata.cloud/v1beta/models/{model}:streamGenerateContent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"candidates": [
{
"content": {
"parts": [
{
"text": "<string>",
"thought": true
}
],
"role": "<string>"
},
"finishReason": "STOP",
"index": 123,
"safetyRatings": [
{
"category": "<string>",
"probability": "<string>",
"blocked": true
}
]
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123,
"thoughtsTokenCount": 123,
"promptTokensDetails": [
{
"modality": "<string>",
"tokenCount": 123
}
],
"candidatesTokensDetails": [
{
"modality": "<string>",
"tokenCount": 123
}
]
},
"modelVersion": "<string>",
"responseId": "<string>"
}
]授权
API token from https://platform.acedata.cloud
路径参数
V1Beta Models Model Generatecontent Param Model 2
可用选项:
gemini-2.5-flash, gemini-2.5-pro, gemini-2.5-flash-lite, gemini-3-flash-preview, gemini-3.5-flash, gemini-3.1-pro, gemini-2.0-flash 示例:
"gemini-2.5-flash"
查询参数
V1Beta Models Model Generatecontent Param Alt
可用选项:
sse 请求体
application/json
V1Beta Models Model Generatecontent Contents
Show child attributes
Show child attributes
V1Beta Models Model Generatecontent Systeminstruction
Show child attributes
Show child attributes
V1Beta Models Model Generatecontent Generationconfig
Show child attributes
Show child attributes
V1Beta Models Model Generatecontent Tools
Show child attributes
Show child attributes
V1Beta Models Model Generatecontent Toolconfig
Show child attributes
Show child attributes
V1Beta Models Model Generatecontent Safetysettings
Show child attributes
Show child attributes
V1Beta Models Model Generatecontent Cachedcontent

