DeepSeek V3.1 Terminus API

deepseek/deepseek-v3.1-terminus

DeepSeek-V3.1 Terminus 是 DeepSeek V3.1 的升级版本,在保留模型原有能力的基础上,针对用户反馈的语言一致性和智能体能力等问题进行了优化,进一步提升了模型在编程和搜索智能体场景下的表现。该模型是大型混合推理模型(参数总量6710亿,激活参数370亿),支持思考与非思考两种模式。它通过两阶段长上下文训练流程扩展了 DeepSeek-V3 的基础能力,上下文长度最高可达128K词元,并采用FP8微缩放技术实现高效推理。用户可通过 {"reasoning": {"enabled": true}} 布尔参数控制推理行为。该模型优化了工具调用、代码生成和推理效率,在困难基准测试中达到与 DeepSeek-R1 相当的性能,同时响应速度更快。它支持结构化工具调用、代码智能体与搜索智能体,适用于研究、编程和智能体工作流等场景。

模型 ID
deepseek/deepseek-v3.1-terminus
更新日期
模型能力
文本生成
上下文长度
128 K
模型价格(每 1000 tokens 输入)
¥ 0.00375
模型价格(每 1000 tokens 输出)
¥ 0.0125
模型系列
DeepSeek

DeepSeek V3.1 Terminus 模型介绍:

DeepSeek-V3.1 是一款混合模型,支持思考模式与非思考模式。与之前版本相比,本次升级在多个方面带来改进:

  • 混合思考模式:通过更改对话模板,同一模型可在思考模式与非思考模式之间切换使用。
  • 更智能的工具调用:通过后训练优化,模型在工具使用与代理(agent)任务上的性能显著提升。
  • 更高的思考效率:DeepSeek-V3.1-Think 在回答质量上可与 DeepSeek-R1-0528 相当,同时响应速度更快。

DeepSeek-V3.1 在 DeepSeek-V3.1-Base 的基础上进行了后训练。DeepSeek-V3.1-Base 则基于原始 V3 的基础检查点,采用两阶段的长上下文扩展方法构建,遵循原始 DeepSeek-V3 报告中描述的方法。我们通过收集更多的长文档大幅扩充了数据集,并显著延长了两阶段的训练量:32K 扩展阶段增加了 10 倍,达到 630B(约 6,300 亿)tokens;128K 扩展阶段扩展了 3.3 倍,达到 209B(约 2,090 亿)tokens。

此外,DeepSeek-V3.1 在模型权重与激活上均采用 UE8M0 FP8 缩放(scale)数据格式 进行训练,以保证与 microscaling 数据格式的兼容性。

本次更新在保持模型原有能力的同时,针对用户反馈的问题进行了修复,包括:

  • 语言一致性:减少中英夹杂的情况及偶发的异常字符;
  • 代理能力:进一步优化 Code Agent 和 Search Agent 的性能。
基准 DeepSeek-V3.1 DeepSeek-V3.1-Terminus
推理模式(不使用工具)
MMLU-Pro 84.8 85.0
GPQA-Diamond 80.1 80.7
Humanity's Last Exam 15.9 21.7
LiveCodeBench 74.8 74.9
Codeforces 2091 2046
Aider-Polyglot 76.3 76.1
Agentic 使用工具
BrowseComp 30.0 38.5
BrowseComp-zh 49.2 45.0
SimpleQA 93.4 96.8
SWE Verified 66.0 68.4
SWE-bench Multilingual 54.5 57.8
Terminal-bench 31.3 36.7

API 接口地址:

https://wcode.net/api/gpt/v1/chat/completions

此 API 接口兼容 OpenAI 的接口规范,也就是可以直接使用 OpenAI 的 SDK 来调用各个模型。仅需替换以下两项配置即可:

  1. base_url 替换为 https://wcode.net/api/gpt/v1
  2. api_key 替换为从 https://wcode.net/get-apikey 获取到的 API Key

具体可参考下方的各编程语言代码示例中的 openai sdk 调用示例。

请求方法:

POST

各编程语言代码示例:

# TODO: 以下代码中的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
curl --request POST 'https://wcode.net/api/gpt/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_KEY' \
--data '{
    "model": "deepseek/deepseek-v3.1-terminus",
    "messages": [
        {
            "role": "user",
            "content": "你好"
        }
    ]
}'
import Foundation

