DeepSeek-V3.1上线公告
更新时间:2025-08-25
DeepSeek-V3.1 已上线千帆 ModelBuilder,模型信息及请求示例如下:
模型信息
对齐DeepSeek官方API,按照思考和非思考不同模式,千帆开放2个model,您可根据使用需要将模型便捷升级至最新版本:
| 服务名称/ID | model参数/接入点ID | 当前计费方式 | 计费详情 | 服务速率限制 | 说明 |
|---|---|---|---|---|---|
| DeepSeek-V3.1-250821 | deepseek-v3.1-250821 | 按量后付费 | 输入: 0.004 元/千Tokens 输出: 0.012 元/千Tokens |
RPM=60 TPM=150000 |
非思考模式 |
| DeepSeek-V3.1-Think-250821 | deepseek-v3.1-think-250821 | 按量后付费 | 输入: 0.004 元/千Tokens 输出: 0.012 元/千Tokens |
RPM=60 TPM=150000 |
思考模式 |
功能特性
- 思考和非思考2种模式下均支持 Function calling,使用详情请查看说明。
- 强化了 DeepSeek-V3.1 在单工具多次调用、多工具调用上的效果。
快速体验
请求示例
快速开始
curl --location 'https://qianfan.baidubce.com/v2/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer bce-v3/ALTAK-*********/614fb**********' \
--data '{
"model": "deepseek-v3.1-250821",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "你好"
}
]
}'Function calling 请求
多工具调用
请求
curl --location 'https://qianfan.baidubce.com/v2/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer api-key' \
--data '{
"model": "deepseek-v3.1-think-250821",
"messages": [
{
"role": "user",
"content": "现在几点了,杭州余杭区天气怎么样"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_time",
"description": "获取当前时间,可指定时区和输出格式",
"parameters": {
"type": "object",
"properties": {
"timezone": {
"type": "string",
"description": "时区名称,例如Asia/Shanghai、UTC"
},
"format": {
"type": "string",
"description": "时间格式字符串,默认%Y-%m-%d %H:%M:%S"
}
},
"required": [
"timezone",
"format"
]
}
}
},
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "天气查询工具",
"parameters": {
"type": "object",
"properties": {
"location": {
"description": "地理位置,精确到区县级别",
"type": "string"
},
"time": {
"description": "时间,格式为YYYY-MM-DD",
"type": "string"
}
},
"required": [
"location",
"time"
]
}
}
},
{
"type": "function",
"function": {
"name": "query_train_info",
"description": "根据用户提供的信息,查询对应的车次",
"parameters": {
"type": "object",
"properties": {
"departure": {
"type": "string",
"description": "出发城市或车站"
},
"destination": {
"type": "string",
"description": "目的地城市或车站"
},
"date": {
"type": "string",
"description": "要查询的车次日期"
}
},
"required": [
"departure",
"destination",
"date"
]
}
}
}
],
"stream": false
}'返回
{
"id": "as-kh4jgf9m28",
"object": "chat.completion",
"created": 1755946205,
"model": "deepseek-v3.1-think-250821",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "",
"reasoning_content": "嗯,用户同时问了时间和天气两个问题。时间查询需要时区和格式参数,中国用上海时区比较合适,默认格式就行。天气查询需要具体位置和日期,用户给了杭州余杭区,日期可以用今天的。\n\n需要分别调用两个工具:先获取当前时间,再查询天气。时间工具要指定时区为Asia/Shanghai,天气工具要指定location为杭州余杭区,time用当前日期。\n\n两个查询相互独立,可以同时调用。等工具返回结果后,再把时间和天气信息整合起来回复用户。",
"tool_calls": [
{
"id": "3366b67079df4e58b6765e20e21db659",
"type": "function",
"function": {
"name": "get_current_time",
"arguments": "{\"timezone\": \"Asia/Shanghai\", \"format\": \"%Y-%m-%d %H:%M:%S\"}"
}
},
{
"id": "dce0625a4db74966a663b73cb588d98f",
"type": "function",
"function": {
"name": "get_current_weather",
"arguments": "{\"location\": \"杭州余杭区\", \"time\": \"2023-11-11\"}"
}
}
]
},
"finish_reason": "tool_calls",
"flag": 0
}
],
"usage": {
"prompt_tokens": 676,
"completion_tokens": 214,
"total_tokens": 890,
"completion_tokens_details": {
"reasoning_tokens": 117
}
}
}单工具多次调用
请求
curl --location 'https://qianfan.baidubce.com/v2/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data '{
"model": "deepseek-v3.1-think-250821",
"messages": [
{
"role": "user",
"content": "查一下2025-8-21上海和北京的天气"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "天气查询工具",
"parameters": {
"type": "object",
"properties": {
"location": {
"description": "地理位置,精确到区县级别",
"type": "string"
},
"time": {
"description": "时间,格式为YYYY-MM-DD",
"type": "string"
}
},
"required": [
"location",
"time"
]
}
}
}
],
"stream": false,
"tool_choice": "auto"
}'返回
{
"id": "as-6krgvfjq1m",
"object": "chat.completion",
"created": 1755946305,
"model": "deepseek-v3.1-think-250821",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "",
"reasoning_content": "首先,用户查询的是2025年8月21日上海和北京的天气。我需要使用提供的工具来获取天气信息。工具是get_current_weather,它需要两个参数:location(地理位置,精确到区县级别)和time(时间,格式为YYYY-MM-DD)。\n\n用户指定了时间和两个城市:上海和北京。我需要为每个城市分别调用工具。\n\n工具列表显示,函数调用时需要指定name和arguments。arguments是一个JSON对象,包含location和time。\n\n时间用户已经给出:2025-8-21,格式是YYYY-MM-DD,所以我应该使用2025-08-21(确保月份和日期是两位)。\n\n地点:用户说“上海和北京”,我需要为每个城市调用一次工具。工具要求location精确到区县级别,但用户只提供了城市名。我应该使用城市名作为location,因为工具描述说“精确到区县级别”,但城市名可能被视为默认的区县级别。例如,北京可能默认指北京市中心或类似。如果工具需要更精确,我可能需要假设一个默认区县,但用户没有指定,所以我应该使用城市名。\n\n在工具参数中,location的描述是“地理位置,精确到区县级别”,所以对于北京,我可以用“北京市”或类似,但为了简单,我应该使用“北京”和“上海”,因为工具可能处理城市名。\n\n时间:2025-08-21。\n\n我需要调用工具两次:一次 for 北京,一次 for 上海。\n\n输出格式:如果需要调用工具,必须以<tool_calls_begin>开始,然后每个工具调用用<tool_call_begin>name<tool_sep>arguments<tool_call_end>,最后<tool_calls_end>。\n\n对于多次调用,格式是:\n\n<tool_calls_begin>\n\n<tool_call_begin>name<tool_sep>\n\narguments\n\n<tool_call_end>\n\n<tool_call_begin>name<tool_sep>\n\narguments\n\n<tool_call_end>\n\n<tool_calls_end>\n\nname 是函数名,这里是 get_current_weather。\n\narguments 是 JSON 格式的参数。\n\n所以,对于北京:\n\n- name: get_current_weather\n\n- arguments: {\"location\": \"北京\", \"time\": \"2025-08-21\"}\n\n对于上海:\n\n- arguments: {\"location\": \"上海\", \"time\": \"2025-08-21\"}\n\n时间格式:用户说“2025-8-21”,但我应该标准化为“2025-08-21”以确保月份和日期是两位数字,符合YYYY-MM-DD格式。\n\n在JSON中,arguments需要是有效的JSON字符串。\n\n在输出中,arguments应该直接是JSON对象,但根据格式,它应该写在<tool_sep>之后。\n\n查看输出格式:\"<tool_call_begin>name<tool_sep>arguments<tool_call_end>\"\n\n所以,对于每个调用,它应该是:\n\n<tool_call_begin>get_current_weather<tool_sep>\n\n{\"location\": \"北京\", \"time\": \"2025-08-21\"}\n\n<tool_call_end>\n\n然后另一个类似。\n\n注意:在arguments中,JSON应该正确格式化,键值对用双引号。\n\n由于是两个调用,我需要输出两个<tool_call>块。\n\n最后,用<tool_calls_end>结束。\n\n我不需要直接回复用户内容,因为我在调用工具。工具调用后,我会得到结果,然后可以基于结果回复用户,但在这里,我只需要输出工具调用。\n\n用户的问题是基于当前对话,我需要调用工具来获取信息。\n\n所以,我的响应应该只是工具调用。\n\n确认是否需要调用工具:是的,用户查询天气,我有天气工具。\n\n因此,输出应该是工具调用格式。\n\n编写arguments:\n\n对于北京: {\"location\": \"北京\", \"time\": \"2025-08-21\"}\n\n对于上海: {\"location\": \"上海\", \"time\": \"2025-08-21\"}\n\n时间使用\"2025-08-21\",而不是\"2025-8-21\",以符合YYYY-MM-DD。\n\n在JSON中,确保字符串用双引号。\n\n在输出中,arguments应该是一行JSON,但格式中可能允许多行,但最好保持紧凑。\n\n看格式示例:\"arguments\" 是写在<tool_sep>之后,可能是一行。\n\n在示例中,没有指定多行,所以我应该写在一行。\n\n但为了可读性,在代码中可能可以多行,但既然是文本输出,我应该保持JSON紧凑。\n\n在工具调用格式中,arguments是JSON字符串,所以我可以写{\"location\": \"北京\", \"time\": \"2025-08-21\"} 在一行。\n\n类似地。\n\n顺序:用户先说上海,然后北京,但顺序可能不重要,我可以按用户提到的顺序或任意。用户说“上海和北京”,所以我先上海后北京,或反过来。但工具调用顺序不影响,所以我可以任意。\n\n在输出中,我按城市字母顺序或用户顺序。用户先说上海,所以我先调用上海的工具。\n\n用户说“查一下2025-8-21上海和北京的天气”,所以先上海后北京。\n\n在工具调用中,顺序可能不重要,但为了一致,我按用户顺序。\n\n首先调用上海,然后北京。\n\n时间:2025-08-21。\n\n现在,编写输出。",
"tool_calls": [
{
"id": "2472a13e268c49a2be6a72502d31c155",
"type": "function",
"function": {
"name": "get_current_weather",
"arguments": "{\"location\": \"上海\", \"time\": \"2025-08-21\"}"
}
},
{
"id": "c7b0f4d665d647bda8f17d5e120b22e9",
"type": "function",
"function": {
"name": "get_current_weather",
"arguments": "{\"location\": \"北京\", \"time\": \"2025-08-21\"}"
}
}
]
},
"finish_reason": "tool_calls",
"flag": 0
}
],
"usage": {
"prompt_tokens": 370,
"completion_tokens": 1189,
"total_tokens": 1559,
"completion_tokens_details": {
"reasoning_tokens": 1102
}
}
}