dsh-plugin-subscriptions README

The project's README from github.com/V1ki/dsh-plugin-subscriptions. As one markdown file: README.md.

dsh-plugin-subscriptions Awesome DSH Plugin

English | 中文

Use your ChatGPT (Codex), Claude, Grok (X Premium), and GitHub Copilot subscriptions as LLM providers in DeepSeek Harness — no API keys. Codex and Grok log in via OAuth in the dsh web UI (Settings → Subscriptions), while Copilot uses the GitHub OAuth device flow; Claude imports credentials from an existing Claude Code session when there is one (macOS Keychain or ~/.claude/.credentials.json) and otherwise falls back to the same browser OAuth flow, so the Claude Code CLI is not required. Tokens live at ~/.dsh/plugins/subscriptions/auth.json (mode 0600) and refresh automatically.

Demo

Settings → Subscriptions: per-provider login/logout, no API keys. Claude imports credentials from Claude Code when available and otherwise uses OAuth, as Codex and Grok always do (settings screenshots use demo accounts and catalog data):

Subscriptions settings page

Configure visibility, default reasoning effort, and context together in Edit model list, with shared Save and Cancel actions:

Model settings

Configure image generation, video generation, and X search per provider. Tool switches apply only to sessions created after saving:

Provider tools

Logged-in providers join the session model picker with their live model catalogs:

Model picker with subscription models

Models that advertise reasoning levels get an Effort selector in the same menu — Codex models, Grok 4.6 / 4.5, and Copilot's reasoning models (levels and defaults come from each provider's live catalog, not a hardcoded list; Copilot's capabilities.supports.reasoning_effort array is sent as reasoning_effort on chat completions and reasoning.effort on the Responses wire). Models listing both Copilot endpoints (gpt-5.4, gpt-5-mini) normally speak chat completions but reroute to /responses when a request combines function tools with an effort — Copilot rejects that combination on the chat wire:

Reasoning effort selector

Codex models whose catalog advertises the fast tier (the codex CLI's fast mode) get a Speed toggle in the composer's tool row, next to the model selector — Standard or Fast (service_tier: priority), per session. The /fast slash command offers the same choice as a popup; it errors with an explanation when the current model has no fast tier.

Speed toggle with the Standard/Fast menu open

The image_generate tool renders its result inline in the conversation:

image_generate renders the image inline

Its provider parameter picks the image backend — the same prompt through GPT (gpt-image-2, top) and Grok (grok-imagine-image-2.0, bottom):

image_generate with provider gpt vs grok

The video_generate tool plays the generated clip inline:

video_generate plays the clip inline

Providers

Route Subscription Models
codex ChatGPT Plus/Pro live catalog from chatgpt.com/backend-api/codex/models
claude Claude Pro/Max all models available in your subscription (Opus, Sonnet, Haiku, Fable — static catalog, updated with the plugin)
grok X Premium (xAI) live catalog from api.x.ai/v1/models (chat models only); reasoning efforts from the Grok CLI catalog (cli-chat-proxy.grok.com/v1/models)
copilot GitHub Copilot live catalog from api.githubcopilot.com/models (chat models on both wires, with per-model vision flags and reasoning efforts); login uses the OAuth device flow (enter the shown code at github.com/login/device)

Only logged-in providers appear in the session model picker; the lists above refresh on login/logout. Vision-capable models declare ['text', 'image'] input modalities, and image content is translated to each provider's wire format.

Logged-in cards also show subscription usage — per rate-limit window (5-hour session, weekly, and per-model weekly where the plan has one) with the used percentage, a progress bar, and the reset time, plus a Refresh button. Codex usage comes from chatgpt.com/backend-api/wham/usage (also reports the plan), Claude usage from api.anthropic.com/api/oauth/usage, and Grok usage from the Grok Build CLI proxy's cli-chat-proxy.grok.com/v1/billing (the source of the CLI's /usage panel; reports the shared weekly pool and the subscription tier). Copilot exposes no usage endpoint, so its card shows no usage section.

Also included, registered when the matching provider is enabled:

image_generate also supports editing: the model passes optional referenceImages (1–5 complete DSH attachment references) to edit or use existing images as sources; omitting it keeps text-to-image generation. References can come from uploads, read_image, or previous generated images. Read local files with read_image first; paths are not attachment references. Copy references from the image reference text or structured tool results. Their order matches the prompt's image order. Edits save new files and return reusable references, including for subsequent edits with another provider.

