在 OpenCode 中快速启用 DeepSeek V4 模型

在 OpenCode 中快速启用 DeepSeek V4 模型

就在刚刚,DeepSeek V4 已经正式发布,但是如果你打开 OpenCode,会发现无论是已创建好的 DeepSeek 连接还是新建 DeepSeek 连接,都没有显示 V4 的模型,这是因为 OpenCode 还不支持默认加载最新模型(还在改 bug 呢)。

我们无法知道 OpenCode 这些 bug 要改到哪个猴年马月,但用下面的方法,可以让我们先快速集成 V4 模型进行体验使用。

建立连接

和原来的流程一样,打开 OpenCode,输入如下命令:

bash 复制代码
/connect

然后根据弹出的页面选择 DeepSeek,就会让你输入 DeepSeek 的 API Key 了。

这时我们只需要登录到 DeepSeek 的网站生成一个 API Key。

然后将它复制到 OpenCode 中,这时连接就建立好了,但是不出所料,它还只有 V3 的模型可用,还需要通过修改配置文件来让 OpenCode 加载 DeepSeek V4 模型。

修改 ~/.config/opencode/opencode.json(最新版本可能叫 opencode.jsonc),用 vim 或 VSCode 等编辑器打开文件,添加如下内容到 provider 下:

json 复制代码
"deepseek":{
  "npm": "@ai-sdk/anthropic",
  "name": "DeepSeek",
  "options": {
    "baseURL": "https://api.deepseek.com/anthropic"
  },
  "models": {
    "deepseek-v4-pro": {
      "name": "DeepSeek-V4-Pro",
      "limit": {
        "context": 1048576,
        "output": 262144
      },
      "options": {
        "thinking": {
          "type": "enabled",
          "budgetTokens": 8192
        }
      }
    },
    "deepseek-v4-flash": {
      "name": "DeepSeek-V4-Flash",
      "limit": {
        "context": 1048576,
        "output": 262144
      },
      "options": {
        "thinking": {
          "type": "enabled",
          "budgetTokens": 8192
        }
      }
    }
  }
}

最终你得到的 opencode.jsonc 配置结构如下:

json 复制代码
{
  "plugin": [...
  ], // 你接入的插件列表
  "$schema": "https://opencode.ai/config.json",
  "disabled_providers": [],
  "provider": {
    "aliyun": {...
    }, // 如果你接入了阿里云的coding plan
    "deepseek": {...
    } // 我们新增的deepseek接入配置
  }
}

重启你的 OpenCode,就可以启用 V4 模型啦!

相关推荐
宇擎智脑科技15 小时前
DeepSeek Harness 架构解析:MCP 和 Skill 如何被统一为 Cordis 插件
架构·deepseek·harness·dsh
csdn_aspnet17 小时前
开源人工智能编码代理列表
人工智能·continue·cline·goose·aider·opencode·openhands
子兮曰18 小时前
DeepSeek Harness 架构深潜:一个把 Agent 运行时做成纯插件树的开源 Harness
前端·后端·deepseek
ServBay18 小时前
DeepSeek Harness 实战:如何搭建完整的 AI Agent 本地开发环境
aigc·ai编程·deepseek
AC赳赳老秦20 小时前
OpenClaw 多源采集公开行业数据:从原始信息到研究报告初稿的自动化实践
java·c语言·c++·python·php·deepseek·openclaw
DS随心转APP21 小时前
生成word文档的ChatGPT格式乱码终结者:AI导出鸭横向测评与工程化架构解析 摘要
人工智能·ai·chatgpt·word·deepseek·ai导出鸭
ITKEY_21 小时前
DeepSeek Harness 预览版初体验
deepseek
Zach_菠萝侠1 天前
【DeepSeek Harness 研究】进化方向1:动态路由 思考、设计与实现
人工智能·深度学习·deepseek
spencer_tseng1 天前
Deepseek has increased its price 2026.08.17
ai·deepseek
正在走向自律1 天前
anywhere-labs/deepseek-harness-desktop 双模式界面设计:兼容性、原生材质与 Slot 组合
材质·deepseek·dshdesktop·web应用桌面·双模式方案·web产品