let headers = [
  "Authorization": "Bearer API_KEY",     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
  "content-type": "application/json"
]
let parameters = [
  "model": "deepseek/deepseek-v3.1-terminus",
  "messages": [
    [
      "role": "user",
      "content": "你好"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://wcode.net/api/gpt/v1/chat/completions")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 60.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
var headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer API_KEY'     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
};
var request = http.Request('POST', Uri.parse('https://wcode.net/api/gpt/v1/chat/completions'));
request.body = json.encode({
  "model": "deepseek/deepseek-v3.1-terminus",
  "messages": [
    {
      "role": "user",
      "content": "你好"
    }
  ]
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
require 'uri'
require 'net/http'

url = URI("https://wcode.net/api/gpt/v1/chat/completions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer API_KEY'     # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
request["content-type"] = 'application/json'
request.body = "{\"model\":\"deepseek/deepseek-v3.1-terminus\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}"

response = http.request(request)
puts response.read_body
use serde_json::json;
use reqwest;

#[tokio::main]
pub async fn main() {
  let url = "https://wcode.net/api/gpt/v1/chat/completions";

  let payload = json!({
    "model": "deepseek/deepseek-v3.1-terminus",
    "messages": (
      json!({
        "role": "user",
        "content": "你好"
      })
    )
  });

  let mut headers = reqwest::header::HeaderMap::new();
  headers.insert("Authorization", "Bearer API_KEY".parse().unwrap());     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
  headers.insert("content-type", "application/json".parse().unwrap());

  let client = reqwest::Client::new();
  let response = client.post(url)
    .headers(headers)
    .json(&payload)
    .send()
    .await;

  let results = response.unwrap()
    .json::<serde_json::Value>()
    .await
    .unwrap();

  dbg!(results);
}
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://wcode.net/api/gpt/v1/chat/completions");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer API_KEY");    // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"model\":\"deepseek/deepseek-v3.1-terminus\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}");

CURLcode ret = curl_easy_perform(hnd);
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {
  url := "https://wcode.net/api/gpt/v1/chat/completions"

  payload := strings.NewReader("{\"model\":\"deepseek/deepseek-v3.1-terminus\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Authorization", "Bearer API_KEY")     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
  req.Header.Add("content-type", "application/json")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
using System.Net.Http.Headers;


var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Post, "https://wcode.net/api/gpt/v1/chat/completions");

request.Headers.Add("Authorization", "Bearer API_KEY");     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey

request.Content = new StringContent("{\"model\":\"deepseek/deepseek-v3.1-terminus\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}", null, "application/json");

var response = await client.SendAsync(request);

response.EnsureSuccessStatusCode();

Console.WriteLine(await response.Content.ReadAsStringAsync());
var client = new RestClient("https://wcode.net/api/gpt/v1/chat/completions");

var request = new RestRequest("", Method.Post);

request.AddHeader("Authorization", "Bearer API_KEY");     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey

request.AddHeader("content-type", "application/json");

request.AddParameter("application/json", "{\"model\":\"deepseek/deepseek-v3.1-terminus\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}", ParameterType.RequestBody);

var response = client.Execute(request);
const axios = require('axios');

let data = JSON.stringify({
  "model": "deepseek/deepseek-v3.1-terminus",
  "messages": [
    {
      "role": "user",
      "content": "你好"
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://wcode.net/api/gpt/v1/chat/completions',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer API_KEY'     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
  },
  data : data
};

axios.request(config).then((response) => {
  console.log(JSON.stringify(response.data));
}).catch((error) => {
  console.log(error);
});
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");

RequestBody body = RequestBody.create(mediaType, "{\"model\":\"deepseek/deepseek-v3.1-terminus\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}");

Request request = new Request.Builder()
  .url("https://wcode.net/api/gpt/v1/chat/completions")
  .post(body)
  .addHeader("Authorization", "Bearer API_KEY")             // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
$client = new \GuzzleHttp\Client();

$headers = [
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer API_KEY',     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
];

$body = '{
  "model": "deepseek/deepseek-v3.1-terminus",
  "messages": [
    {
      "role": "user",
      "content": "你好"
    }
  ]
}';

$request = new \GuzzleHttp\Psr7\Request('POST', 'https://wcode.net/api/gpt/v1/chat/completions', $headers, $body);

$response = $client->sendAsync($request)->wait();

echo $response->getBody();
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://wcode.net/api/gpt/v1/chat/completions",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 5,
  CURLOPT_TIMEOUT => 300,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'model' => 'deepseek/deepseek-v3.1-terminus',
    'messages' => [
      [
        'role' => 'user',
        'content' => '你好'
      ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer API_KEY",     // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
    "content-type: application/json",
  ],
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
  echo "cURL Error #:" . $error;
} else {
  echo $response;
}
import requests
import json

url = "https://wcode.net/api/gpt/v1/chat/completions"

payload = {
  "model": "deepseek/deepseek-v3.1-terminus",
  "messages": [
    {
      "role": "user",
      "content": "你好"
    }
  ]
}

headers = {
  "Authorization": "Bearer API_KEY",     # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
  "content-type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(json.dumps(response.json(), indent=4, ensure_ascii=False))
from openai import OpenAI

client = OpenAI(
  base_url="https://wcode.net/api/gpt/v1",
  api_key="API_KEY"                             # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
)

completion = client.chat.completions.create(
  model="deepseek/deepseek-v3.1-terminus",
  messages=[
    {
      "role": "user",
      "content": "你好"
    }
  ]
)

print(completion.choices[0].message.content)

API 响应示例:

{
    "id": "chatcmpl-t1759072261s267r130e11a2e951df70cc2e41b3",
    "model": "deepseek/deepseek-v3.1-terminus",
    "object": "chat.completion",
    "created": 1759072262,
    "choices": [
        {
            "logprobs": null,
            "finish_reason": "stop",
            "native_finish_reason": "stop",
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "你好!很高兴认识你!😊\n\n我是DeepSeek,由深度求索公司创造的AI助手。让我简单介绍一下自己:\n\n**基本信息:**\n- 我是一个纯文本AI模型,专注于理解和生成文字内容\n- 知识截止到2024年7月,是DeepSeek的最新版本\n\n**我能为你做什么:**\n✨ **文本处理**:写作、翻译、总结、分析等\n✨ **问题解答**:涵盖各个领域的知识问答\n✨ **编程帮助**:代码编写、调试、算法解释\n✨ **创意协作**:头脑风暴、策划、创意写作\n✨ **学习辅助**:概念解释、学习规划、答疑解惑\n\n**特色功能:**\n- 📁 **文件上传**:支持图像、txt、pdf、ppt、word、excel等文件,从中读取文字信息进行处理\n- 💬 **长对话**:支持128K上下文,可以进行很长的对话\n\n- 可通过官方应用商店下载App\n\n我的回复风格比较热情细腻,希望能给你带来温暖的交流体验!有什么问题或需要帮助的地方,尽管告诉我,我会尽力协助你!🤗",
                "refusal": null,
                "reasoning": null
            }
        }
    ],
    "usage": {
        "prompt_tokens": 9,
        "completion_tokens": 270,
        "total_tokens": 279,
        "prompt_tokens_details": null
    }
}

可选参数:

重要提示:由于模型架构不同,部分参数可能仅适用于特定的模型。

温度

  • 参数:temperature

  • 可选,浮点数,0.0 到 2.0

  • 默认:1.0

此设置影响模型回复的多样性。较低的值会使回复更可预测、更常见;较高的值会鼓励更具多样性且较不常见的回复。当设置为 0 时,模型对相同输入将尽可能的给出相同的回复。

Top-P

  • 参数:top_p

  • 可选,float,0.0 至 1.0

  • 默认值:1.0

top_p 参数控制模型在生成文本时的候选词选择范围。具体来说,模型会生成一组候选 token,然后从累积概率达到或超过 p 的 token 中随机选择一个作为输出。通过这种方式,top_p 能够在保证生成内容的多样性的同时,考虑到概率分布的合理性。

由于 temperature 与 top_p 均可以控制生成文本的多样性,因此建议您只设置其中一个值。

Top-K

  • 参数:top_k

  • 可选,int,>= 0

  • 默认值:0

top_k 会限制模型在每一步对 token 的选择,使其从较小的集合中进行选择。值为 1 表示模型将始终选择最有可能的下一个 token,从而得到可预测的结果。

频率惩罚

  • 参数:frequency_penalty

  • 可选,float,-2.0 至 2.0

  • 默认值:0.0

frequency_penalty 可根据词条在输入中出现的频率来控制其重复使用。它会尝试减少那些在输入中出现频率较高的词条的使用频率,这与它们出现的频率成正比。词条惩罚会随着出现次数的增加而增加。负值将鼓励词条重复使用。

存在惩罚

  • 参数:presence_penalty

  • 可选,float,-2.0 至 2.0

  • 默认值:0.0

presence_penalty 调整模型重复输入中已使用的特定标记的频率。值越高,重复的可能性就越小,负值则相反。标记惩罚不会随着出现次数而变化。负值会鼓励标记重用。

重复惩罚

  • 参数:repetition_penalty

  • 可选,float,0.0 至 2.0

  • 默认值:1.0

repetition_penalty 有助于减少输入中标记的重复。较高的值会降低模型重复标记的可能性,但过高的值会使输出不够连贯(通常会出现缺少小词的连续句子)。标记惩罚会根据原始标记的概率进行调整。

Min-P

  • 参数:min_p

  • 可选,float,0.0 至 1.0

  • 默认值:0.0

min_p 表示某个 token 被考虑的最小概率,该概率是相对于最可能的 token 的概率而言的。如果 min_p 设置为 0.1,则意味着它只允许概率至少为最佳选项十分之一的 token 被考虑。

Top-A

  • 参数:top_a

  • 可选,float,0.0 到 1.0

  • 默认值:0.0

top_a 仅考虑概率“足够高”的 top tokens,该概率基于最可能的 token 概率。可以将其视为一个动态的 Top-P。较低的 Top-A 值会根据概率最高的 token 集中选择,但范围会更窄。较高的 Top-A 值不一定会影响输出的创造性,但会根据最大概率优化过滤过程。

种子

  • 参数:seed

  • 可选,int

如果指定了 seed 参数,推理将确定性地进行采样,即使用相同种子和参数的重复请求应该返回相同的结果。某些模型无法保证确定性。

最大 tokens 数

  • 参数:max_tokens

  • 可选,int,>= 1

max_tokens 可设定模型在响应中可以生成的 token 数量的上限。模型不会生成超过此限制的 token。其最大值等于上下文长度减去 prompt 长度。

Logit Bias

  • 参数:logit_bias

  • 可选,object

logit_bias 是一个可选参数,用于修改指定 token 在模型生成输出中出现的可能性。

对数概率

  • 参数:logprobs

  • 可选,boolean

logprobs 设置是否返回输出 token 的对数概率。如果为 true,则返回每个输出 token 的对数概率。

最高对数概率

  • 参数:top_logprobs

  • 可选,int

top_logprobs 是一个介于 0 和 20 之间的整数,指定在每个 token 位置要返回的最可能 token 的数量,每个 token 都会带有相应的对数概率。如果使用此参数,则必须将 logprobs 设置为 true

响应格式

  • 参数:response_format

  • 可选,object

response_format 强制模型产出特定的输出格式。将其设置为 { "type": "json_object" } 可启用 JSON 模式,保证模型生成的消息为有效的 JSON。

注意:使用 JSON 模式时,应同时通过 system 或 user 提示词指示模型生成 JSON。

结构化输出

  • 参数:structured_outputs

  • 可选,boolean

指示模型是否能够使用 response_format 中的 json_schema 返回结构化输出。

停止

  • 参数:stop

  • 可选,array

如果模型遇到 stop 数组中指定的任意 token,则立即停止生成。

工具

  • 参数:tools

  • 可选,array

工具调用参数,遵循 OpenAI 的工具调用请求格式。对于非 OpenAI 提供者,会相应地进行转换。

工具选择

  • 参数:tool_choice

  • 可选,array

控制模型调用哪个工具。'none' 表示模型不会调用任何工具,而是生成一条消息。'auto' 表示模型可以在生成消息或调用一个或多个工具之间进行选择。'required' 表示模型必须调用一个或多个工具。通过 {"type": "function", "function": {"name": "my_function"}} 指定特定工具会强制模型调用该工具。

并行工具调用

  • 参数:parallel_tool_calls

  • 可选,boolean

  • 默认:true

是否在使用工具时启用并行函数调用。如果为 true,模型可以同时调用多个函数。如果为 false,函数将按顺序依次调用。

冗长程度

  • 参数:verbosity

  • 可选,enumlow medium high

  • 默认:medium

控制模型响应的冗长程度和长度。较低的值会生成更简洁的回答,而较高的值会生成更详细、更全面的回答。


以上文档为标准版 API 接口文档,可直接用于项目开发和系统调用。如果标准版 API 接口无法满足您的需求,需要定制开发 API 接口,请联系我们的 IT 技术支持工程师:

(沟通需求✅ → 确认技术方案✅ → 沟通费用与工期✅ → 开发&测试✅ → 验收交付✅ → 维护升级✅)

最受关注模型

GLM 4.6

文本生成、深度思考

Qwen3 Next 80B A3B Instruct

文本生成

Qwen3 VL 235B A22B Instruct

图片识别

Tongyi DeepResearch 30B A3B

文本生成、深度研究

DeepSeek V3.2 Exp

文本生成

DeepSeek V3.1 Terminus

文本生成

Qwen3 Next 80B A3B Thinking

文本生成、深度思考

Qwen3 VL 30B A3B Instruct

图片识别

GLM 4.5

文本生成

Qwen3 Coder 30B A3B Instruct

代码生成

最新发布模型

Baidu ERNIE 4.5 21B A3B Thinking

文本生成、深度思考

Qwen3 VL 30B A3B Thinking

图片识别、深度思考

Qwen3 VL 30B A3B Instruct

图片识别

GLM 4.6

文本生成、深度思考

DeepSeek V3.2 Exp

文本生成

Qwen3 VL 235B A22B Thinking

图片识别

Qwen3 VL 235B A22B Instruct

图片识别

DeepSeek V3.1 Terminus

文本生成

Tongyi DeepResearch 30B A3B

文本生成、深度研究

Qwen3 Next 80B A3B Instruct

文本生成