Codex edits use /backend-api/codex/images/edits; Grok edits use /v1/images/edits. Existing provider preference, logged-out fallback, and session tool policy still apply. Empty arrays, duplicate or invalid references, and attachment-limit violations fail explicitly instead of generating a new image. Editing requires the DSH attachment service.

Image generation and editing share same-provider account scheduling: try the default account first, then prefer the successful account in that session. Explicit quota, authentication, or image-entitlement rejection tries the remaining accounts; a 401 gets at most one credential refresh and retry first. Image-only cooldowns honor provider reset times and clear on login/logout. Transport failures, timeouts, 5xx responses, and invalid requests do not automatically resend, avoiding duplicate images. Set pool.enabled: false or pool.autoAccounts: false (legacy autoFamilies is accepted) to use only the default account. Image scheduling does not use chat catalogs, chat quota scoring, families, or tiers.

Install

Refreshing model lists

In Settings → Subscriptions → provider → Edit model list, use Refresh to bypass the five-minute catalog cache and refresh the conversation model picker too. This is separate from refreshing subscription usage. If models.<provider> is explicitly configured with a non-empty list, that list still overrides discovery.

Codex catalog visibility depends on the client_version request parameter. By default the plugin reads the stable version from the official npm @openai/codex package's public metadata (no CLI installation or subscription credentials sent to npm). Successful lookups are cached in memory for six hours; failures retry after five minutes and retain the last successful version, or the verified 0.153.4 fallback on first use. The lookup has a 1.5-second deadline, shares in-flight work across accounts, and ignores prerelease or regressed versions. Manual model-list refresh also rechecks the version. An explicit plugin configuration field, codexClientVersion: '0.153.4', takes precedence and disables automatic lookup; restart DSH after changing it. Model availability remains account-dependent; see verification notes.

Installation commands

With the dsh CLI available, install from npm (prebuilt artifacts, no build permission needed):

dsh plugin --profile web add dsh-plugin-subscriptions

Or install the sources from GitHub:

dsh plugin --profile web add github:V1ki/dsh-plugin-subscriptions

pnpm will ask you to allow this package's build script on first install (git installs fetch sources, not built artifacts); add the printed key to the profile's pnpm-workspace.yaml:

allowBuilds:
  dsh-plugin-subscriptions: true

and re-run the add. Only grant this to packages you trust — it runs the package's code at install time.

From a local checkout instead:

git clone https://github.com/V1ki/dsh-plugin-subscriptions.git
cd dsh-plugin-subscriptions && pnpm install && pnpm build
dsh plugin --profile web add ./dsh-plugin-subscriptions

Headless-only usage without installing into a profile (log in via the web UI first — the token file is shared):

cp overlay.example.yml overlay.yml   # then edit the name: to this checkout's absolute lib/index.js path
dsh --profile headless --patch <checkout>/overlay.yml "your task"

Update

Installed from npm:

dsh plugin --profile web update --latest dsh-plugin-subscriptions

Installed from GitHub: re-run the same add github:V1ki/dsh-plugin-subscriptions command — it re-fetches the sources and rebuilds. A linked local checkout just needs git pull && pnpm build in the checkout.

Either way, restart dsh web afterwards so the new version loads.

Use

  1. dsh web, open the printed URL.
  2. Settings → Subscriptions: click Connect on a provider. For Claude, credentials are imported instantly if you have run claude and logged in at least once; without them, Claude authorizes in the browser like the others. For Codex and Grok, authorize in the opened browser tab; Copilot shows a GitHub device code to enter at github.com/login/device; if a browser flow can't complete (headless host), expand the manual fallback and paste the callback URL or code.
  3. In any session, open the model picker (/model) and choose a model under ChatGPT (Codex) / Claude (Subscription) / Grok (Subscription) / GitHub Copilot.

Not logged in? The provider stays out of the picker, and requests fail with MISSING_CREDENTIAL pointing at the Settings page; nothing else breaks.

Multiple accounts

