stream
为 true 即可,详情请参见以下代码。curl --location --request POST 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions' \
--header 'Authorization: Bearer {{DASHSCOPE_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "qwen-plus",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "你是谁?"
}
],
"stream":true,
"stream_options":{
"include_usage":true
}
}'
{
"choices": [
{
"delta": {
"content": "string",
"role": "string"
},
"index": 0,
"logprobs": null,
"finish_reason": null
}
],
"object": "string",
"usage": null,
"created": 0,
"system_fingerprint": null,
"model": "string",
"id": "string"
}