大模型调用的流式输出和非流式输出的区别

流式输出

curl -L -X POST 'https://api.deepseek.com/chat/completions' \ -H 'Content-Type: application/json' \ -H 'Accept: text/event-stream' \ -H 'Authorization: Bearer <TOKEN>' \ --no-buffer \ --data-raw '{ "messages": [ { "content": "You are a helpful assistant", "role": "system" }, { "content": "Hi", "role": "user" } ], "model": "deepseek-flash", "thinking": { "type": "enabled" }, "reasoning_effort": "none", "max_tokens": 4096, "response_format": { "type": "text" }, "stop": null, "stream": true, "stream_options": { "include_usage": true }, "temperature": 1, "top_p": 1, "tools": null, "tool_choice": "none", "logprobs": false, "top_logprobs": null }'

结果:
image

非流式输出

curl -L -X POST 'https://api.deepseek.com/chat/completions' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <TOKEN>' \ --data-raw '{ "messages": [ { "content": "You are a helpful assistant", "role": "system" }, { "content": "Hi", "role": "user" } ], "model": "deepseek-flash", "thinking": { "type": "enabled" }, "reasoning_effort": "none", "max_tokens": 4096, "response_format": { "type": "text" }, "stop": null, "stream": false, "stream_options": null, "temperature": 1, "top_p": 1, "tools": null, "tool_choice": "none", "logprobs": false, "top_logprobs": null }'

结果:
image
`

posted @ 2026-10-14 08:32  嗨嗨嗨1127  阅读(3)  评论(0)    收藏  举报