Skip to main content

deepseek-harness-wallet

58Stars3Forks1Issues0Watchers

Provides official DeepSeek balance, per-session cost, and third-party Token usage panels for DSH Web. Supports multi-account hot switching, 24-hour peak-valley pricing display, and anti-phishing recharge portal.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
License
MIT
Branch
main
account-monitoringagentic-aibalance-monitorcost-trackingdeepseekdeepseek-harnessdsh-pluginjavascript

Install

cmdweb profile
$ dsh plugin --profile web add github:feibi-mochi/deepseek-harness-wallet

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin feibi-mochi/deepseek-harness-wallet for me: review the repository at https://github.com/feibi-mochi/deepseek-harness-wallet first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Pitch

A mini "wallet" badge permanently displayed next to the input field in DSH Web, showing DeepSeek official account balance, current session cost, and third-party Token usage. Provides one-click multi-account switching, low balance alerts, and official recharge entry.

Core Features

  • Real-time official DeepSeek balance: Auto-refreshes every 60 seconds, with 2 / 6 / 15 / 30 second progressive retry on startup. Shows friendly error instead of crash when API Key is not configured (index.js:35 / index.js:737-749)
  • Current session cost and Token bucketing: Listens to host llm/stream events, separately accounts input / cache-read / cache-write / output / reasoning tokens for official provider and other providers. Each usage locks in the price at that moment to avoid cross-tier mixing (index.js:710-731 / index.js:481-498)
  • 24h peak/valley billing clock: Ring clock at sidebar bottom shows Beijing timezone peak hours (09:00–12:00, 14:00–18:00) and half-price valley periods in real-time, with switch countdown and optional desktop notifications (index.js:41-43 / CHANGELOG.md:7-10)
  • Multi-account management and hot switching: Add multiple DeepSeek accounts (name + API Key) in panel "Account Management". After switching, no restart needed; next LLM request charges to new account. UI only shows masked Key (index.js:435-451 / README.md:39-44)
  • Phishing-proof official recharge entry: "↗Recharge" button on right side of badge directly opens https://platform.deepseek.com/top_up. URL is hardcoded in code and cannot be changed. First click shows popup confirming the domain (index.js:28 / README.md:138)
  • Badge supports drag-and-dock, scaling, and floating window: Can drag between three modes: next to input field, floating, or sidebar docking. Dock position and scaling ratio persist. Panel can be detached as draggable floating window, further minimized to a movable dot (lib/client.js:1965-2099 / CHANGELOG.md:38-44)
  • Completion reminder and peak/valley switch desktop notification: Shows popup via host notification channel when conversation completes. Can be set to stay or auto-close after timer. Falls back to in-page notification when system notifications not supported (lib/client.js:715-755 / README.md:31)

Technical Implementation

  • Language: JavaScript (ESM): index.js is the host half, lib/client.js is the client half (package.json:5 / package.json:6-11)
  • Key Dependencies: Zero third-party runtime dependencies. Only uses Node built-ins node:crypto / node:fs / node:os. Browser side renders via React (injected by DSH Web). All CSS variables use --dsw-alias-* theme (package.json:0 / index.js:19-22 / lib/client.js:262-310)
  • Architecture Pattern: Dual half host plugin. Host half intercepts model stream usage blocks via ctx.on('llm/stream', usageTap, { global: true }), accounts by provider. ctx.webServer.register exposes 8 JSON routes: /api/wallet/{snapshot,threshold,refresh,clear-session,accounts,accounts/activate,accounts/remove,official-providers}. Client half registers itself into page via window.__ModuleLoader__.load({ id: 'deepseek-harness-wallet', factory }). Compatibility adapter createCompatibilityAdapter() unifies abstraction for notification / storage / permission / external link 4 types of host orchestration points (index.js:697-903 / lib/client.js:6-11 / lib/client.js:45-240)
  • Entry Files: Server entry index.js (apply / name = 'wallet'); Client entry lib/client.js; Mount declaration cordis.patch.yml (inserts id=wallet, name=deepseek-harness-wallet into web profile) (cordis.patch.yml:1-4 / package.json:49-61)

Use Cases

Suitable for those who use DeepSeek as their primary model and need to see official balance, current session cost, and third-party Token consumption at a glance during each session. It consolidates the scattered cost signals from the official open platform console, DSH model settings, and session details into a draggable mini badge. Particularly useful when multiple people share one machine or when rotating billing across multiple accounts.

Prerequisites & Compatibility

