curl -X POST http://127.0.0.1:10000/v1/chat/completions
-H "Authorization: Bearer xxxx"
-H "Content-Type: application/json"
-d '{
"model": "opencode/minimax-m2.5-free",
"messages": [{"role": "user", "content": "今天北京的天气怎么样"}],
"stream": true
}'
data: {"id":"chatcmpl-1778295688734","object":"chat.completion.chunk","created":1778295692,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-1778295688734","object":"chat.completion.chunk","created":1778295692,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"delta":{"content":"用户问的是今天北京的天气怎么样。这是一个关于实时天气信息的问题,需要搜索当前天气。\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-1778295688734","object":"chat.completion.chunk","created":1778295692,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"delta":{"content":"\n\n\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-1778295688734","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":4,"completion_tokens":11,"total_tokens":15,"completion_tokens_details":{"reasoning_tokens":11}}}
data: [DONE]
curl -X POST http://127.0.0.1:10000/v1/chat/completions
-H "Authorization: Bearer xxxx"
-H "Content-Type: application/json"
-d '{
"model": "opencode/minimax-m2.5-free",
"messages": [{"role": "user", "content": "今天北京的天气怎么样"}],
"stream": false
}'
{"id":"chatcmpl-1778295708740","object":"chat.completion","created":1778295708,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"message":{"role":"assistant","content":"\n用户询问今天北京的天气怎么样。根据搜索结果,我可以看到有关北京2026年5月的天气信息。但需要注意的是,今天是2026年5月9日(从环境信息中得知),我需要找到今天的具体天气信息。\n\n从搜索结果中可以看到:\n- 2026年5月9日:14℃ ~ 27℃,晴,东风转东南风,3-4级转<3级\n\n让我更准确地给出答案。根据搜索数据,5月9日的天气是:\n- 最高温:27℃\n- 最低温:14℃\n- 天气:晴\n- 风力:东风转东南风,3-4级转<3级\n- 空气质量:优\n\n另外还有一个数据来源显示5月9日:14℃ ~ 27℃,晴。\n\n我应该给用户一个简洁的回答。\n\n\n根据天气数据,今天(2026年5月9日)北京天气:\n\n- 天气:晴\n- 气温:14°C ~ 27°C\n- 风力:东风转东南风,3-4级"},"finish_reason":"stop"}],"usage":{"prompt_tokens":4,"completion_tokens":92,"total_tokens":96,"completion_tokens_details":{"reasoning_tokens":70}}}
如果要支持流式的,需要怎么处理呢?谢谢
curl -X POST http://127.0.0.1:10000/v1/chat/completions
-H "Authorization: Bearer xxxx"
-H "Content-Type: application/json"
-d '{
"model": "opencode/minimax-m2.5-free",
"messages": [{"role": "user", "content": "今天北京的天气怎么样"}],
"stream": true
}'
data: {"id":"chatcmpl-1778295688734","object":"chat.completion.chunk","created":1778295692,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-1778295688734","object":"chat.completion.chunk","created":1778295692,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"delta":{"content":"用户问的是今天北京的天气怎么样。这是一个关于实时天气信息的问题,需要搜索当前天气。\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-1778295688734","object":"chat.completion.chunk","created":1778295692,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"delta":{"content":"\n\n\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-1778295688734","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":4,"completion_tokens":11,"total_tokens":15,"completion_tokens_details":{"reasoning_tokens":11}}}
data: [DONE]
curl -X POST http://127.0.0.1:10000/v1/chat/completions
-H "Authorization: Bearer xxxx"
-H "Content-Type: application/json"
-d '{
"model": "opencode/minimax-m2.5-free",
"messages": [{"role": "user", "content": "今天北京的天气怎么样"}],
"stream": false
}'
{"id":"chatcmpl-1778295708740","object":"chat.completion","created":1778295708,"model":"opencode/minimax-m2.5-free","choices":[{"index":0,"message":{"role":"assistant","content":"\n用户询问今天北京的天气怎么样。根据搜索结果,我可以看到有关北京2026年5月的天气信息。但需要注意的是,今天是2026年5月9日(从环境信息中得知),我需要找到今天的具体天气信息。\n\n从搜索结果中可以看到:\n- 2026年5月9日:14℃ ~ 27℃,晴,东风转东南风,3-4级转<3级\n\n让我更准确地给出答案。根据搜索数据,5月9日的天气是:\n- 最高温:27℃\n- 最低温:14℃\n- 天气:晴\n- 风力:东风转东南风,3-4级转<3级\n- 空气质量:优\n\n另外还有一个数据来源显示5月9日:14℃ ~ 27℃,晴。\n\n我应该给用户一个简洁的回答。\n\n\n根据天气数据,今天(2026年5月9日)北京天气:\n\n- 天气:晴\n- 气温:14°C ~ 27°C\n- 风力:东风转东南风,3-4级"},"finish_reason":"stop"}],"usage":{"prompt_tokens":4,"completion_tokens":92,"total_tokens":96,"completion_tokens_details":{"reasoning_tokens":70}}}
如果要支持流式的,需要怎么处理呢?谢谢