wang-kaopu/dsh-oauth
Use ChatGPT (Codex) and Gemini Code Assist subscriptions as DeepSeek Harness LLM providers — OAuth login in the web UI, no API keys
项目介绍Project Overview
DSH OAuth Bridge 是 DeepSeek Harness 插件,通过浏览器 OAuth 将 ChatGPT Codex 与 Gemini Code Assist 订阅接入 DSH,无需手动配置 API Key;登录后动态挂载 provider,退出或凭据失效自动撤销,并在 Web 设置页管理登录。适合想用订阅账号调用对应模型的场景。注意:仅支持单账号,Gemini 需自备 Google OAuth client。
DSH OAuth Bridge is a DeepSeek Harness plugin that connects ChatGPT Codex and Gemini Code Assist subscriptions through browser OAuth, without manual API keys. It dynamically registers providers after login, revokes them on logout or invalid credentials, and provides login controls in the DSH Web settings page. Use it when accessing models via existing subscriptions. Caveat: only one account is supported, and Gemini requires a Google OAuth client.
请帮我了解并安装插件:【dsh-oauth】【https://github.com/wang-kaopu/dsh-oauth】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
npx @deepseek-ai/dsh plugin --profile web add @kelvinwww/dsh-oauth
把 wang-kaopu/dsh-oauth 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
DSH OAuth Bridge
DSH OAuth Bridge 是一个 DeepSeek Harness 插件,通过浏览器 OAuth 将 ChatGPT Codex 与 Gemini Code Assist 订阅接入 DSH,无需手动配置对应模型的 API Key。
登录成功后,插件会根据认证状态动态挂载对应 provider;退出登录或凭据失效后,对应 provider 会自动撤销。
Features
- ChatGPT Codex OAuth:使用 ChatGPT 订阅访问 Codex 模型。
- Gemini Code Assist OAuth:通过 Google OAuth 接入 Gemini Code Assist。
- DSH Web UI 登录:在 DSH 设置页中完成登录、状态查看与退出登录。
- 动态 Provider Route:仅在对应账号已认证时向 DSH 暴露 provider。
- Gemini 动态模型目录:通过 Code Assist
retrieveUserQuota获取可用模型,并缓存最近一次成功结果。 - 安全凭据存储:OAuth 凭据保存到
$DSH_HOME/oauth-bridge.json,文件权限为0600。 - 本地 OAuth Control Server:默认仅监听
127.0.0.1:1456,并限制非 loopback Origin。
Providers
| Provider | Route | Subscription / Account | Authentication |
|---|---|---|---|
| Codex | openai-codex |
ChatGPT subscription | ChatGPT OAuth |
| Gemini | gemini-cli-oauth |
Gemini Code Assist | Google OAuth |
只有登录成功的 provider 才会出现在 DSH 中。
Install
项目已发布到 npm:
npx @deepseek-ai/dsh plugin --profile web add @kelvinwww/dsh-oauth
安装完成后重新启动 dsh web,使插件加载到 Web profile。
Use
启动 DSH Web:
dsh web打开浏览器中的 DSH 页面。
进入设置页中的 OAuth Providers / OAuth 登录。
根据需要选择:
- Login with ChatGPT:连接 ChatGPT Codex。
- Login with Google:连接 Gemini Code Assist。
OAuth 成功后,对应 provider 会自动注册到 DSH。
退出登录后,插件会撤销对应 provider route。
Configuration
插件支持以下配置:
| Option | Description | Default |
|---|---|---|
dshHome |
自定义 DSH Home 路径 | DSH 默认目录 |
controlPort |
本地 OAuth control server 端口 | 1456 |
codexRedirectPort |
Codex OAuth redirect 端口 | 插件默认值 |
Gemini OAuth credentials
使用 Gemini 前,需要提供 Google installed-app OAuth client:
export GEMINI_CLIENT_ID="..."
export GEMINI_CLIENT_SECRET="..."
对于非 FREE tier,还需要指定 Google Cloud Project:
export GOOGLE_CLOUD_PROJECT="your-project-id"
也可以使用:
export GOOGLE_CLOUD_PROJECT_ID="your-project-id"
Authentication behavior
Codex
Codex 登录状态会同步到 DSH 的 openai-codex provider route。
插件只会移除由自身创建并持有 ownership 标记的 Codex route,不会覆盖或删除用户自行配置的同名 route。
Gemini
Gemini 使用独立的 gemini-cli-oauth Adapter。
登录成功后注册 Adapter;登出或确认 OAuth 凭据失效时撤销 Adapter。
Gemini 模型目录来自 Code Assist retrieveUserQuota,结果缓存 5 分钟。如果远端暂时失败或返回空目录,会优先复用最近一次成功获取的模型列表。
明确的 HTTP 401 或 OAuth invalid_grant 会被视为凭据已失效,此时插件会清理凭据并撤销对应 provider;临时网络或刷新错误不会立即清除登录状态。
Security
OAuth token 与 Codex route ownership 元数据保存在:
$DSH_HOME/oauth-bridge.json
存储文件权限为:
0600
OAuth control server 默认监听:
127.0.0.1:1456
Control API 仅允许 loopback 来源,包括:
localhost127.0.0.1::1
Limitations
当前版本:
- 仅支持单账号。
- Gemini OAuth callback 使用操作系统动态分配的端口。
- 暂不支持 reasoning effort。
- 暂不提供订阅额度展示。
- 暂不支持代理配置。
- 暂不支持 Web Search。
- 暂不支持图像生成。
- 暂不调用 token revoke endpoint。
Develop
Requirements
Node.js:
^22.19.0 || >=24.11.0
Install dependencies
npm install
Build
npm run build
Type check
npm run check
Test
npm test
Build browser bundle only
npm run bundle
Watch browser bundle
npm run watch:client
Project Layout
src/
├── index.ts # 插件入口、本地 control server、生命周期管理
├── routes.ts # Codex / Gemini provider route 动态注册
├── codex.ts # ChatGPT Codex OAuth 与服务逻辑
├── gemini.ts # Gemini Code Assist OAuth、Adapter 与模型目录
├── storage.ts # OAuth 凭据与 route ownership 持久化
├── client.tsx # DSH Web 设置页 OAuth UI
└── client-locales.ts # OAuth UI 中英文文案
Package
npm package:
@kelvinwww/dsh-oauth
插件入口同时导出 Gemini Adapter、Codex/Gemini service factory 与 storage API,便于测试和二次集成。
nexu-io/open-design
freestylefly/awesome-gpt-image-2
anywhere-labs/dsh-desktop
walkinglabs/learn-harness-engineering
awesome-dsh-plugin/awesome-dsh-plugin
MemTensor/MemOS