ark-plan-api:把火山方舟 Ark 套餐接入 DSH 模型选择器

前言

DeepSeek Harness(DSH)可以在「设置 → 模型」里手填 provider,但火山方舟 Ark 的 Agent Plan、Coding Plan、后付费 API 各自对应不同的 Base URL、协议和模型 id,抄错一个字段就会连不上。下面介绍社区插件 ark-plan-api(维护者 BaChongYingovo,分类:模型推理):它通过 bundle 补丁预置五条 Ark provider 路由,装好后这些套餐会直接出现在 DSH 原生模型列表里,你只需填入对应套餐的 API Key。默认走 Anthropic Messages API(anthropic-messages),与 Ark plan / coding 端点一致。

这是什么

ark-plan-api 是 DSH 的一个 bundle 插件。它在 @deepseek-ai/dsh-llm-pi-ai 上通过 cordis.patch.yml 注册火山引擎 Ark 的五条 provider 路由(含国内与 BytePlus 海外),并可选提供 Web 侧「填 API Key」页。服务端 index.js 的 apply 为空函数,实际推理仍由 DSH 自带的 pi-ai 适配器发出;插件只贡献配置,不读凭据、不发请求。

已注册的 Provider 路由

装好后会出现五个 Provider ID,Key 需与套餐一致(混用会 401)。

Route(Provider ID) 定位 Base URL 协议
ark-agent-plan-cn Agent Plan https://ark.cn-beijing.volces.com/api/plan anthropic-messages
ark-coding-plan-cn Coding Plan https://ark.cn-beijing.volces.com/api/coding anthropic-messages
ark-coding-plan-byteplus Coding Plan 海外 https://ark.ap-southeast.bytepluses.com/api/coding anthropic-messages
ark-cn 后付费 API https://ark.cn-beijing.volces.com/api/v3/compatible anthropic-messages
ark-byteplus 后付费 API 海外 https://ark.ap-southeast.bytepluses.com/api/v3/compatible anthropic-messages

说明:Base URL 不含 /v1 后缀,由 Anthropic SDK 自行追加 /v1/messages。

各 route 预置了一批模型 id(如 doubao-seed-2.1-pro、deepseek-v4-pro 等),可在 cordis.patch.yml 里增删。doubao-seed-* 系列支持多模态输入 input: [text, image]。完整模型列表见仓库 README 表格。

安装与启用

插件需加入 profile 的 bundles 并重启 DSH 宿主;仅写在 dependencies 里不够。

从本地目录装入

在已有插件目录的前提下(例如放在 ~/dsh-plugins/ark-plan-api),执行:

dsh plugin --profile desktop add ~/dsh-plugins/ark-plan-api
dsh --profile desktop          # 重启 DSH

dsh plugin add 会把目录写入 profile 的 dependencies,并自动加入 bundles。

从 tarball 装入

在插件源码目录打包后安装:

npm pack                                  # 产出 ark-plan-api-0.1.0.tgz(示例文件名以实际为准)
dsh plugin --profile desktop add ./ark-plan-api-0.1.0.tgz

手动登记

编辑 $DSH_HOME/profiles/<profile>/package.json,在 dependencies 与 dsh.bundles 中加入 ark-plan-api,然后在 profile 目录执行 pnpm install 并重启。

检查是否装好

dsh --profile desktop --dump-config | grep -A2 llm-pi-ai     # 应看到 "patched by ark-plan-api"

卸载:

dsh plugin --profile desktop remove ark-plan-api

若使用 0.2.0 曾出现启动失败(client.js 未声明 remote),应升级到 0.2.1;README 说明了临时从 dsh.bundles 移除以救急的做法。

填写 API Key

凭据写入 DSH 凭据库($DSH_HOME/.credentials.yaml),与「设置 → 模型」手填等价。凭据名由 provider id 派生,例如 ark-agent-plan-cn → ARK_AGENT_PLAN_CN_API_KEY:

PROVIDER_ID.toUpperCase().replace(/[^A-Z0-9]+/g, '_') + '_API_KEY'

也可用同名环境变量;存储值优先于环境变量。

路径一(推荐):侧栏 插件 → 插件列表 → ark-plan-api 行尾 填 API Key。页面按五张卡片区分套餐,显示凭据名与「已配置 / 未配置」,不回显 Key;保存即时生效,无需重启(首次安装插件本身仍需重启以加载 client.js)。

路径二:设置 → 模型,选中对应 Ark route 粘贴 Key。若宿主未暴露凭据服务或没有 plugins.row.config 插槽,用此路径即可。

各套餐 Key 在火山方舟控制台申请(README 给出 Agent Plan、Coding Plan、后付费 API Key 的控制台链接)。

工作原理(简述)

  1. 在 cordis 中 insert 空载插件条目,满足插件列表与市场入口文件要求。
  2. 对 llm-pi-ai 行补丁写入 config.providers,作为设置的 base 层,与用户 settings.yaml 按 provider 逐键深合并;不会在深合并意义上覆盖你手加的同名 provider 的自定义字段。
  3. client.js 仅在浏览器侧注册「填 API Key」页,通过宿主 ctx.remote.credentials 读写凭据。

自定义

直接编辑仓库内 cordis.patch.yml 后重启 DSH。可改 displayName、apiKeyEnv、api、baseURL、models(id 可为方舟推理接入点 ep-xxxxxxxx),或复制整段 route 增地区/套餐。改完后可在插件目录运行 npm run check 做结构自检(README「开发与自检」一节)。

适用场景与注意

适合:已在火山方舟开通 Agent Plan、Coding Plan 或后付费 API,希望在 DSH 里用原生模型选择器切换 Doubao / DeepSeek 等预置模型,且不想逐个抄 Base URL 与模型表的用户。

注意:

  • 插件以当前 DSH 进程权限运行;安装前请自行查看源码与 MIT 许可证,社区目录(SkillHub)与 DeepSeek / 幻方无官方从属关系。
  • Key 必须对 route:Agent Plan 的 Key 不能用于 ark-cn 后付费 route。
  • 装完列表没有 Ark 时,核对 profile、bundles、重启宿主,并用 --dump-config 确认 patched by ark-plan-api。
  • 0.2.0 有启动兼容问题,请用 0.2.1。

结尾

ark-plan-api 把五条火山方舟 Ark 路由和模型表打进 DSH 的 pi-ai 配置底层,把「抄配置」收成「选 route、填 Key」。需要细节、变更记录与自检命令时,见 GitHub 仓库 与 SkillHub 目录页。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