Session cost meter forked from dsh-cost-meter, retargeted at Command Code GOAT: per-session and per-day cost, built-in 90+ model price catalog with automatic matching, GOAT subscription quotas (5-hour / weekly / monthly pool) as used/total bars, Coding Plan quotas, custom provider balances, peak/off-peak pricing notices, bilingual UI. It provides service:cost-meter like Han-1413141/dsh-cost-meter and the other dsh-subscribe-meter variants, so install only one cost meter: it replaces dsh-cost-meter rather than running alongside it.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:ycm50/dsh-subscribe-meter
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
DeepSeek Harness session cost tracking plugin · Command Code GOAT edition (bilingual UI)
A GOAT-customized fork of dsh-cost-meter. All upstream features (per-conversation cost · official balance · budget box · custom provider balance · history · peak/off-peak pricing · official price sync · coding-plan quotas · token heat grid, …) are unchanged — only the OpenCode Go quota card was replaced with the Command Code GOAT subscription quota.
English | 中文
Upstream & acknowledgements
This plugin is a customized fork of dsh-cost-meter. The upstream dsh-cost-meter is a feature-complete DeepSeek Harness session cost tracking plugin: per-conversation cost, official balance query, budget box, custom provider balance, history, peak/off-peak pricing, official price sync, Coding Plan quotas, token heat grid, and more — with a built-in 90+ model price catalog and auto-matching, in a bilingual (zh/en) UI. It is maintained by Han-1413141 under the MIT license.
Why this fork: we use the Command Code GOAT subscription (rather than OpenCode Go) day to day. The upstream Go-quota card only talks to opencode.ai/zen/go/v1/usage, so it cannot query Command Code subscription quotas. This repo therefore forks the project and replaces the Go-quota card with the official Command Code endpoint GET https://api.commandcode.ai/alpha/billing/credits (Bearer auth), adding 5-hour / weekly / monthly-pool “used / total + progress bar” displays; credential resolution was also switched to the DSH credential store / COMMANDCODE_API_KEY environment variable. Everything except the Go-quota card code — features, structure, docs — is inherited from upstream unchanged.
Acknowledgements: thanks to Han-1413141 and all contributors of upstream dsh-cost-meter — the vast majority of this project's code and design comes from upstream; we only layered a targeted customization on top. Upstream repo: Han-1413141/dsh-cost-meter (MIT).
What changed in this fork
| Change | Details |
|---|---|
| Quota endpoint | Swapped from opencode.ai/zen/go/v1/usage to the official Command Code endpoint GET https://api.commandcode.ai/alpha/billing/credits (Bearer auth) |
| Three windows | Rolling 5h / weekly / monthly pool all show “used / total” numbers + individual progress bars (upstream only showed the main window's percent) |
| Monthly pool math | GOAT monthly pool is $70 of usage; used = pool − monthlyCredits, cap = pool. The pool is configurable (Settings → “Monthly credit pool”, default $70), because the official monthlyCredits value is the remaining allowance of the model tier you are currently billing against — per-model allowances differ (see the table below) |
| Sidebar | GOAT box renders the same three-window used/total + progress-bar style as the Settings page; the budget box lost its budget progress bar (budget, used %, today's cost & share, used/limit remain) |
| Credentials | Key resolution is now DSH credential store COMMANDCODE_API_KEY → env COMMANDCODE_API_KEY → legacy config goQuota.apiKey (the opencode login-state auto-detect was removed) |
| Copy | All “OpenCode Go” strings → “Command Code GOAT”; new goQuotaUsedOf (used/total) i18n key (zh/en) |
Installation
Requirements: Node.js ≥ 20 + DeepSeek Harness (a version with the
dsh plugincommand).
# Option 1: local directory (after cloning or extracting)
dsh plugin --profile web add link:./dsh-CommandCode-meter
# Option 2: git URL (once the repo is published)
dsh plugin --profile web add github:ycm50/dsh-CommandCode-meter
# Option 3: dshmarket (if submitted to the marketplace)
dsh plugin --profile web add dsh-CommandCode-meter
After installing, restart dsh web (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
dsh web
Note:
lib/is the shipped artifact — there is no compile step (package.jsonno longer definesbuild;filesonly includeslib,cordis.patch.yml,docs/provider-pricing.json). For development,npm test(=scripts/verify-typert.mjs, not shipped) runs the realvalidateTypertManifest()from every@deepseek-ai/dsh-typert-loadergeneration it can locate, and checks the codec keys inlib/client.jsplus theexportspackaging contract. The plugin does not need these files at runtime.
Compatibility: every strict codec in
lib/typert.host.js/lib/client.jsmust carry bothschema: <zod v4>andcreate: () => <zod>— the 0.1.5-rc.x host generation only readsschema, 0.1.7+ only readscreate. Dropping either key makes that generation reject the whole typert contribution (all Remote methods gone; settings page and cost panel silently break). After editinglib/, runnpm testand refresh the installed copy in the profile as described above.
Configuring COMMANDCODE_API_KEY
Enter the key in Settings → Cost → Quota (GOAT card) → API key input (write-only, never echoed; stored in the DSH credential store), or set COMMANDCODE_API_KEY in the DSH credential vault / environment beforehand. Resolution order:
- DSH credential store (the Settings input saves here too)
- Environment variable
COMMANDCODE_API_KEY - Legacy config
goQuota.apiKey(migration only)
⚠️ The monthly pool is no longer a hardcoded constant: the $70 default comes from
COMMAND_CODE_PLANS.goat.monthlyCreditsin lib/coding-plans.js and can be overridden in Settings → Cost → Quota (GOAT card) → Monthly credit pool. The endpoint is only contacted after you explicitly enable the GOAT quota.
Verified GOAT pricing (from the official docs)
| Item | Value |
|---|---|
| Plan price | $10 / month |
| Monthly credits | $70 of usage (a 7× multiplier) |
| Rolling 5-hour cap | $14 (opens on the first request of the window, not a fixed clock) |
| Weekly cap | $35 |
The 5-hour and weekly caps come straight from the API's
windowLimits.fiveHour / weeklyused/capfields and are taken as-is; the “Monthly credit pool” setting does not affect them.
Per-model monthly allowances differ (official model table): $70 (GLM-5.2 / GPT-5.6 Sol / Tencent Hy3), $60 (DeepSeek V4 Flash family / Kimi K2.7 Code), $47 (MiniMax M3), $40 (GLM-5.3 Flash / Gemini 3.8 Flash), $33 (Qwen 3.7 family), $30 (MiMo V2.5), $20 (other new models). The API's monthlyCredits is the remaining allowance of the model you are currently billing against, so used = pool − remaining only holds when the pool is that same tier's allowance. That is why the pool is a setting: blank = GOAT default $70; switch your main model to DeepSeek V4 Flash and set 60. If the pool is set too small (remaining > pool) the panel warns instead of reporting inflated usage.
Other plans (set the corresponding value in “Monthly credit pool” when you switch):
| Plan | Price/mo | Monthly credits | 5-hour cap | Weekly cap |
|---|---|---|---|---|
| Go | $1 | $10 | $3 | $6 |
| GOAT | $10 | $70 | $14 | $35 |
| Pro | $20 | $80 | $16 | $40 |
| Max 10× | $100 | $150 | $45 | $90 |
| Max 20× | $200 | $300 | $90 | $180 |
| Team Pro | $40 | $40 | $12 | $24 |
These values live in COMMAND_CODE_PLANS in lib/coding-plans.js, sourced from three official pages (fetched 2026-09):
- https://commandcode.ai/docs/plans/goat (GOAT: $10/mo → $70, the 7× multiplier)
- https://commandcode.ai/docs/resources/pricing-limits (full plan comparison + per-model rates)
- https://commandcode.ai/docs/resources/usage-limits (per-plan 5-hour / weekly caps)
Model pricing (the commandcode route)
If your model route points at Command Code's Provider API (provider: commandcode, baseURL
https://api.commandcode.ai/provider/v1), the price table has to know that provider — otherwise
calls record tokens only and a cost of 0 (so "Today's cost" reads ¥0). This fork ships a
built-in commandcode provider table (49 models) sourced from the official model table, with
sourceUrl / checkedAt on every entry.
- The DeepSeek family uses the official peak / off-peak tiers: off-peak $0.15 / $0.60 / $0.003, peak $0.30 / $1.20 (peak windows 01–04 and 06–10 UTC, Mon–Fri — the same windows DeepSeek itself uses).
- Other models use the official flat rates; official
-50% / -98% / -99%promo prices are recorded at the discounted value with the list price noted. - Model ids follow the Provider API (e.g.
deepseek/deepseek-v4.1-flash,zai-org/GLM-5.2); case and separator differences are absorbed by canonical matching.
To add or change entries yourself, use Settings → Cost → Extended price table. Sync official prices only overwrites the DeepSeek main table; provider tables must be checked by hand.
After a price-table update, startup automatically re-costs historical buckets that have tokens but a zero amount (billed at off-peak). To re-price history precisely at its real peak/off-peak instants, toggling the pricing currency once triggers a full replay recompute.
Relation to upstream
- Upstream: Han-1413141/dsh-cost-meter (MIT)
- This repo is a modified fork; only the Go-quota card code changed (see the table above) — everything else inherits upstream;
- When the upstream plugin updates, this fork's edits get overwritten — to rebase, re-apply the corresponding changes in this repo's
lib/index.js/lib/store.js/lib/client.jsonto the new upstream (see CHANGELOG.md for the itemized diff).
Development & verification
node --check lib/index.js && node --check lib/pricing.js \
&& node --check lib/store.js && node --check lib/typert.host.js \
&& node --check lib/client.js # syntax checks
dsh --profile web --dump-config # composition-tree check
dsh --profile web --port 3099 # real startup (watch logs and the UI)
License
MIT © 2026 dsh-cost-meter contributors (GOAT fork © 2026)
Links
More in this category
bowenliang123/dsh-context★ 3973
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 597
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 282
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 202
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 187
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
PolinniZhong/dsh-personal-center★ 115
Personal center for DeepSeek Harness: cross-session usage statistics with per-provider and per-model breakdown (auto-discovers configured models), per-model cost estimation, global custom instructions, a data-driven desktop pet with bitmap & vector skins, and a conversation status overview, all local and offline.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.