DependencyMinimum VersionNotes
DeepSeek Harness (DSH)0.1.0-rc.6+ (tested with 0.1.0-rc.7)README badge pins 0.1.0--rc.6, RELEASE-NOTES-v0.2.2 reports tested 0.1.0-rc.7 (README.md:6 / RELEASE-NOTES-v0.2.2.md:12-27)
Node.js (only for host import)`^22.19.0
PlatformCross-platformTested on Windows + Edge. CI runs all three platforms (Ubuntu / macOS / Windows) × Node 22 / 24 all green. No native modules introduced, zero OS-specific branches (README.md:99-105 / RELEASE-NOTES-v0.2.2.md:12-27)
API KeyDEEPSEEK_API_KEY for balance queryToken/cost accounting still works without key, but balance shows error state (AGENTS.md:13)
Native ModulesNoneZero third-party dependencies

Installation

dsh plugin --profile web add github:feibi-mochi/deepseek-harness-wallet

Configuration

This plugin does not read host config files; all user-level settings are adjusted via in-panel UI and persisted immediately. Below are the actual key names, purposes, and default values for each setting (lib/client.js:18-35 / lib/client.js:1043-1140):

ConfigTypeDescriptionDefault
Badge LayoutenumBadge dock position: In Input / Floating / Sidebarhome (In Input)
Badge Scalenumber(0.75–1.25)Badge zoom. Max 120% when in input, up to 125% when floating/sidebar1.00
Panel Contenttwo flagsWhether to show official / third-party data in badge. At least one must remain{ official: true, third: true }
Completion Reminderenumoff / 5s / 10s / 30s / 60s / keepoff
Low Balance BlinkbooleanWhether badge pulses red when balance below thresholdtrue
Low Balance Threshold (CNY/USD per currency)number(0–100000)Alert when balance below this line. CNY and USD are independent, automatically applied based on active accountCNY 5
Peak/Valley Ring Clock (sidebar bottom)booleanWhether to show 24h billing time charttrue
Peak/Valley Switch System NotificationbooleanWhether to show desktop notification when entering peak/valleyfalse
Permanent Session Delete (only when host supports)booleanExposes permanent delete entry in session menu. Host without capability has switch permanently grayed outDetermined by host capability
Accounts (multi-account)listName + API Key, stored in $DSH_HOME/storages/accounts.json. First added becomes activeEmpty
Third-party Provider Mapped to Official Bucketstring[]Which wrapper providers to count as official price in settings page (useful for visual models routed via proxy billed at official rate)Only built-in deepseek-official

FAQ

Q: The badge (chip) doesn't appear after installation. What should I do?

A: You must first dsh plugin --profile web add deepseek-harness-wallet, then restart dsh web, and finally hard refresh the page in browser. The client half is injected via window.__ModuleLoader__.load({ id: 'deepseek-harness-wallet' }). Hard refresh is the necessary condition to trigger loading.

Q: Why does the balance show error / no number?

A: Balance depends on DEEPSEEK_API_KEY. When absent or invalid, it directly queries the official /user/balance endpoint. The key only leaves this machine as the Authorization header. Token/cost accounting does not depend on key and works normally. Balance will recover once you configure the key in DSH model settings or add it via account management.

Q: Third-party model sessions show no balance and cost, only Tokens. Why?

A: Balance and official price list only connect to official API. Third-party providers have no official price list or balance endpoint, so only input / cache-read / output token counts are tracked, without cost estimate or balance.

Q: How to switch between multiple DeepSeek accounts? Who gets billed next?

A: Add accounts (name + API key) in panel "Account Management". The switch writes to credential channel credentials.set('DEEPSEEK_API_KEY', ...). The llm-deepseek route resolves that credential per request, so the next LLM call bills to the new account without restart. If DEEPSEEK_API_KEY is also set in environment variables, the credential provider will refuse to overwrite, and the switch will fail with a prompt.

Q: Can the recharge link address be changed?

A: No. RECHARGE_URL = 'https://platform.deepseek.com/top_up' is hardcoded on host side and cannot be configured—this is intentionally designed as anti-phishing measure. First click shows popup to confirm the domain.

Q: The "Permanent Delete Session" switch is grayed out. How to enable?

A: This is a host capability, not something the plugin can implement independently. It requires the host DSH to actually implement session deletion path and broadcast data-dshw-capability-permanent-delete='true' to clients. Current official release lacks this capability, so the switch stays disabled. If you're a host developer, reference the integrations/dsh-session-delete/ suite to wire up the capability.

Q: Where is data stored? Does clearing current session data delete conversations?

A: Wallet data is stored in $DSH_HOME/storages/wallet.json, accounts in $DSH_HOME/storages/accounts.json, UI display content/scaling/layout etc. stored in browser localStorage. "Clear current session data" only clears token/cost counts for the current session, does not delete chat and session itself.

Q: Old dsh-wallet installed on the machine. How to clean up?

A: dsh-wallet was renamed to deepseek-harness-wallet in 0.1.1. Old package won't auto-uninstall and will compete with new package for same UI row. Run dsh plugin --profile web remove dsh-wallet then restart dsh web.

Q: Session cost (¥/$) seems not quite accurate?

A: Cost is estimated by "price at that moment" for each usage event as it hits the price list: v4 models have peak/valley tiers built-in (Beijing time 09:00–12:00 and 14:00–18:00 are peak, valley is half of peak). Historical calls' billing is not overwritten by new prices. Balance returned from official API is the authoritative value; estimates are for reference only.

Getting Started Difficulty

Beginner — one dsh plugin add + restart dsh web + hard refresh shows badge next to input field. Enter panel "Account Management" when you want to use multi-account or customize thresholds.

Known Issues & Limitations

  • Hard refresh required: Client half registers in window.__ModuleLoader__.load, loading happens at page load. After install/update, badge won't appear without hard refresh (AGENTS.md:23-25)
  • Multi-account conflicts with environment variables: If shell already has export DEEPSEEK_API_KEY, credential provider will refuse to overwrite, switch button reports error directly—unset the env var first then switch (README.md:43-44)
  • Permanent delete depends on host capability: Current official DSH release does not provide permanentDelete capability, UI switch stays disabled. Cannot fake it via config change. Wiring steps explained separately in integrations/dsh-session-delete/ (AGENTS.md:54-57)
  • Old package name residue: dsh-wallet versions before 0.1.1 won't auto-uninstall, need manual dsh plugin --profile web remove dsh-wallet to prevent two packages fighting for same row (README.md:93)
  • USD account cost is estimate: CNY price list converted at official long-term fixed exchange rate, badge clearly states "approx. $x". Exchange rate is not real-time, official balance is authoritative (README.md:42-43)
  • Recharge URL not configurable: https://platform.deepseek.com/top_up is hardcoded as anti-phishing design (README.md:138)

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/feibi-mochi/deepseek-harness-wallet)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory