创建对话补全。支持流式(SSE)和非流式两种模式。非流式:设置 stream: false(默认),返回完整响应
流式:设置 stream: true,以 SSE 逐块返回 ChatCompletionChunk
Request
Provide your bearer token in the Authorization
header when making requests to protected resources. Example:Authorization: Bearer ********************
Body Params application/jsonRequired
{
"model": "deepseek-v3",
"messages": [
{
"role": "system",
"content": "你是一个有帮助的助手"
},
{
"role": "user",
"content": "你好"
}
],
"stream": false,
"temperature": 0.7
}
Request Code Samples
curl --location '/v1/chat/completions' \
--header 'X-Request-Id;' \
--header 'X-Tenant-Id;' \
--header 'X-Channel;' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "deepseek-v3",
"messages": [
{
"role": "system",
"content": "你是一个有帮助的助手"
},
{
"role": "user",
"content": "你好"
}
],
"stream": false,
"temperature": 0.7
}'
Responses
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1713833628,
"model": "deepseek-v3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好!有什么可以帮你的吗?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 8,
"total_tokens": 23
}
}
Modified at 2026-06-29 08:45:13