yequ172672/dsh-codex-subscription
dsh-llm-codex
DSH plugin: reuse your Codex CLI local subscription login to use ChatGPT subscription models in DeepSeek Harness, no API key required
Install
npx @deepseek-ai/dsh plugin --profile web add dsh-session-import-codexRestart `dsh web` after install. Bundle APIs can change during the developer preview.
README badge
[](https://dshhub.dev/plugins/yequ172672-dsh-codex-subscription)Paste this into your README. The star count updates with every catalog sync.
From the README
Excerpt from yequ172672/dsh-codex-subscription, cleaned of badges and images.
dsh-llm-codex
📦 已发布到 npm:dsh-llm-codex(当前仓库版本 0.2.0) · 📚 GitHub:yequ172672/dsh-codex-subscription · 🏷️ 属于 dsh-plugin 插件话题
DSH(DeepSeek Harness)LLM 适配器插件:直接复用 Codex CLI 的本地登录凭证,在 DSH 中 使用 ChatGPT 订阅模型(gpt-6.1-sol 等),不需要 API Key。
这是一个标准的 dsh 插件包:包内 dsh.bundle.patch 声明使其成为 profile 层,
通过官方 dsh plugin 命令安装后自动激活,无需手工编辑任何 composition 文件。
版本兼容性
| 插件版本 | DSH 桌面端 | 宿主 dsh-llm | 配置模型 |
|---|---|---|---|
| 0.2.x | ≥ 44(0.2.0-rc.2) | 0.2.x | 导出 Config + 全字段 .volatile(),设置页自动生成 |
| 0.1.x | ≤ 43(0.1.0-rc.6) | 0.1.x | settings.yaml 的 llm-codex: 段 |
0.1.x 在 DSH ≥ 44 上会装载失败:宿主已删除 settings.register(设置服务重构为
表单投影),且 LlmRuntime 每次调用都会调用 0.1.x LlmAdapter 上不存在的
prepareCall。请使用 0.2.x。
Codex wire 版本:服务端按 version 头门控模型目录 —— 旧默认 0.144.1 只返回
旧目录且拒绝 gpt-6.1-sol(HTTP 400 "not supported … ChatGPT account");0.2.x 默认
已升到 0.160.1(2026-10 实测返回全量目录)。可用配置 clientVersion 覆盖。
搭配推荐:dsh-session-import-codex
配合 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
ℹ️
[email protected]起已正确声明全部依赖,直接安装即可。
原理
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 下一次请求自动生效。 - 令牌刷新:access_token 过期(HTTP 401)时用
refresh_token走auth.openai.com/oauth/token刷新并自动重试一次;刷新成功后默认原子写回 auth.json(writeBack: false可关闭),与 codex CLI 行为一致,两边凭证永远同步。 - 模型目录:优先实时拉取
GET {base}/codex/models,失败时回退~/.codex/models_cache.json,再回退内置静态列表。 - 协议:OpenAI Responses API(
stream: trueSSE),推理摘要、正文、工具调用分别映射为 DSH 的 reasoning / text / tool-call 块,usage 从response.completed提取。
目录结构
…

