dshbase

插件目录 / Developer / dsh-usage

dsh-usage

已验证 · 实测可装 Aisland-SJL

✓ 持续维护 基于 1 个官方 DSH 包

查看 GitHub ↗ ← 返回插件目录

109Stars
16Forks
3未关闭 issue
JavaScript语言
2026-08-31最近推送
跨平台平台

功能简介

🌊 Persistent dock & fully-customizable balance/usage panel for DeepSeek Harness — activity heatmap, dual-channel comparison, local-only & privacy-first

✅
我们的评价
推荐 — 实测可用且热门

🌊 Persistent dock & fully-customizable balance/usage panel for DeepSeek Harness — activity heatmap, dual-channel comparison, local-only & privacy-first 实测能干净安装、正常启动。109+ stars,社区认可度高,是低风险选择。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

🌊 dsh-usage

A persistent floating dock, a fully customizable balance / token-usage panel, an activity heatmap, and a dual-channel usage comparison for the DeepSeek Harness Web GUI (dsh web).

README-中文
License

✨ Feature tour

🌊 Persistent dock

Your key numbers stay visible at all times — balance glows green (red only when out of credit), rows are separated by hairlines, and a settings gear plus one-click refresh sit in the corner. When the sidebar collapses, the dock folds into a tiny balance pill.

dsh-usage dock
  • 🟢 Balance — green when healthy, red when drained
  • 📊 Today / Month / Cache hit — glanceable token stats
  • ⚙ Gear opens the panel · ↻ refresh re-queries instantly
  • 🧲 Mirrors your pins — every change applies immediately

🎛️ Detail panel — all seven widgets

A two-column card layout; every widget has a detail and a compact form, and can be drag-reordered, collapsed, hidden, or pinned.

Widget What it does
💳 Balance Big number on the left, available / topped-up / granted rows on the right; provider switchable
📊 Today Today's tokens plus input / output / cache-read breakdown
📈 This month Monthly tokens plus the same breakdown
🎯 Cache hit Today's and all-time cache hit rates
↔️ Channel share DSH channel vs Claude Code channel ratio bar
📜 Usage log Last 14 days per-day list, click to drill into per-model detail
🔥 Activity heatmap 28-day × 6-band dot grid (dates across, 0–24h down)
dsh-usage panel

🎨 Everything customizable

Accent (presets + color picker), background, and panel opacity are adjustable live. Drag-reorder, pin, collapse, hide — every number presents your way, echoing DeepSeek Harness's "everything is a plugin" spirit.

dsh-usage customizer

At a glance

Feature Notes
💳 Persistent dock Pinned compacts always visible; collapses into a balance pill when the sidebar folds
🎨 Everything customizable Widgets: pin / collapse / hide / drag-reorder with a dashed placeholder and glide animation; accent, background, opacity; persisted in localStorage
📊 Balance & usage panel Provider picker, balance breakdown, today/month totals in k/M/B units, cache hit, usage log with per-model drilldown
🔥 Activity heatmap GitHub-style dots: 28 days × 6 four-hour bands with date labels
↔️ Channel share DSH channel vs Claude Code channel (incremental JSONL aggregation of ~/.claude/projects)
🔄 Background refresh Refresh at startup, then every 5 minutes: balances, DSH tokens, Claude Code aggregation
🔒 Local-only security Three loopback-only GET endpoints; credentials resolved server-side; upstream forced HTTPS with DNS pinning; Claude logs aggregate numbers only — message text never leaves the machine

UI supports Chinese and English. Credentials come from Harness's ~/.dsh/.credentials.yaml; the plugin never reads, caches, or echoes secrets.

Quick start

Requires a DeepSeek Harness web profile (@deepseek-ai/dsh >= 0.1.0-rc.6).

dsh plugin --profile web add "github:Aisland-SJL/dsh-usage"

The normal install declares and installs @deepseek-ai/[email protected] as a runtime dependency. If you register a development checkout with link:, install the same exact package in the active profile because linked packages do not populate the profile dependency tree:

cd ~/.dsh/profiles/web
pnpm add @deepseek-ai/[email protected] --save-exact

Restart dsh web, hard-refresh the browser, and the dock appears at the bottom-left. Update / remove:

dsh plugin --profile web update dsh-usage
dsh plugin --profile web remove dsh-usage

Credentials

Balance providers read credential references from ~/.dsh/.credentials.yaml:

DEEPSEEK_API_KEY: sk-your-key-here            # official DeepSeek route
OPENROUTER_MANAGEMENT_KEY: sk-or-v1-...       # OpenRouter account (Management Key, not the inference key)
ZAI_API_KEY: your-zai-key                     # Z.ai open platform

Moonshot / Kimi profiles under llm-pi-ai are discovered automatically and reuse their apiKeyEnv. Providers without a public balance API show an explicit "no public balance interface" state — never a guess.

Supported providers

Provider Upstream endpoint Default credential ref
DeepSeek GET {origin}/user/balance DEEPSEEK_API_KEY
OpenRouter GET {origin}/api/v1/credits OPENROUTER_MANAGEMENT_KEY
Moonshot / Kimi GET {origin}/v1/users/me/balance pi-ai provider apiKeyEnv
Z.ai / GLM GET {origin}/api/paas/v4/balance ZAI_API_KEY

API

Method Path Response
GET /api/usage/providers Provider list, balance scheme, and status summary
GET /api/usage/balance?provider=<id> Unified balance snapshot; refresh=1 forces an upstream query
GET /api/usage/usage Per-day/per-model token aggregates, cache hit rates, 24-hour buckets (days[].hours), and the Claude Code channel (claude)

Non-GET requests get 405, non-loopback callers get 403; every response is JSON with Cache-Control: no-cache.

Development & testing

npm install           # react/react-dom/jsdom for offline tests only
npm run check         # syntax checks for every module and script
npm test              # 83 offline tests: balance schemes, token folding, server boundary, client, e2e flows, Claude aggregation, package contract
npm run test:package # runtime dependency + client inject contract

Tests are fully offline — no network, and the real ~/.dsh is never touched (server tests redirect DSH_HOME to a temp dir). Dry-run the real Claude data: node scripts/validate-claude.mjs.

Privacy & security

  • API keys never enter browser responses, plugin caches, or logs; they are resolved at request time through Harness's credentials seam.
  • Upstream balance queries: HTTPS enforced, DNS pre-resolved and private/loopback ranges rejected, connections pinned to the checked address (DNS-rebinding defense), 1 MiB response cap, 15 s timeout.
  • Usage caches under ~/.dsh/storages/ hold only aggregated token numbers and fold cursors — no prompts, no replies.
  • Claude Code logs are parsed line-by-line and discarded; only aggregated numbers reach the cache.
  • Do not expose these endpoints through a reverse proxy to LAN or the public internet.

Credits

  • Ychris12138/dsh-usage-stats (MIT): reference for balance schemes, token folding semantics, bundle plugin structure, and the security boundary.

License

MIT

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-usage」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:Aisland-SJL/dsh-usage

Headless(CLI)profile:

dsh plugin --profile headless add github:Aisland-SJL/dsh-usage

实测报告

验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7797 个插件 →