Every provider accepts several accounts: once one is connected, the card grows an Add account button (Claude offers Browser authorization and Import Claude Code separately). Accounts are keyed by their identity (email / login) — re-logging the same account updates it in place, a different account appends. Browser authorization signs in whichever account the browser currently uses, so switch accounts there first (or use an incognito window with the manual code) to add a different one. The ★ default account serves the direct provider routes; pool routes use every account. A Claude account imported from Claude Code stays synced with the CLI's credential store; OAuth-added Claude accounts refresh standalone so several accounts never fight over the Keychain entry.

Edit visible models, context windows, and tools

Open Settings → Subscriptions → provider → Edit model list, search and select models, then Save changes. All discovered models are shown automatically by default. Selecting individual models, selecting all, or clearing the selection saves an explicit list; newly discovered models then stay hidden until selected. Enable automatic display again to restore discovery-driven visibility. Hidden models remain usable by existing sessions, and the editor retains the full catalog so they can be restored. Refreshing discovery preserves preferences; Cancel discards unsaved edits.

Codex models also accept a context budget in tokens; leave it blank to follow the provider. The plugin reads each account's context_window and max_context_window, caps the requested budget at that account's maximum, and uses the advertised default as the conservative ceiling when no maximum is provided. Account pools resolve each member separately and use the smallest window. This changes DSH's local history budget and compaction timing, without sending an API capacity override. Longer contexts can increase response latency.

The same editor controls Codex image generation and Grok image generation, video generation, and X search. Changes apply only to sessions created after saving; existing sessions retain their creation-time policy, including after restart. Image generation is shared: it disappears only when neither configured provider enables it, and execution never falls back to a provider disabled for that session. Claude and Copilot currently have no standalone subscription tools to configure.

Preferences and tool-policy history live in ~/.dsh/plugins/subscriptions/provider-settings.json (mode 0600), independently of the five-minute discovery cache. Existing non-empty models.<provider> configuration still defines the base catalog; visibility selections filter that catalog.

Reasoning defaults in the model editor

Default reasoning effort now lives in Edit model list, beside each model's visibility and context settings. Apply edits with Save changes, or discard unsaved edits with Cancel. Hidden models remain editable. Models without reasoning levels have no selector; Follow provider clears an override. Choices come from live capabilities, intersected across account-pool members. Custom pool aliases do not offer ineffective effort overrides.

Existing defaults continue to load from and save to ~/.dsh/plugins/subscriptions/model-defaults.json (mode 0600). If a save fails partway through, unfinished edits remain in the draft; the UI reports any defaults already saved and lets you retry.

Config

- id: llm-subscriptions
  name: dsh-plugin-subscriptions
  config:
    providers: [codex, claude]        # subset; default all four
    streamIdleTimeoutMs: 300000
    rateLimit:
      wait: true                       # wait out a closed rate-limit window (default)
      maxWaitMs: 21600000              # ceiling on one wait; 6 h, covers a 5-hour session window
    models:                            # override the discovered/built-in catalogs
      codex:
        - { id: gpt-5.6-sol, name: GPT-5.6 Sol, contextWindow: 272000, inputModalities: [text, image] }
      copilot:                         # manual entries disable Copilot catalog discovery
        - { id: gpt-5.6-sol, wire: responses }   # copilot only: force the upstream protocol

wire (copilot entries only) pins a model to chat-completions or responses. Manual entries keep working without it — the field exists because a configured model the live catalog does not know would otherwise default to /chat/completions, which responses-only families (gpt-5.5/5.6, …) reject. Pinning chat-completions also opts out of the tools+effort auto-reroute described above.

Model pools

When a provider has two or more logged-in accounts, the picker shows the union of every account's catalog (duplicates dropped). Pick claude-sonnet-5 under Claude (or gpt-5.4 under ChatGPT) as usual — there is no extra pool group and no new model id.

Selection is sticky per session (prompt caches survive) with two strategies: priority (first healthy member wins) and quota_aware (the default — each member is scored by its required burn rate, remaining quota / time until window reset, so a window about to reset with plenty left gets spent instead of wasted; the sticky member holds until a challenger out-scores it by switchMargin). Members past 95% on any usage window are gated out; failures fail over before the first stream chunk with cooldowns (retry-after, or the window's own disclosed reset when the provider sends one) — quota and rate-limit failures cool the whole account down (its quota is account-level; Claude's model-scoped lanes cool per member), transient server failures cool only the failing member. Copilot exposes no usage telemetry, so it scores zero and naturally serves as the fallback of last resort.

