dsh-plugin-subscription-usage
v0.9.0
Published
ChatGPT (Codex), Claude, Grok and GitHub Copilot subscriptions as rows on the DSH Models page, with pace-aware usage meters
Maintainers
Readme
dsh-plugin-subscription-usage
ChatGPT, Claude, Grok and GitHub Copilot subscriptions as DSH providers, with pace-aware usage meters.
A subscription works like any other DSH provider. Sign in with the plan you already pay for, pick its models in the composer, and see whether each limit will last until it resets. Requests go to the provider with the subscription's own credentials. The plugin reads usage from the provider's replies and endpoints.
Contents
- What you get
- Supported providers
- Install
- Quick start
- Reading the meters
- Multiple accounts
- Models, tools and commands
- Usage-only providers
- Agent tool
- Configuration
- Privacy and storage
- Limits and troubleshooting
- Development
- Contributing
- Credits
- License
What you get
| Surface | What it does |
|---|---|
| Settings > Models | One row per subscription. Sign in, add accounts, choose models, set defaults, toggle tools. |
| Settings > Usage | Pace-aware meters for every metered provider, Left and Used, pace warnings, the composer switch, pins and API keys. Each provider also has a 30-day history with trends, a weekly comparison and a cache share. A Codex account with a banked reset shows a Reset credit row that spends one after an inline confirmation. |
| Composer | A one-line gauge for the current model's provider and any pinned providers. Click it for every window, refresh and pin. |
| Agent | The read-only subscription_usage tool returns plan, windows, pace and reset times for every signed-in account. |
Subscription sign-in and account setup happen on the Models page. API key providers are added on the Usage page. A signed-in row shows the active account, its plan, the default star and the serving bolt. Manage opens the plugin's Accounts and Models tabs, plus Tools where the provider has subscription tools.
Supported providers
| Provider | Sign in | Models and tools |
|---|---|---|
| ChatGPT (Codex) | Browser OAuth with ChatGPT. Paste the redirect URL if the browser does not return. | GPT models; image generation, web search, the /fast speed tier |
| Claude | Browser OAuth, or import an existing Claude Code login. | Claude models; prompt cache lifetime |
| Grok | Browser OAuth with xAI. | Grok models; image and video generation; X search |
| GitHub Copilot | GitHub device code. | Copilot models |
Google Antigravity is not supported. Version 0.7.0 removes the Antigravity provider. Google's Antigravity Terms of Service prohibit using the service through third-party software, and Google suspends accounts that do. Use a Google AI Studio Gemini API key or Vertex AI through DSH's own provider instead. See the research note.
Each provider reports usage when its plan publishes a quota. Codex and Claude also update their meters from the response headers of the reply that just ran, so those numbers move without another request. Grok and Copilot read their usage endpoint on the same five-minute poll.
Install
dsh plugin --profile web add dsh-plugin-subscription-usageUse your profile name instead of web if you run a different one. The desktop app and dsh web normally use the web profile.
Restart DSH. In the app, open the account menu at the bottom of the sidebar, choose Settings, then Models.
Requirements
- DSH 0.2.2 or newer. Tested with DSH 0.2.2-rc.3.
- One subscriptions plugin per profile. Disable any other plugin that registers the
codexadapter, or the second one fails withDUPLICATE_ADAPTER. - You sign in with the subscription account you already have. No API key is needed for the four OAuth providers.
Upgrading from 0.6.x
This release removes the Antigravity provider. Remove antigravity from providers, usage.pinned, pool.families and pool.tiers in cordis.patch.yml if present; the new schema rejects it there. Delete the obsolete antigravity configuration block and models.antigravity, which are now ignored. On first start the plugin deletes the stored Antigravity session and cached model list. Revoke the old grant at https://myaccount.google.com/permissions.
To update, run dsh plugin --profile web add dsh-plugin-subscription-usage@latest and restart DSH. For a local build, add the tarball to the profile with dsh plugin --profile web add /path/to/dsh-plugin-subscription-usage-0.9.0.tgz.
Quick start
- Sign in. Open Settings > Models and choose Sign in on a provider. Codex, Claude and Grok open a browser tab. Copilot shows a GitHub device code. Claude also offers Import Claude Code. If the browser tab does not return to DSH, use Paste redirect URL instead.
- Manage the account. Open Manage > Accounts to add another account, make one the default, include or exclude it from the pool, or sign out. Models sets model visibility, the default effort, the Codex context window and the Claude cache lifetime. Tools, where the provider has them, turns subscription tools on or off for new sessions.
- Pick a model. Open the model picker in the composer. With one account, the provider's models are listed under its name. With two or more accounts, each model gets an Automatic row and one row per account.
- Watch the gauge. The current model's provider appears first, then any pinned providers. Click the gauge for every window, a manual refresh and a pin button. The gauge stays one line.
- Open the Usage page. Settings > Usage has the full meters, the Left and Used choice, the pace warnings switch, the composer switch, pins, refresh and the API key providers.
Reading the meters
Each meter is one quota window, such as 5h, 7d or 30d. The filled part is the share shown, in one solid color. With Used selected it is the share you have spent; with Left selected it is the share you have left. Green is calm, amber is tight, and red is over or out. The time column is always that window's reset: a countdown such as in 5d 21h, resetting… once the reset has passed, or not started for a window that has no reset yet. The forecast is text only: hover a row, or read the pace notice, to see when the window would empty.
How the forecast works
- A window is over when the current rate would pass 100% before the reset. The bar is red, and the tooltip and the pace notice show when it would empty, for example "empty Sat 9:25 AM"; the time column still shows the reset.
- A window is tight above 85% projected use, calm at or below 85%, and out at 100% used.
- The forecast waits for 20% of the window to pass and 3% to be used. Before that, the bar shows the used share without a forecast.
- A window with no reset time shows a plain percentage. A window the provider calls inactive shows
not started.
When the numbers update
- Codex and Claude replies carry usage headers. The plugin records them after the response, so the meter is current before the next poll.
- Every provider also has a usage endpoint. The UI polls while the page is visible, every five minutes.
- Opening the composer popover fetches when the snapshot is older than 60 seconds.
- A manual refresh fetches at most once every 30 seconds per account. A failed read keeps the last snapshot, marks it stale, and waits out the provider's cooldown.
- Pace warnings shows a notice when a window on the serving or default account will empty before its reset, or has run out. The meter color is separate from that switch.
Codex reset credits
Codex can grant a banked full reset that clears both the 5h and weekly limits. When an account has one, Settings > Usage shows a Reset credit row under its meters with the count and the earliest expiry. Use reset opens an inline confirmation, then spends one credit.
The server decides whether the usage needs a reset. If it refuses, the row says no reset was used and keeps the credit. The row is hidden when the account has none. A failed reset lookup shows an unavailable line while the meters keep working.
Usage history
Every metered provider's header has a History button. It opens a panel under that provider's meters with the selected window over the last 24h as hourly columns. 7d and 30d switch to six-hour and daily buckets. The last column uses the live snapshot, so its value matches the meter above it, and a gap means the plugin was not recording.
Beside the chart the panel shows the current rate, the range average, the peak, and the change against last week. Last week compares the 7 complete local days before today with the 7 before that, and hides until both weeks have two days of readings and the earlier week has consumption. The footer shows the cache read share and the range's token totals, and Clear history removes the selected account's readings and token totals after a confirmation.
Readings are written at most every five minutes, with a new one when a window moves a point or resets and a six-hour heartbeat. Files live under ~/.dsh/plugins/subscriptions/usage-history/ for 30 days, and token totals under usage-tokens/. Both store a hash of the provider and account key, never the key, email, token or API key. History is local to this machine and is not backfilled.
Multiple accounts
Sign in a second time from Manage > Accounts. The Models card shows the active account in full and folds the rest. Manage lists every account with a Pool switch when there are two or more, a star for the default, and a bolt for the account that served the last request in this session.
Account names are placeholders. The Automatic row keeps the pool. An account row routes only to that account.
When a pool is available, the model picker lists the pooled model with an Automatic badge and one row per account with the account label. The Automatic row keeps failover inside the pool. An account row sends the chat to that account only, so two chats can use two accounts at the same time. The pool strategy is quota_aware by default. priority and quota_normalized are also available; set the strategy in the configuration.
Models, tools and commands
Manage > Models
- Show or hide individual models. Show new models automatically keeps the picker in step with the provider's catalog.
- Set the default reasoning effort per model.
- Set a Codex context window in thousands of tokens. The row shows the model default and the ceiling your plan allows.
- Set the Claude prompt cache lifetime: Default, 5 minutes or 1 hour. The config default is
auto, which keeps the main conversation at one hour and subagents at five minutes.
Tools
| Tool | Provider | What it does |
|---|---|---|
| image_generate | Codex, Grok | Generates or edits an image with the subscription's own image model. Saves under ~/.dsh/plugins/subscriptions/images/. |
| video_generate | Grok | Generates an MP4 of 1 to 15 seconds. Saves under ~/.dsh/plugins/subscriptions/videos/. |
| x_search | Grok | Searches X posts, profiles and threads through xAI's hosted search. |
| web_search | Codex | Uses the Codex subscription's web search backend. |
For Codex and Grok, the Tools tab turns these on or off. The change applies to new sessions. Generated images and videos open in the chat with their own preview.
Speed
Codex models that advertise a fast tier get a Speed control next to the composer: Standard or Fast. The same choice is available as the /fast command. Fast runs at 1.5 times the speed and uses more of the subscription allowance.
Usage-only providers
Seven providers show usage without becoming model providers in this plugin. Add one from Settings > Usage > Add a provider, paste its API key, and save. The plugin checks the key once, stores it in ~/.dsh/plugins/subscriptions/usage-keys.json with mode 0600, and shows the last four characters in the UI. Remove key deletes it.
| Provider | Key | |---|---| | Z.ai | Z.ai API key | | Ollama Cloud | Ollama Cloud API key | | Kimi Code | Kimi Code API key. A plain Moonshot key does not work for usage. | | MiniMax | MiniMax Coding Plan key | | ClinePass | ClinePass key | | OpenRouter | OpenRouter API key | | NanoGPT | NanoGPT API key |
OpenCode Go is different. DSH already holds its credential for the opencode-go route. The plugin reads OPENCODE_GO_API_KEY, then OPENCODE_API_KEY, on each fetch, so a rotated key applies without a restart. There is nothing to paste, and the plugin stores no key. OpenCode Go is usage-only here and is not routed by this plugin.
Once a key is saved, the seven key providers appear in the Usage page and the agent tool. Pin one to show it in the composer gauge. They do not appear in the model picker. OpenCode Go already has its own DSH provider; this plugin adds only its meters and does not route its models.
Agent tool
subscription_usage gives the agent the same numbers the UI shows. It is read-only and needs no approval. The system prompt tells the agent to call it before a long or heavy task.
{
"providers": [
{
"provider": "codex",
"account": "[email protected]",
"modelIdPrefix": "~account:%5B%22acct%22%2C%22user%22%2C%22you%22%5D:",
"plan": "plus",
"windows": [
{ "kind": "session", "usedPercent": 31, "leftPercent": 69, "resetsAt": "2026-11-26T13:26:12.000Z", "pace": "calm" },
{ "kind": "weekly", "usedPercent": 68, "leftPercent": 32, "resetsAt": "2026-11-29T08:31:37.000Z", "pace": "over", "emptyAt": "2026-11-28T05:56:38.798Z" }
],
"fetchedAt": "2026-11-26T08:41:23.520Z"
}
]
}Each signed-in account is its own entry. When the account has its own model rows (two or more accounts by default), that entry's modelIdPrefix starts those rows in list_subagent_models; pass the matching model id as the subagent model.
Pass a provider id to narrow the result, or refresh: true to force a fresh read. Each entry carries fetchedAt, and a failed refresh adds stale: true. One account's error does not hide the others. It never returns a token, a key or a key tail. If the name is taken, it registers as dsh_subscriptions_subscription_usage.
Configuration
Most settings are in the UI. Advanced options go in the profile's cordis.patch.yml, under the subscription-models entry:
- id: subscription-models
name: dsh-plugin-subscription-usage
config:
providers: [codex, claude, grok, copilot]
claudePromptCacheTtl: auto # auto, 5m or 1h
rateLimit:
wait: true # ask DSH's retry layer to wait
maxWaitMs: 21600000 # six hours
pool:
enabled: true
strategy: quota_aware # priority, quota_aware or quota_normalized
autoAccounts: true
usage: # normally written by Settings > Usage
composer: true
pinned: []
display: left # left or used
paceWarnings: true| Option | Default | What it does |
|---|---|---|
| providers | all four | Registers only the listed providers. |
| claudePromptCacheTtl | auto | auto, 5m or 1h. Auto uses one hour for the main conversation and five minutes for subagents. |
| rateLimit.wait | true | Asks DSH's retry layer to wait for a provider's disclosed rate-limit reset. |
| rateLimit.maxWaitMs | 21600000 | Longest wait, six hours. |
| pool.strategy | quota_aware | Account selection: priority, quota_aware or quota_normalized. |
| pool.autoAccounts | true | Adds each account's models to the pool. |
| usage | | Display preferences, also edited from Settings > Usage. |
models, streamIdleTimeoutMs and the explicit pool member lists are also available. The full schema is the Config export in src/index.ts.
Privacy and storage
The plugin keeps its data under ~/.dsh/plugins/subscriptions/.
| Path | Contents |
|---|---|
| auth.json | OAuth sessions, mode 0600 |
| usage-keys.json | API keys for usage-only providers, mode 0600 |
| provider-settings.json | Account aliases, visible models, context windows, tools and cache choices, mode 0600 |
| models.json | Model catalogs, no secrets |
| proxy.json | Proxy URL and bypass list, mode 0600 |
| usage-history/, usage-tokens/ | Quota readings and token totals, one NDJSON file per UTC day, mode 0600; account keys are hashed |
| images/, videos/ | Generated media |
- Tokens and keys stay in the Host process. The browser page receives account labels, plan names, usage numbers and the last four characters of a key.
- Usage reads and model requests go to the provider's own host. The optional proxy applies to the plugin's HTTP requests.
- The plugin collects no analytics. Removing an account or a key removes its stored secret. Usage history is kept for 30 days and can be cleared from its panel. Generated images and videos stay until you delete them.
Limits and troubleshooting
Usage unavailable. Copilot, Grok, Z.ai, Ollama Cloud, Kimi Code, ClinePass, OpenRouter, NanoGPT and OpenCode Go usage comes from endpoints the vendors do not document. The endpoint can change without notice, and the row then shows Usage unavailable while the provider itself keeps working.
Reset credit unavailable. The Codex reset endpoints are private, like the usage endpoints. If the lookup fails, ordinary usage still shows and the reset row says availability could not be checked. The header refresh retries.
No windows for Copilot. A Copilot plan without a premium request quota has nothing to meter. Chat and completion limits that report as unlimited are not shown.
Kimi Code needs its own key. A plain Moonshot API key does not read Kimi Code usage.
The Edit button is not the plugin's form. DSH draws its own Edit button on every provider row. It opens a generic provider form that points to cordis.patch.yml. The plugin's account, model and tool settings are under Manage; display preferences are on the Usage page. The host does not let a plugin hide that button.
Another subscriptions plugin is installed. Disable it before you install this one. Two plugins cannot both register codex, and the second fails with DUPLICATE_ADAPTER.
The gauge is missing or shows only an icon. The gauge shows numbers when the current model belongs to a subscription provider or when you pin one. With neither, it shows a meter icon. Settings > Usage > Composer usage must be on.
A local build does not reach the app. The profile loads its own copy of the package. Rebuild, reinstall the plugin into the profile, then reload the page for client changes and restart DSH for host changes.
Development
pnpm install
pnpm build
pnpm testpnpm build runs tsc and tsdown into lib/. pnpm test compiles to lib-test/ and runs the Node test suite.
The live UI harness opens the running DSH Web GUI in headless Chromium, mints a browser session from the local credential record, prints console and page errors, and writes a screenshot:
npm run webcheckIt uses an installed Playwright and Chrome, installs nothing, and does not print the session secret. Screenshots land in .scratch/web-check/.
Feature notes live in docs/features. Read FEAT-001 before changing the Models integration or the usage display.
The @deepseek-ai/dsh-* packages are pinned to one version through pnpm-workspace.yaml overrides. Mixed versions create two copies of branded types such as SessionId, and the build fails with unrelated type errors.
Contributing
Issues and pull requests are welcome at GitHub Issues.
Run pnpm build and pnpm test before opening a pull request. For a UI change, include npm run webcheck screenshots from before and after the change. Keep one subscriptions plugin per profile.
Credits
The auth, provider, translation and tool core comes from the upstream DSH subscriptions plugin. The UPSTREAM file records the commit. The Models integration, pace forecast, usage-only providers and account picker are this project's work.
License
MIT. See LICENSE.
