DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

octisfall /

octisfall/dsh-account-balance

Verified

DeepSeek account balance and per-model spending under the composer in DeepSeek Harness

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@1980f68e

dsh-account-balance

Your DeepSeek account balance, and what your sessions spent, right under the composer in DeepSeek Harness.

status license

The widget sits in the composer dock, beside the context meter:

  • Balance of the signed-in DeepSeek account, refreshed on mount, on window focus, and every two minutes.
  • Hover for the breakdown between topped-up funds and granted bonus credit.
  • Click for a panel with spending per model for today, the last 7 days, and the last 30 days, plus a button that opens the Platform usage page.
  • Honest states: Balance — with a reason when the account is signed out, the wallet read fails, or the usage route is unavailable.

Install

Through the Plugins settings page — Settings → Plugins → Add — or through the CLI's plugin command, which forwards to pnpm inside the profile directory:

dsh plugin --profile <profile> add github:octisfall/dsh-account-balance

The package declares a Cordis bundle patch and a web Client entry, so it appears in the profile's plugin list and starts rendering after the page loads.

How it works

Two halves in one package, as DSH bundles expect:

Half File Role
Host index.js Registers one read-only route, GET /plugin/account-balance/usage. It folds every recent session log through ctx.sessionQuery, attributes each assistant/message to the model in force, prices the step, and caches the answer for 60 seconds.
Client client.js Registers a conversation.composer.dock entry. Reads the wallet through the account Remote namespace (getBalance) and the Platform usage link through getState, and fetches the Host route when the panel opens.

Everything the Client shows comes through the Harness itself: no separate server, no polling of Platform. Copy goes through the Client locale service (English and Chinese), colors through --dsw-alias-* theme tokens, so the widget follows the app theme and language.

What the money figure is, and is not

The session log stores tokens, not invoices. The panel therefore shows an estimate: token counters from your local sessions multiplied by the rates in prices.json.

  • Rates shipped here are the published DeepSeek API rates for deepseek-flash and deepseek-v4-pro from https://api-docs.deepseek.com/quick_start/pricing, in USD per million tokens.
  • Peak windows (01:00–04:00 and 06:00–10:00 UTC, Monday–Friday) bill at the peak rate and everything else at half, decided per step from the event time. Chinese public holidays are not tracked, so a holiday step is priced as an ordinary weekday.
  • Cache reads, cache writes, and fresh input are counted separately, each at its own rate; a cache write bills at the cache-miss rate.
  • An unknown model shows tokens and — for money, and its period total stays unpriced rather than silently understating it.

Edit prices.json to correct a rate; the next read of the panel picks it up. The authoritative numbers always live in the Platform usage page the panel links to.

Privacy

  • The route reads token counters from the local session logs already on this machine. Nothing is uploaded.
  • The route answers on the local Harness HTTP server. Like other plugin routes it sits outside the /api bridge, so it carries no browser-session authentication: keep the server bound to loopback, which is the DSH default. It exposes aggregate token counts and costs only — never prompts, messages, file paths, or credentials.
  • The plugin never reads or stores the account token; the balance comes from the account namespace the Harness already owns.

Compatibility

Built and verified against DeepSeek Harness 0.2.1-rc.5. It depends on conversation.composer.dock, the account Remote namespace, sessionQuery, and webServer; a Harness release that renames any of them will need a matching change here.

Development

The plugin is a plain npm package with dsh.bundle.patch and dsh.client; there is no build step, and index.js and client.js are the shipped artifacts.

  • Edit index.js or client.js, then let the profile recompose (or reload it) so the new module generation is imported.
  • Edit prices.json without touching code; the next read of the panel picks the new rates up.
  • Check the Host fold without opening the UI: curl http://127.0.0.1:<port>/plugin/account-balance/usage.

License

MIT

—/ 5

No ratings yet

Verified DSH bundle

Commit 1980f68e08eb

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout