跳到正文

ymh0000123/dsh-client-masquerade

30最近提交 2026年8月16日

dsh-client-masquerade DSH 插件

本插件可为任意已配置的 llm-pi-ai provider 一键应用、清除或切换伪装头(Claude Code、Codex 或自定义)。提供设置页、模型工具 mask_client 以及 User-Agent 补丁,确保伪装能被按 User-Agent 识别的网关正确放行。界面中英双语,跟随 Harness 语言设置实时切换。

如何安装 dsh-client-masquerade DSH 插件

dsh plugin --profile web add github:ymh0000123/dsh-client-masquerade

复制不会执行命令。安装 dsh-client-masquerade DSH 插件前请核对仓库和版本。

dsh-client-masquerade DSH 插件数据来源

dsh-client-masquerade DSH 插件快照日期:2026年8月16日

discovered

dsh-client-masquerade DSH 插件能做什么

  • 一键应用/清除/切换伪装预设:Claude Code、Codex 或自定义请求头。
  • 将伪造的客户端身份头写入 provider 配置的 headers 字段,随每次请求真实发送。
  • 三个入口:设置页、模型工具 mask_client(list/on/off/test)、动态模式下的 Run 卡片面板。
  • 中英双语界面,跟随 Harness 语言设置实时切换。
  • test 动作发起一次真实流式调用,报告网关实际收到的请求头与模型输出或报错。

dsh-client-masquerade DSH 插件适合哪些场景

  • 绕过根据 User-Agent 进行路由或放行的网关(如 agentrouter、claude-code-router)。
  • 在不同客户端身份间快速切换,测试 provider 在不同网关下的表现。
  • 调试需要特定客户端头才能认证的无界面的场景。
  • 将自定义模型集成到期望 Claude Code 或 Codex 客户端头的流程中。

dsh-client-masquerade DSH 插件适合谁

  • 使用 DeepSeek Harness 且需要访问按客户端身份过滤的网关的开发者。
  • 希望在不同客户端头条件下测试自定义 llm-pi-ai provider 的高级用户。

dsh-client-masquerade DSH 插件的限制

  • 仅作用于 llm-pi-ai 自定义 provider;内置 deepseek-official 适配器没有请求头钩子。
  • 需要应用 User-Agent 补丁,否则 user-agent 头会被归属机制覆盖。
  • 伪装头会持久化写入设置文档;停用插件不会自动撤销。
  • 卸载后需手动还原 User-Agent 补丁并清除残留的 headers 设置。

dsh-client-masquerade DSH 插件的仓库 README 摘录

以下文字摘自 dsh-client-masquerade DSH 插件的上游仓库 ymh0000123/dsh-client-masquerade 的 README,版权归原作者,仅作引用。

**DeepSeek Harness 插件:让自定义模型伪装成 Claude Code / Codex 客户端** **A DeepSeek Harness plugin: make a custom model masquerade as a Claude Code / Codex client.** 一些网关(如 agentrouter、claude-code-router 类代理)按请求头识别客户端并据此路由或放行。本插件把伪造的客户端身份头写入你的 `llm-pi-ai` provider 配置,随每次请求真实发到上游网关——一键开启/关闭/切换,带中英文设置页。 --- ## 安装 / Install ### 方式一:官方命令安装(推荐) ```bash dsh plugin --profile web add github:ymh0000123/dsh-client-masquerade ``` 这条命令会在 profile 目录里执行 `pnpm add github:ymh0000123/dsh-client-masquerade`,然后自动把包(其 `dsh.bundle.patch` 声明)并入该 profile 的插件层栈——**不需要手动改任何配置文件**。 **然后应用 User-Agent 补丁(必做)**——否则伪装头里的 `user-agent` 会被 pi-ai 适配器的归属机制剥掉并覆盖为 `deepseek-harness/...`,按 User-Agent 识别客户端的网关(agentrouter、claude-code-router 类)会拒绝请求(**401 UNAUTHENTICATED**)。在你的 profile 目录(含 `node_modules` 的那个)执行: ```bash node node_modules/dsh-client-masquerade/patches/apply-pi-ai-useragent-patch.mjs ``` > 注意:`node_modules` 是相对路径,请先在 profile 目录(含 `node_modules` 的那个)里执行。不记得目录或不在该目录时,直接用**绝对路径**调用脚本即可,脚本会自动定位本 profile 里安装的 `dsh-llm-pi-ai`: > > ```bash > node "C:\Users\你的用户名\.dsh\profiles\web\node_modules\dsh-client-masquerade\patches\apply-pi-ai-useragent-patch.mjs" > ``` 补丁幂等,可重复执行;`pnpm install` 或升级 `dsh-llm-pi-ai` 后需重新应用一次。

阅读完整 README仓库许可: MIT

dsh-client-masquerade DSH 插件常见问题

如何安装伪装插件?

在终端执行 `dsh plugin --profile web add github:ymh0000123/dsh-client-masquerade`。这会安装包并自动注册到 profile 的插件栈。之后必须应用 User-Agent 补丁(见下一条),然后重启 `dsh web`。

使用伪装时为什么出现 401 UNAUTHENTICATED?

通常是因为没有应用 User-Agent 补丁。原生 `dsh-llm-pi-ai` 适配器会剥离并覆盖 `user-agent` 头。通过设置页或运行 `node node_modules/dsh-client-masquerade/patches/apply-pi-ai-useragent-patch.mjs` 应用补丁(在 profile 目录内),然后重启 `dsh web` 即可。

如何在 Claude Code 和 Codex 伪装之间切换?

进入设置 → 客户端伪装(Client Masquerade)。选择要配置的 provider,然后点击 'Claude Code' 或 'Codex' 按钮。标题会立即写入。也可以使用模型工具:`mask_client action=on provider=<id> preset=codex`。

如何卸载插件并清理残留数据?

执行 `dsh plugin --profile web remove dsh-client-masquerade`。卸载后有两处残留:User-Agent 补丁(需用 `--revert` 还原)和写入 provider 的伪装头(需手动设为 'Off' 或清除 `headers` 字段)。

除了两个预设,我能使用自定义头吗?

可以。使用 `custom` 预设,或在 `mask_client` 工具中传入 `headersJson` 参数。例如:`mask_client action=on provider=my-provider preset=custom headersJson={"originator":"codex-tui"}`。自定义头会与现有头合并。