
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
dsh-llm-codex
Advanced tools
DSH LLM 适配器插件:复用 Codex CLI 本地登录凭证(~/.codex/auth.json)在 DSH 中直接使用 ChatGPT 订阅模型
📦 已发布到 npm:dsh-llm-codex@0.1.1 · 📚 GitHub:yequ172672/dsh-codex-subscription · 🏷️ 属于 dsh-plugin 插件话题
DSH(DeepSeek Harness)LLM 适配器插件:直接复用 Codex CLI 的本地登录凭证,在 DSH 中 使用 ChatGPT 订阅模型(gpt-5.6-sol 等),不需要 API Key。
这是一个标准的 dsh 插件包:包内 dsh.bundle.patch 声明使其成为 profile 层,
通过官方 dsh plugin 命令安装后自动激活,无需手工编辑任何 composition 文件。
配合 dsh-session-import-codex 使用
效果更佳:它把 Codex 的历史会话导入 DSH(会话 id 形如 codex-<thread-id>),与本插件的
"凭证/模型复用"互补 —— 在 DSH 里既能用 Codex 订阅模型对话,又能无缝续聊 Codex 里
开过的对话,实现"模型 + 历史"全链路打通。
dsh plugin --profile web add dsh-session-import-codex
# 迁移(离线流程:先停止 dsh web 进程 → dry-run → 正式导入 → 重启 dsh)
pnpm --dir "$env:USERPROFILE\.dsh\profiles\web" exec dsh-import-codex --profile web --dry-run
pnpm --dir "$env:USERPROFILE\.dsh\profiles\web" exec dsh-import-codex --profile web
ℹ️
dsh-session-import-codex@0.1.1起已正确声明全部依赖,直接安装即可。
Codex CLI(codex login)会把 ChatGPT 订阅的 OAuth 令牌写入 ~/.codex/auth.json(或
CODEX_HOME)。本插件与 codex CLI 同源读取该文件,并参照两个成熟实现
(参考实现:你的 oh-my-pi-cn 与
opencodex)的 wire 细节:
| 凭证形态 | 端点 | 认证 |
|---|---|---|
tokens(auth_mode: chatgpt,订阅) | https://chatgpt.com/backend-api/codex/responses | Authorization: Bearer <access_token> + chatgpt-account-id + OpenAI-Beta: responses=experimental + originator: pi + version |
OPENAI_API_KEY(auth_mode: apikey) | https://api.openai.com/v1/responses | Authorization: Bearer <api_key> |
auth.json,CLI 登录/换号/登出,DSH 下一次请求自动生效。refresh_token 走
auth.openai.com/oauth/token 刷新并自动重试一次;刷新成功后默认原子写回
auth.json(writeBack: false 可关闭),与 codex CLI 行为一致,两边凭证永远同步。GET {base}/codex/models,失败时回退
~/.codex/models_cache.json,再回退内置静态列表。stream: true SSE),推理摘要、正文、工具调用分别映射为
DSH 的 reasoning / text / tool-call 块,usage 从 response.completed 提取。lib/
index.js 插件入口(注册 provider "codex" + 可配置 provider 目录 + 设置段)
adapter.js CodexAdapter:fetch + SSE → StreamChunk(仿 dsh-llm-deepseek)
auth.js auth.json 读取 / 订阅令牌刷新 / 原子写回
serialize.js harness 消息 → Responses API 请求体
translate.js Responses SSE 事件 → StreamChunk
sse.js SSE 字节流解析(Responses 协议无 [DONE])
models.js 模型目录:实时发现 → models_cache.json → 静态兜底
transport.js 可选 HTTP CONNECT 代理(https-proxy-agent + node-fetch)
constants.js wire 常量(端点/头/上下文窗口)
cordis.bundle.yml dsh.bundle 声明的 profile 层(插件行;安装后自动挂载)
test/serialize.mjs 请求序列化单元测试
test/smoke.mjs 端到端冒烟测试(只读,绝不写 auth.json)
npm install -g @deepseek-ai/dsh
dsh --version # 确认命令可用
若提示
无法将"dsh"项识别为 cmdlet…/dsh: command not found, 说明 dsh 尚未安装或不在 PATH,与插件无关。
dsh plugin 会转发给它;缺失时 CLI 会提示)。codex login(插件直接复用其凭证,无需 API Key)。安装已发布的包:
dsh plugin --profile web add dsh-llm-codex
本地开发直接加路径(pnpm 会以 link: 链接,改动即时生效):
dsh plugin --profile web add D:\CODE\dsh\dsh-llm-codex
dsh plugin 做了什么:在 profile 目录里执行 pnpm add <spec>,然后把安装结果与
dsh.profile.bundles 层栈自动 reconcile —— 任何声明了 dsh.bundle.patch 的依赖
自动成为 profile 层,update 时新版本获得 bundle 声明也会自动激活,remove 后自动
移除。无需手工编辑 cordis.patch.yml。
💡 版本范围建议:请用不带版本号的方式安装(
add dsh-llm-codex),pnpm 会保存^x.y.z范围,之后的dsh plugin update能自动收取更新。若 profile 里依赖被写成 精确版本(例如"dsh-llm-codex": "0.1.0",常见于从本地link:依赖切换或显式指定 版本号的情况),update会显示 "Already up to date" 而不会升级;重新执行一次不带 版本号的add即可回到范围跟踪。另外,刚发布的新版本可能触发 pnpm 的minimumReleaseAge供应链策略(写入 pnpm-workspace.yaml 的排除清单或短暂提示), 属正常现象。
验证组合结果(不启动服务):
dsh --profile web --dump-config # 应看到 "# == dsh-llm-codex" 与 llm-codex 行
重启 dsh 后,Web 模型选择器出现 Codex (ChatGPT 订阅) provider,插件清单页
(设置 → 插件)也会列出 llm-codex 条目。
ChatGPT 后端通常需要走本地代理;Node 原生 fetch 不读系统代理,在
$DSH_HOME/settings.yaml 配置:
llm-codex:
proxy: http://127.0.0.1:7890
也可用环境变量 HTTPS_PROXY(优先级:显式 proxy 配置 > HTTPS_PROXY >
HTTP_PROXY;NO_PROXY 命中的主机直连)。其他可选字段:clientVersion(默认
0.144.1)、writeBack(默认 true)、authFile、modelsCacheFile、
staticModels(显式模型目录)。设置段热更新,无需重启。
选用 codex 作为默认模型(settings.yaml):
agent-default-model:
provider: codex
model: gpt-5.6-sol
reasoningEffort: medium
dsh 的"插件库"即 npm registry:dsh.bundle.patch 声明就是插件身份。
npm login
npm publish # 仓库目录内执行
# 任何机器上:
dsh plugin --profile web add dsh-llm-codex
dsh plugin --profile web update # 升级所有 profile 插件
dsh plugin --profile web remove dsh-llm-codex # 移除
发布前检查:files 字段含 lib 与 cordis.bundle.yml;dsh.bundle.patch 指向的
patch 文件只含插件行,不含任何机器相关的配置。
npm test # 无凭证单元测试
npm run test:smoke # 文本对话(默认模型 gpt-5.6-sol)
npm run test:smoke -- gpt-5.5 # 指定模型
npm run test:smoke -- gpt-5.6-sol --tools # 额外验证工具调用路径
冒烟测试输出凭证形态、模型目录(实时拉取)、一次真实流式对话的结果与 usage。
测试默认只读(writeBack: false),绝不改写 auth.json;需要走代理时设置
HTTPS_PROXY(如 http://127.0.0.1:7890)。
| 现象 | 处理 |
|---|---|
MISSING_CREDENTIAL:无法读取 Codex 凭证文件 | 先运行 codex login 登录 |
TRANSPORT:Connect Timeout | 本机直连 ChatGPT 后端被墙;配置 proxy(见上文) |
| HTTP 401 且刷新失败 | 订阅过期或被风控;运行 codex login 重新登录 |
| HTTP 429 | 订阅额度/限流,稍后重试 |
INVALID_REQUEST:System messages are not allowed | 系统提示已自动改走 instructions 字段,不应出现;如出现请升级插件 |
INVALID_REQUEST:Unsupported parameter | 订阅后端拒绝 max_output_tokens/temperature/stop,适配器已自动剥离;如仍出现请升级插件 |
| 模型列表为空 | 实时发现失败且本地无 models_cache.json 时使用内置静态列表 |
~/.codex/auth.json,与 codex CLI 行为一致;如不希望
写回,设置 writeBack: false(届时过期令牌只在内存中刷新,重启 dsh 后重新刷新)。UNSUPPORTED_CONTENT 拒绝。FAQs
DSH LLM 适配器插件:复用 Codex CLI 本地登录凭证(~/.codex/auth.json)在 DSH 中直接使用 ChatGPT 订阅模型
The npm package dsh-llm-codex receives a total of 23 weekly downloads. As such, dsh-llm-codex popularity was classified as not popular.
We found that dsh-llm-codex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.