- id: llm-subscriptions
  name: dsh-plugin-subscriptions
  config:
    pool:
      enabled: true                   # default; needs ≥2 accounts of one provider
      strategy: quota_aware           # or priority
      switchMargin: 2                 # hysteresis factor for quota_aware
      autoAccounts: true              # pool each catalog model across that provider's accounts
      families:                       # explicit account list for one catalog model (same provider)
        claude-sonnet-5:
          - { provider: claude, model: claude-sonnet-5 }                   # default account
          - { provider: claude, account: [email protected], model: claude-sonnet-5 }
      tiers:                          # optional extra picker rows
        smart:
          - { provider: claude, model: claude-sonnet-5 }
          - { provider: codex, model: gpt-5.6-sol }
          - { provider: grok, model: grok-4.6 }

Waiting out a rate-limit window

A subscription plan is rate-limit shaped by design — a 5-hour session window, a weekly one, and on some plans a per-model weekly one — so a 429 is not a dead end: the window reopens at a time the provider discloses. Each route reads that reset off its own 429 and turns it into that account's pool cooldown (see Model pools above) instead of a fixed 5-minute guess.

Only a signal that names the window which actually rejected the request is read: Anthropic's anthropic-ratelimit-unified-reset, the seconds Codex puts on a usage_limit_reached rejection, the delay xAI names in the error body, or a plain retry-after. The per-bucket rollover s

dsh-plugin-subscriptions (V1ki/dsh-plugin-subscriptions)

Searching Database…

这是什么?dsh-plugin-subscriptions 是一个 DeepSeek Harness(dsh)插件,让你在 dsh 里把已有的 ChatGPT(Codex)、Claude、Grok(X Premium)和 GitHub Copilot 订阅当作 LLM 提供方来用,不需要单独的 API 密钥。
这是独立应用,还是插入到别的东西上的?它是一个安装到 DeepSeek Harness(dsh)里的插件;它在 dsh 的 Web 界面里添加提供方登录、用量卡片和模型选择器,而不是作为自己的应用运行。
怎么安装并连接它?通过 dsh CLI 安装插件(来自 npm 或直接来自 GitHub),重启 dsh web,然后打开 Settings → Subscriptions,对每个提供方点击 Connect:Codex、Grok 和 Copilot 通过浏览器 OAuth 授权(Copilot 走 GitHub 设备码),Claude 则从现有的 Claude Code 会话导入凭据,或者退回同样的 OAuth 流程。
我需要 Claude Code CLI 或任何提供方的 API 密钥吗?任何提供方都不需要 API 密钥。Claude Code CLI 也是可选的——如果你以前登录过,插件会自动复用那些凭据,否则它就自己跑一遍浏览器 OAuth 登录。
如果我没登录某个提供方会怎样?那个提供方会直接从会话的模型选择器里消失,发给它的任何请求都会报 MISSINGCREDENTIAL 错误,并提示你去 Settings 页面——dsh 里其他一切照常。
我的登录令牌存在哪里?令牌以 0600 文件权限保存在本地 ~/.dsh/plugins/subscriptions/auth.json 中,并在运行 dsh 的机器上自动刷新。
每个提供方可以连接不止一个账号吗?可以——每个提供方都支持多个账号,以邮箱或登录名区分;带星标的默认账号服务于直连路由,而池化路由可以调度所有已连接的账号。
除了聊天,它能生成图片和视频吗?能,启用对应的提供方后,它会注册一个 imagegenerate 工具(GPT 的 gpt-image-2 或 Grok 的 grok-imagine-image-2.0,支持图片编辑)和一个 videogenerate 工具(Grok 的 grok-imagine-video-1.5),两者都会在对话里内联展示结果。
我能看到订阅额度用了多少吗?能,已登录的提供方卡片会按限流窗口(会话、每周、按模型)实时显示用量、已用百分比和重置时间——Copilot 除外,它没有暴露用量端点。
为什么不直接付钱用 API,而要用这个?它让你把已经在付费的订阅(ChatGPT Plus/Pro、Claude Pro/Max、X Premium、GitHub Copilot)当作 dsh 里的 LLM 后端复用,避免单独的按 token 计费的 API 账单。
Creator
V1ki
Size
4 MB
Stars
471
Age
2mo
Commits · 90 Days