流式返回
如果你希望边生成边输出内容,可以在请求体中启用 stream: true。
curl 示例
bash
curl https://yunqiaoai.com.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <你的 API Key>" \
-d '{
"model": "gpt-4o-mini",
"stream": true,
"messages": [
{"role": "user", "content": "请逐步说明如何创建 API Key"}
]
}'如果你的客户端支持 Server-Sent Events,请按服务端返回的流式分片逐段读取内容。