DeepSeek Harness 插件

dsh-llm-local-token

DeepSeek Harness plugin: serve LLM calls with the OAuth tokens your local Codex CLI and Claude Code already hold, instead of a separately configured API key.(英文原文)

跳到安装方式

来源信息

GitHub 仓库
tianxia--/dsh-llm-local-token
最近更新
2026年8月17日
分类
工具与能力
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/tianxia--/dsh-llm-local-token
插件名:dsh-llm-local-token
作者:tianxia--

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-llm-local-token

A DeepSeek Harness plugin that serves LLM calls with the OAuth tokens your local CLIs already hold — no separate API key, no extra login. If you are signed in to the Codex CLI or to Claude Code, those subscriptions become usable model routes inside DSH.

Provider routeCredential sourceEndpoint
openai-codex~/.codex/auth.json (ChatGPT OAuth, shared with the codex CLI)https://chatgpt.com/backend-api
anthropic~/.claude/.credentials.json, else the macOS Keychain item Claude Code-credentialshttps://api.anthropic.com

Both routes appear in the model picker as soon as the plugin loads. A route whose credential is missing is skipped instead of failing the boot.

<table> <tr> <td align="center" width="50%"><sub>Both subscriptions as routes in the model picker</sub><br><img src="https://raw.githubusercontent.com/tianxia--/dsh-llm-local-token/main/docs/model-routes.png" alt="The DSH model picker listing OpenAI Codex (local token) and Claude (local token) groups" width="330"></td> <td align="center" width="50%"><sub>Subscription usage, read from provider rate-limit headers</sub><br><img src="https://raw.githubusercontent.com/tianxia--/dsh-llm-local-token/main/docs/subscription-usage.png" alt="Subscription usage popover showing Claude and OpenAI Codex quota windows" width="400"></td> </tr> </table>

Why it exists

DSH resolves a provider's key through its credential seam, which expects an API key. Personal Codex / Claude subscriptions are OAuth-only, so the keys simply do not exist. This plugin resolves the token per request from the file the CLI maintains, refreshes it when it is close to expiry, and hands it to the pi-ai engine that DSH already ships.

Install

dsh plugin --profile web add dsh-llm-local-token

# or straight from git
dsh plugin --profile web add https://github.com/tianxia--/dsh-llm-local-token.git

Then restart dsh — that is the whole install. The package declares a profile bundle (dsh.bundle.patch → [cordis.patch.yml](cordis.patch.yml)), so DSH inserts the loader row for you; you do not have to hand-edit the profile's own cordis.patch.yml.

<details> <summary>Enabling it by hand instead</summary>

If you vendored the plugin, or you want to pin its config in your own patch layer, append the row yourself to ~/.dsh/profiles/web/cordis.patch.yml. Your profile's layer is applied after every bundle layer, so restating the id here also lets you override the bundle's defaults:

- insert:
    - id: llm-local-token
      name: dsh-llm-local-token

</details>

To make it the default model:

# ~/.dsh/settings.yaml
agent-default-model:
  provider: openai-codex
  model: gpt-5.6-terra
  reasoningEffort: medium

Configuration

All keys are optional; the defaults match a stock CLI install.

KeyDefaultMeaning
codexAuthPath$CODEX_HOME/auth.json, else ~/.codex/auth.jsonCodex credential file
claudeAuthPath~/.claude/.credentials.jsonLegacy Claude Code credential file
claudeKeychainServiceClaude Code-credentialsmacOS Keychain service holding the Claude OAuth payload
requireClaudefalseFail activation when no Claude credential is found, instead of skipping the route
codexTransport"sse"Streaming transport for the Codex route: sse / websocket / websocket-cached / auto. The quota badge depends on sse: pi-ai's default auto streams over WebSocket, and the x-codex-* quota headers exist only on the SSE response, so the badge stays empty under WS. Set auto to prefer WebSocket and accept no Codex quota data.

Subscription usage badge

Both providers return their quota state in response headers, so the plugin reads it for free — no polling, no extra endpoint hits. A badge appears in the composer bar next to the context ring; click it for the breakdown.

ProviderHeaders readShown
openai-codexx-codex-primary-*, x-codex-secondary-*, x-codex-plan-type, x-codex-credits-balanceplan, used % per window, reset countdown, credit balance
anthropicanthropic-ratelimit-unified-{5h,7d}-{utilization,reset,status}used % for the 5-hour and 7-day windows, reset countdown

The badge is green under 60%, amber under 85%, red above. Usage is whatever the last real request reported, so a freshly started host shows "no data yet" until you send one message. The browser half polls GET /llm-local-token/usage every 15s; that route only reads the in-memory snapshot.

The badge shows only the provider serving the currently selected model: pick Codex and you see Codex's windows, switch to Claude and it swaps — the two are never mixed into one number. When the selected model belongs to another adapter (a plain API key, another plugin) the badge hides itself, because that quota is not this plugin's to report. The popover still lists every route, with the active one first and marked "current" and the rest dimmed. The selection comes from ctx.modelDirectories; a composition without that service (non-Web) falls back to the previous union-of-all-routes view.

Requirements

  • Node.js 22.13+ (DSH's own floor; --use-system-ca needs it too)
  • dsh-base in the profile — it already provides @deepseek-ai/dsh-llm-pi-ai and @earendil-works/pi-ai
  • A signed-in CLI: codex login for the Codex route; Claude Code for the Anthropic route
  • The Claude Keychain lookup is macOS-only. On Linux/Windows only the file store is consulted.

Token handling

  • Read per request, never cached in memory beyond the call
  • Refreshed when less than 5 minutes of life remain, then written back to the same file the

CLI reads, so the CLI stays logged in (single-flight: concurrent requests trigger one refresh)

  • Written atomically with 0600 permissions
  • Never logged, never sent anywhere except the provider endpoint

Troubleshooting

UNABLE_TO_GET_ISSUER_CERT_LOCALLY

Your traffic goes through a TLS-inspecting proxy (Zscaler, Netskope, corporate MITM). Node does not trust its root CA even when the OS does. Start DSH with either:

node --use-system-ca …                          # trust the OS store (Node 22.13+)
NODE_EXTRA_CA_CERTS=/path/to/root-ca.pem dsh …  # or point at the proxy's root cert

Provider is not configured: openai-codex

Means the pi-ai provider refused an API-key override. This plugin already attaches an api-key auth method to the OAuth-only Codex provider; seeing this error again implies a pi-ai version whose resolveProviderAuth changed — open an issue with your @earendil-works/pi-ai version.

The model list shows no Codex/Claude entries

Check the boot log for llm-local-token: registered …. If it names only openai-codex, no Claude credential was found (expected when Claude Code was never used on this machine).

Caveats

  • Uses your personal subscription quota (ChatGPT Plus/Pro, Claude Pro/Max). Respect the

provider's terms; this is not a way to share one seat across a team.

  • chatgpt.com/backend-api is the Codex client's own endpoint, not a documented public API. It

can change without notice; pin the pi-ai version if you need stability.

License

MIT