主题
创建聊天补全 deepseek v3.1思考程度 (流式)
POST
https://az.gptplus5.com/v1/chat/completions
请求参数
Authorization
在 Header 添加参数Authorization,其值为在 Bearer 之后拼接 Token
示例:Authorization: Bearer ********************
Header 参数
| 参数名 | 类型 | 必需 | 说明 | 示例 |
|---|---|---|---|---|
Content-Type | string | 必需 | application/json | |
Accept | string | 必需 | application/json | |
Authorization | string | 可选 | Bearer {{YOUR_API_KEY}} | |
X-Forwarded-Host | string | 可选 | localhost:5173 |
Body 参数 (application/json)
| 参数名 | 类型 | 必需 | 说明 |
|---|---|---|---|
model | string | 必需 | 使用的模型的 ID。 |
max_tokens | integer | 可选 | 限制一次请求中模型生成 completion 的最大 token 数。输入 token 和输出 token 的总长度受模型的上下文长度的限制。 |
messages | array[object] | 必需 | |
└ role | string | 必需 | |
└ content | string | 必需 | |
temperature | integer | 可选 | 使用什么采样温度,介于 0 和 2 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如 0.2)将使输出更加集中和确定。 |
stream | boolean | 可选 | 如果设置为 True,将会以 SSE(server-sent events)的形式以流式发送消息增量。消息流以 data: [DONE] 结尾。 |
stream_options | object | 可选 | 流式输出相关选项。只有在 stream 参数为 true 时,才可设置此参数。 |
└ include_usage | boolean | 可选 | 如果设置为 true,在流式消息最后的 data: [DONE] 之前将会传输一个额外的块。此块上的 usage 字段显示整个请求的 token 使用统计信息,而 choices 字段将始终是一个空数组。所有其他块也将包含一个 usage 字段,但其值为 null。 |
thinking | object | 可选 | 部分深度思考能力的模型支持通过 thinking 字段控制是否关闭深度思考能力。 |
└ type | string | 可选 | enabled:默认强制开启,强制开启深度思考能力。 disabled:强制关闭深度思考能力。 auto:模型自行判断是否进行深度思考。 |
请求示例
json
{
"model": "deepseek-v3-1-250821",
"max_tokens": 1000,
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "你好"
}
],
"temperature": 1.0,
"stream": true,
"stream_options": {
"include_usage": true
},
"thinking":{
"type":"enabled"
}
}cURL 示例
bash
curl --location --request POST 'https://az.gptplus5.com/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "deepseek-v3-1-250821",
"max_tokens": 1000,
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "你好"
}
],
"temperature": 1.0,
"stream": true,
"stream_options": {
"include_usage": true
},
"thinking":{
"type":"enabled"
}
}'返回响应
🟢200OK
响应 Body
| 参数名 | 类型 | 必需 | 说明 |
|---|---|---|---|
id | string | 必需 | |
object | string | 必需 | |
created | integer | 必需 | |
choices | array[object] | 必需 | |
└ index | integer | 可选 | |
└ message | object | 可选 | |
└ finish_reason | string | 可选 | |
usage | object | 必需 | |
└ prompt_tokens | integer | 必需 | |
└ completion_tokens | integer | 必需 | |
└ total_tokens | integer | 必需 |
响应示例
json
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}