dsh-api-usage-bar
 
English | 简体中文
A lightweight API token usage bar for the DeepSeek Harness Web UI. It displays complete-session usage as three segments: cached input, uncached input, and output, with compact values beside the track.

Features
- Reads the existing DSH
tokenUsagesession projection; it never calls the DeepSeek API. - Reads no API key, polls no account balance, and writes no session-log event.
- Green is cache-read input, amber is uncached input, and blue is output.
- Hover text and the accessible label expose exact token totals for all three buckets.
- Responsive on desktop and narrow screens; narrow layouts hide the words but retain colors and values.
- UI only: no model tool, system prompt, or token overhead.
Requirements
- DeepSeek Harness
>=0.1.0-rc.6 <0.2.0 - Web profile
- Node.js
^22.19.0or>=24 - pnpm 10 (
dsh plugininvokes it internally)
Install
Run in PowerShell or a terminal:
npm install --global pnpm@10
pnpm --version
npx --yes @deepseek-ai/dsh@0.1.0-rc.6 plugin --profile web add https://github.com/hurry060215-tech/dsh-api-usage-bar/releases/download/v0.1.1/dsh-api-usage-bar-0.1.1.tgz
npx --yes @deepseek-ai/dsh@0.1.0-rc.6 webOpen <http://127.0.0.1:3080>. The bar appears below the composer after the first completed model request. The release includes prebuilt lib/ output, so users do not need to clone or build the repository.
This plugin is not published to npm. Do not use add dsh-api-usage-bar; the command above installs the prebuilt GitHub Release package directly.
Port 3080 is already in use
If DSH is already running on port 3080, stop that process with Ctrl+C in its terminal and run the web command again so the newly installed plugin loads. If another application owns 3080, use:
npx --yes @deepseek-ai/dsh@0.1.0-rc.6 web --port 3091Then open <http://127.0.0.1:3091>.
Remove it with:
npx --yes @deepseek-ai/dsh@0.1.0-rc.6 plugin --profile web remove dsh-api-usage-barAccounting
| Segment | DSH token projection fields |
|---|---|
| Cached input | cacheReadTokens |
| Uncached input | uncachedInputTokens + cacheWriteTokens |
| Output | outputTokens |
The three segments are normalized by their token total, so the track shows usage composition, not account quota or balance depletion. DeepSeek request usage reports prompt-cache hit and miss tokens, while the balance endpoint supplies no total-quota denominator; this plugin does not invent an “amount used” percentage.
Development
pnpm install
pnpm run check # typecheck + tests + build
pnpm pack # produce an offline-installable tarballSource layout:
src/index.ts: inert Host plugin used for client-module discovery.src/client/index.ts: locale, stylesheet, and composer-dock registrations.src/client/ApiUsageBar.tsx: the track and compact legend.src/client/usage.ts: pure token bucketing and formatting.cordis.patch.yml: profile layer activated bydsh.bundle.
Privacy and model experience
The plugin only reads the cumulative token projection already delivered to the browser. It makes no network request, holds no credential, writes no session event, and changes nothing sent to the model.
License
[MIT](LICENSE)