mc-lhz/dsh-add-headers-to-completions
为dsh的ChatCompletions请求添加headers,可用于接入OpenCode的免费v4-flash、hy3等模型。
Project Overview项目介绍
This is a native plugin built exclusively for DeepSeek Harness that injects custom HTTP headers into LLM API requests. It supports adding headers at three levels: global, per provider, and per model, and uses a soft replacement design that lets its custom settings coexist with the official Models page without overwriting existing functionality. To install, you first need to clone or download the repository to your local machine, then run the install script with Node.js, which requires version 20 or newer. Before installing, you must have already launched DSH web once to generate the required directory structure.
After installing the plugin, you need to apply two required patches to the DeepSeek Harness source code. The first patch adds the plugin's settings namespace to the allowlist so it is visible in the UI, and the second patch enables overriding the default User-Agent header. You do not need to edit the source code manually; you can just copy the provided prompts and paste them into your AI coding assistant to apply the changes automatically. This plugin is ideal for DSH users who need to access custom LLM providers or route requests through proxies that require specific headers.
This plugin supports both UI-based configuration and direct YAML editing for advanced users, and includes a one-click uninstall script to remove the plugin easily. There are a few limitations to note: model-level header injection only works on the fetch layer and does not sync to provider channels, and only User-Agent can be overridden from the default attribution headers. If you upgrade DeepSeek Harness, the patches will be overwritten, so you will need to re-apply them after upgrading to keep the plugin working. If you inject special headers like content-length or host, you are responsible for ensuring their semantic correctness.
这是一个专为 DeepSeek Harness 开发的原生插件,核心功能是向大模型 API 请求注入自定义 HTTP 请求头,例如 User-Agent、x-company 等自定义头,支持全局、按提供商、按模型三个层级的注入规则。插件采用软替换设计,新增的设置区块可以和官方模型设置页面共存,不会影响原有功能使用。安装要求 Node.js 版本不低于 20,且目标机器已成功启动过一次 DSH web 端生成对应目录。
用户安装后需要对 DSH 源码打两个必需补丁,一个是开放插件设置命名空间可见性,另一个放开 User-Agent 自定义覆盖,补丁可以直接让 AI 编码助手完成修改,无需手动操作。配置完成后,设置界面会新增「请求头」区块,支持三层可视化编辑,配置变更会自动同步到对应的 API 通道,改动实时生效。适合需要自定义请求头接入特殊模型或代理服务的 DSH 用户使用。
插件支持 YAML 直写配置,适配高级用户需求,卸载也提供了一键脚本,操作便捷。当前存在一些限制:按模型层级的注入仅在 fetch 层生效,不参与通道同步;除 User-Agent 外,其他 attribution 保留头仍不可覆盖;注入特殊头需要用户自行保证语义正确。升级 DSH 后需要重新打补丁,用户需要注意这一点。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-add-headers-to-completions(mc-lhz/dsh-add-headers-to-completions)
仓库:https://github.com/mc-lhz/dsh-add-headers-to-completions
本站详情页:https://www.yhbd.top/plugins/mc-lhz-dsh-add-headers-to-completions/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证未声明 · ⭐ 3 · 最近提交 2026-08-16 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
- Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add github:mc-lhz/dsh-add-headers-to-completions
把 mc-lhz/dsh-add-headers-to-completions 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-llm-headers
给 DeepSeek Harness 的模型请求注入自定义 HTTP 请求头的 bundle 插件(软替换:独立设置区块,与官方 Models 页共存)。
它能做什么
- 向大模型请求注入自定义 HTTP 请求头,如 User-Agent、x-company、x-model-trace 等
- 支持全局、按 provider、按模型注入
安装
前置:Node ≥ 20(install.mjs 无需 pnpm;dsh plugin 方式需要 pnpm)。目标机的
%DSH_HOME%\profiles\web 需已存在(先成功启动过一次 dsh web)。
1.克隆仓库/下载ZIP包
git clone https://github.com/mc-lhz/dsh-add-headers-to-completions.git
cd dsh-add-headers-to-completions
2.安装
node ./install.mjs
3.重启 dsh web(浏览器硬刷新 Ctrl+F5 加载新客户端)
dsh web
若
dsh命令未全局安装,用你平时的启动方式(如 harness 源码目录下的node --import tsx/esm apps/cli/src/bin.ts --profile web)。
harness 补丁(必需,本地改动,升级 harness 后需重打)
为什么必需:补丁1(设置命名空间可见):设置命名空间默认对插件不可见;补丁2:user-agent 是 harness attribution 的保留名(适配器会过滤部署 UA 再补 deepseek-harness/...)。这两个行为必须改源码。
不用手动改——复制下面两段提示词,分别粘贴给DeepSeek Harness或其他 AI 编码助手,它会在你的 harness 源码目录完成修改;提示词已带幂等与校验。
目标目录:harness 源码根目录(packages/... 所在层)。
【dsh-llm-headers 补丁 1/2 · 设置命名空间白名单】
目标文件:harness 源码根目录/packages/host/apiproxy/src/api-proxy.ts
请在该文件中做一处小修改(只改这一处,不得改动文件其它任何内容):
把:
const WEB_SETTINGS_NAMESPACES = [
'agent-loop', 'shell', 'locale', 'permission', 'ui-conversation', 'ui-theme', 'web-search-deepseek',
] as const
替换为:
const WEB_SETTINGS_NAMESPACES = [
'agent-loop', 'shell', 'locale', 'permission', 'ui-conversation', 'ui-theme', 'web-search-deepseek',
// dsh-llm-headers: user-installed plugin's own settings section (soft
// replacement, coexists with the official Models page). The namespace is
// registered by the plugin; this allowlist is the exposure gate for the
// settings configuration clients.
'dsh-llm-headers',
] as const
规则:若文件里已存在行 'dsh-llm-headers',(含注释)则说明已打过,直接报告“已打过,跳过”并结束;
替换前先确认锚文本完全匹配(含缩进);完成后显示被替换位置的上下文供核对。
背景:缺它时,插件设置的 dsh-llm-headers 命名空间对设置页/GUI 不可见(回答 settings-not-exposed)。
【dsh-llm-headers 补丁 2/2 · 放开 user-agent 覆盖】
目标文件:harness 源码根目录/packages/llm/llm-pi-ai/src/adapter.ts
请把 requestHeaders 函数整体替换(函数签名保持不变):
原函数:
function requestHeaders(headers: Readonly<Record<string, string>> | undefined): Record<string, string> {
const deployment = headers ?? {}
const attribution = attributionHeaders()
const reserved = new Set(Object.keys(attribution).map(name => name.toLowerCase()))
const kept = Object.fromEntries(
Object.entries(deployment).filter(([name]) => !reserved.has(name.toLowerCase())),
)
return { ...kept, ...attribution }
}
替换为:
function requestHeaders(headers: Readonly<Record<string, string>> | undefined): Record<string, string> {
const deployment = headers ?? {}
const attribution = attributionHeaders()
const reserved = new Set(Object.keys(attribution).map(name => name.toLowerCase()))
// 本地增强(dsh-llm-headers):部署显式配置的 user-agent 允许胜出 ——
// 这是本 build 唯一允许部署覆盖的 attribution 名;其余保留名仍以
// Harness attribution 为准(过滤部署同名头、attribution 最后合并)。
const deploymentHasUserAgent = Object.keys(deployment).some(name => name.toLowerCase() === 'user-agent')
const kept = Object.fromEntries(
Object.entries(deployment).filter(([name]) => {
const lower = name.toLowerCase()
return !reserved.has(lower) || lower === 'user-agent'
}),
)
const keptAttribution = Object.fromEntries(
Object.entries(attribution).filter(([name]) => {
const lower = name.toLowerCase()
return lower !== 'user-agent' || !deploymentHasUserAgent
}),
)
return { ...kept, ...keptAttribution }
}
规则:若文件里已存在注释行“本地增强(dsh-llm-headers)”则说明已打过,直接报告“已打过,跳过”并结束;
替换前先确认原函数文本完全匹配;完成后显示新函数头几行供核对。
背景:缺它时,部署在 llm-pi-ai.providers.*.headers 里配置的 User-Agent 会被过滤,
请求最终带上 deepseek-harness/<版本> 的 UA;打过之后显式配置的 UA 才能胜出。
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
yannicksong0106/dsh-550c-boot
omdsh-dev/dsh-advisor
shuguang1994/project-blueprint
SummerSec/AI-Inner-Os
wlj521/dsh-ui-tweaks
PelyDeng/dsh-plugin-manager
codeAnqiang-ma/dsh-superpowers