Sign in to an xAI Grok subscription with device-code OAuth, refresh the access token, and use it as the xai route credential without an API key.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-xai-oauth
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:tonylee2022/dsh-xai-oauth
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
Native xAI(Grok / X 订阅)OAuth 登录插件 for DeepSeek Harness。
用 SuperGrok 或 X Premium 订阅登录 xAI,不需要 API key。插件完成 xAI
设备码(RFC 8628 device-code)授权,把 access token 注入 DSH 凭据
(XAI_OAUTH_TOKEN),并在 token 接近过期时用 refresh token 自动续期,
让 llm-pi-ai 的 xai provider 路由每次请求都能拿到有效令牌。
安装
从 npm 安装(推荐):
dsh plugin --profile web add dsh-xai-oauth
或从 GitHub 安装:
dsh plugin --profile web add github:tonylee2022/dsh-xai-oauth
本地源码安装(开发调试用):
dsh plugin --profile web add ./dsh-xai-oauth
然后重启 web profile(dsh --profile web)。重启后在 设置 → 模型提供方
旁会出现 xAI(Grok/X) 设置页:点击“登录 xAI”→ 复制用户码 →
点“打开授权页”在 xAI 官方页面登录并批准 → 自动完成授权。
兼容性
dsh web/ 普通浏览器:页面 origin 是http://127.0.0.1:<port>。- DSH Desktop 0.2.1 起:Web UI 从特权 scheme
dsh-app://app加载,页面 fetch 本机控制服务时带的是这个 origin。0.1.5 起接受该 origin; 更早的版本会因 CORS 预检被拒而在登录时显示 “Failed to fetch”。
原理
- 插件向
https://auth.x.ai/oauth2/device/code申请设备码(客户端 id 与 scope 与 xAI CLI / pi-ai 一致,scope 含grok-cli:access api:access)。 - 轮询
https://auth.x.ai/oauth2/token直到用户批准,得到 access token + refresh token,原子写入$DSH_HOME/xai-oauth.json(0600 / 0700)。 - 通过
ctx.credentials把当前 access token 写入XAI_OAUTH_TOKEN; bundle patch 给llm-pi-ai的xai路由配置apiKeyEnv: XAI_OAUTH_TOKEN,每次请求解析最新值。 - 每 60 秒检查一次,距过期不足 5 分钟时用 refresh token 续期并重新写入。
配置(可选)
- id: xai-oauth
config:
path: /secure/path/xai-oauth.json # 默认 $DSH_HOME/xai-oauth.json
controlPort: 1457 # 本机状态服务端口
安全边界
- 令牌只保存在 Host 侧文件(owner-only 权限);Web 页面不接触令牌。
- 本机控制服务只监听
127.0.0.1:1457,仅接受本地 DSH Web origin (http://127.0.0.1:*、http://localhost:*、http://[::1]:*,以及 DSH Desktop 的dsh-app://app);登出请求带 CSRF token。 - access token 等效于该订阅的 API 凭据,请勿外泄。
License
MIT
Links
More in this category
Ebony-Vinyl/dsh-our-free-model★ 65496
Adds free model lanes to DeepSeek Harness — DeepSeek V4.1 Flash, Kimi K3 and others — with no login, sign-up or API key, plus a local OpenAI-compatible gateway, fallback routing and a usage dashboard.
dingminhua/dsh-connect-workbuddy★ 1299
Connects locally signed-in WorkBuddy models, CN and international alike, to DSH, reading each model's credit multiplier from the upstream catalog on every refresh, with per-model image input toggles, account switching backed by an auto-failing-over pool, manual daily check-in, and read-only credit overviews shown as compact pills on the card and in the composer.
Alice-Marx/dsh-model-router★ 893
Routes DeepSeek Harness work across configured model APIs and supported vendor CLIs with dependency-aware packages and cost previews.
V1ki/dsh-plugin-subscriptions★ 573
Use ChatGPT (Codex), Claude, and Grok subscriptions as DeepSeek Harness LLM providers, with Settings login, model catalogs, usage, plus image_generate, video_generate, and x_search tools.
Mars-Sea/dsh-commandcode-provider★ 463
Unofficial Command Code LLM provider: registers a `commandcode` route with a live model catalog and reasoning-effort support.
XDTrees/dsh-workbuddy-xdpool★ 460
Merge every locally signed-in WorkBuddy account into DeepSeek Harness as one auto-failing-over model pool (multi-account rotation, live credits, and a model catalog showing per-model credit multipliers and free/night-discount tags).
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.