READMESource: main@7d4e7930
dsh-tokenpilot (TokenPilot)
API usage, balance and cost monitor for DeepSeek Harness — a draggable floating dashboard with task status lamp and sound alerts.
Features
- Auto-detect current API & model — official DeepSeek vs third-party/proxy
- Balance — official
/user/balance(CNY), OpenAI-style proxies (/dashboard/billing/*), graceful无法查询fallback - Usage stats (persisted 7 days) — today's API calls, tokens (input/output/cache), cache-hit rate, first-token latency (TTFT), 7-day chart by API/model
- Cost — official DeepSeek billed with peak/off-peak prices from the built-in table (Flash ¥3/¥1.5 in, ¥9/¥4.5 out per 1M tokens; Pro ¥9/¥4.5 in, ¥27/¥13.5 out), aligned with the official Chinese docs; third-party billed by its own
/v1/modelsprices - Peak/off-peak windows — current period tag + countdown to the next switch (Beijing 09:00–12:00 / 14:00–18:00)
- Task status lamp — red = running, yellow = queued/waiting for you, green = idle; sound alerts (5 presets) on task completion and when the agent asks you a question
- Draggable pill ⇄ card — "from where it came, back to where it goes" animation; position & settings persisted in
localStorage - Settings page — charts, per-model detail, full official price table (with live-refresh button)
Install
dsh plugin --profile web add dsh-tokenpilot
Or use any in-harness plugin market (dshmarket, etc.). After install, restart the web profile: the pill appears on the right side (38% height), and a TokenPilot section appears under Settings.
Usage
- Click the pill to expand the card, double-click to collapse, drag to move
- Switch sound presets or refresh frequency under Settings → TokenPilot → 设置
- Click ↻ on the card to refresh immediately
Notes & limitations
- Usage is persisted to
~/.dsh/dsh-tokenpilot-usage.json(retained 7 days, older data auto-cleaned); it counts all sessions on this host, filtered by the currently selected provider - Balance lookup uses
credentials(API key env) — no key is stored or sent anywhere except the configured provider endpoint - On Windows the sandboxed fetch uses
curl.exe(with aC:\Windows\System32fallback path) - Official pricing uses a built-in table aligned with the official Chinese docs (no network sync)
Development
npm install
npm run check # syntax check of lib/index.js + lib/client.js
npm pack # build the publishable tarball
License
MIT
No comments yet. Be the first to write one.