Skip to content

DeepSeekAdapter ​

DeepSeek API 的内置适配器。支持前缀缓存、工具调用和流式输出。

构造函数 ​

ts
new DeepSeekAdapter(opts: {
  apiKey: string;
  model?: string;       // 默认: "deepseek-v4-flash"
  baseUrl?: string;     // 默认: "https://api.deepseek.com"
})

属性 ​

属性值描述
modelId"deepseek-v4-flash"默认模型
contextWindow128_000Token 限制
capabilities.toolUsetrue支持工具调用
capabilities.streamingtrue支持流式输出
pricing.inputPricePer1k0.00027输入价格
pricing.cachedInputPricePer1k0.00007缓存输入价格

缓存 ​

DeepSeek 自动缓存位置 0 的前缀。适配器以 [...prefix, ...history] 发送消息,将稳定前缀放在首位以实现自动缓存检测。

基于 MIT 许可证发布