Usage & Billing
dsh-toolkit-vastunhu
Vast-Unhurried/dsh-toolkit/packages/dsh-api-balance · ★ 1
在会话消息区显示 DeepSeek API 余额(人民币)与每轮对话费用:余额徽章在会话头部操作行,本轮费用在每条回复的操作图标旁;不改动 DeepSeek Harness 核心。
An English summary is not available; the Chinese summary is shown.
安装
dsh plugin --profile web add 'github:Vast-Unhurried/dsh-toolkit#f86506fa5d1199cb21d3e49b6a1a850a6f1c9b11&path:/packages/dsh-api-balance'GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
For install and environment setup, plus plugin development tutorials, see DSH community docs ↗
README
Table of contents
- Plugin overview
- :memo: dsh-note — Native sticky notes
- :moneybag: dsh-api-balance — API balance & cost
- :brain: dsh-reasoning-levels — Third-party reasoning levels
- :wastebasket: dsh-session-delete — Delete sessions
- :dna: dsh-session-nav — Conversation node navigation
- :art: dsh-softui-skin — Neumorphism soft-UI skin
- Repository layout
- Install
- Uninstall
- Compatibility & security
- License
简体中文 | English
A collection of purely incremental native plugins for DeepSeek Harness: sticky notes, API balance & per-turn cost, reasoning levels, session deletion, conversation node navigation, and a soft-UI skin.
All six plugins follow the same principle: no modification of Harness core — everything is injected through official slots and dedicated API routes (dsh-session-nav is a pure client plugin that only reads official DOM contracts and has no host route), and uninstalling fully restores the original state. Every plugin follows the official plugin rules: bundle manifests (dsh.bundle.patch) + client declarations (dsh.client), the official Cordis plugin form (name/inject/apply + ctx.effect lifecycle), the official client-module form (__ModuleLoader__ + exports.inject/apply) and official slots; all host-side tunables are exposed through Schemastery Config schemas (profile cordis.yml), see each plugin README's "Configuration (Config)" section.
Plugin overview
| Plugin | What it does | Where it lives |
|---|---|---|
| :memo: dsh-note | Native sticky notes: create / history / draggable window / double-click history entries to edit with autosave | Input toolbar (right of the Full access selector) |
| :moneybag: dsh-api-balance | API balance + per-turn cost + today's usage (¥ / tokens, peak-off-peak pricing, per-vendor stats) | Session header actions + each assistant reply |
| :brain: dsh-reasoning-levels | Five-tier reasoning effort (low / medium / high / xhigh / max) for third-party models | Official model selector |
| :wastebasket: dsh-session-delete | "Delete session" action that cleans up session data thoroughly | Session list ⋮ menu |
| :dna: dsh-session-nav | Conversation node navigation: one bar per user turn — hover preview / click to jump & pin to top / double-click to pin | Right edge between text column and scrollbar (always resident) |
| :art: dsh-softui-skin | Neumorphism soft-UI skin: one native toggle; light/dark follows the native appearance; state persists across refresh/restart (derived from Lhy723/dsh-neu-theme) | Settings → General → Appearance |
:memo: dsh-note — Native sticky notes
- A small round button in the input toolbar, styled like the surrounding icons (28×28, follows the theme)
- Opens as a new note; clicking Save archives it into history (max 30 entries); unsaved content is kept as an auto-saved draft when the popup closes
- The history window is an independent popup: freely draggable and resizable, and it remembers the last position and size; expanding an entry reveals a Copy button; entries can be deleted individually
- Double-click an expanded entry to edit it inline: autosaves ~0.6 s after you stop typing (shows "已自动保存"); the entry keeps its position and no keystrokes are lost; press ESC to finish editing
- Text limit 16,000 chars; data persists to
$DSH_HOME/storages/dsh-note.json(atomic writes, serialized)
:moneybag: dsh-api-balance — API balance & cost
- Balance badge in the session header: shows the balance of the current model's vendor — the official DeepSeek balance endpoint (labeled 高峰 / 闲时 peak/off-peak by Beijing time, aligned with the official windows: Mon–Fri 9:00–12:00 / 14:00–18:00 peak, weekends off-peak all day), a third-party balance endpoint, or local accounting (total − spent)
- Vendor manager (double-click the badge): add / edit / delete vendors, each holding multiple models sharing one balance pool; per-model rates for input / output / cache-read / cache-write (CNY per million tokens)
- Per-turn cost: each finished assistant reply shows
本轮 ¥x.xxxx, priced with official peak/off-peak rates or custom rates; hover shows cache hit rate and consumed tokens (K/M tok) - Today's usage: hovering the badge shows today's (Beijing time) consumption of the current vendor — official DeepSeek routes and their derived channels (e.g. vision-toolkit) are merged into one vendor, matching the DeepSeek usage page; third-party vendors are tracked separately and switch along with the badge
- Switch-aware: switching sessions or switching to another vendor's model updates the badge immediately; switching models within the same vendor keeps it unchanged
- The API key is reused from Harness' credential service (
DEEPSEEK_API_KEYin~/.dsh/.credentials.yaml); the key never reaches the browser
:brain: dsh-reasoning-levels — Third-party reasoning levels
- Offers five tiers — low / medium / high / xhigh / max — for third-party (pi-ai) models in the official model selector; models with tier support default to Max (highlighted on selection; requests go out as Max unless changed)
- On boot, automatically declares the five tiers for undeclared third-party models (idempotent); supported and unsupported models can mix inside one vendor —
reasoningEfforts: falsemodels show no tier UI, send no effort parameter, and keep the vendor default - Official models keep their official three tiers (low / high / max) and are never touched
- Ships host-side helpers:
getSessionModel/setReasoning/setModel/levels(model selection, tier diagnostics and switching)
:wastebasket: dsh-session-delete — Delete sessions
- Adds Delete session to the session list ⋮ menu, removing the session thoroughly: JSONL session log, workspace registration and archive collection
- Only cold sessions are deleted: running sessions are refused (stop/close first) to avoid races with the persistence write path
- Strict session-ID validation; on-disk paths use the exact same encoding as the core backend, deletion targets are verified inside the storage root (including symlink protection); a missing storage root refuses deletion instead of silently succeeding
- Duplicate titles refuse to guess (no wrong-session deletion); a confirm dialog shows the session ID
:dna: dsh-session-nav — Conversation node navigation
- An always-resident bar at the right edge, between the text column and the scrollbar: one pill per user turn (9×3 fully-rounded capsule, white in dark mode / black in light mode, theme-aware), max 6 visible at once — wheel over the bar scrolls the rest like a bicycle chain
- Hover: pill smoothly lengthens + preview card with the round's full content (internally scrollable); single click: smooth jump to that round + the top box shows its full content; double click: pin / unpin (highlight only, no dot, unlimited pins, persisted in localStorage); the active pill (DeepSeek blue) follows your reading position and auto-scrolls into view
- Follows the current session: switching sessions shows that session's turn count immediately; uncompressed content shows right away, compacted history preloads slowly in the background (one page per 2.8 s, only when idle, never queued); clicking an unloaded round page-loads it on demand
- Top box: frosted transparent glass (
blur(24px)+ 40% theme background), width = text column + 2.5 cm on each side, height grows with content (up to 70vh), keeps its frost while scrolling - Pure client plugin: only reads official DOM contracts (
data-chat-flow/data-conversation-scrolletc.) + thesessionsservice — no host API route, no core state touched, uninstall fully restores
:art: dsh-softui-skin — Neumorphism soft-UI skin
Derived from Lhy723/dsh-neu-theme (MIT): the skin styles and palettes follow the original project; this plugin turns its three-way selector into a system-native toggle and adds robustness fixes.
- A system-native toggle in Settings → General → Appearance (right below the built-in Appearance row), styled with the harness's own design tokens (
role="switch", theme-aware in both schemes) - ON: applies the skin — light (cream) / dark (ink-blue) follows the native appearance — native dark gives the dark skin; when the native preference is "system", the skin follows OS light/dark switches automatically
- OFF: the page is exactly as the harness ships it — no injected styles, no body marker, no leftover token overrides
- Persists: the toggle lives in localStorage (
dsh-softui:enabled, legacy key auto-migrated and cleaned up); refresh / close / restart never revert to the native look while the toggle is on - No core changes: colors stack as a token override layer via the built-in ThemeRuntime
overrideTokens()(never writes theui-themepreference orsettings.yaml); shadow/frost/grain styles are plugin-owned<style>scoped underbody[data-dsh-softui]; cross-tabstoragesync; all 103 theme tokens validated at build time
Repository layout
dsh-toolkit/
├── packages/
│ ├── dsh-note/ # sticky notes
│ ├── dsh-api-balance/ # balance & cost
│ ├── dsh-reasoning-levels/ # third-party reasoning levels
│ ├── dsh-session-delete/ # session deletion
│ ├── dsh-session-nav/ # conversation node navigation
│ └── dsh-softui-skin/ # soft-UI skin
├── pnpm-workspace.yaml # pnpm monorepo
└── README.md
The six packages are independent: install / update / remove each one separately. The repo root itself is also an installable bundle (dsh.bundle declared) — one command installs all six.
Install
Requires DeepSeek Harness v0.1.0-rc.7+ (Web UI; tested on Windows) and pnpm ≥ 9 (git subfolder syntax).
Option A (recommended) — one-shot family install: the repo root is a proper bundle now.
# Straight from GitHub (no clone needed)
dsh plugin --profile web add "github:Vast-Unhurried/dsh-toolkit"
# Or clone, then install from the repo root
git clone https://github.com/Vast-Unhurried/dsh-toolkit.git
cd dsh-toolkit
dsh plugin --profile web add file:.
Do not install individual packages on top of the family bundle (duplicate rows).
Option B — install individual packages only
# Straight from GitHub (no clone needed)
dsh plugin --profile web add "github:Vast-Unhurried/dsh-toolkit#path:packages/dsh-session-nav"
dsh plugin --profile web add "github:Vast-Unhurried/dsh-toolkit#path:packages/dsh-note"
dsh plugin --profile web add "github:Vast-Unhurried/dsh-toolkit#path:packages/dsh-api-balance"
dsh plugin --profile web add "github:Vast-Unhurried/dsh-toolkit#path:packages/dsh-reasoning-levels"
dsh plugin --profile web add "github:Vast-Unhurried/dsh-toolkit#path:packages/dsh-session-delete"
dsh plugin --profile web add "github:Vast-Unhurried/dsh-toolkit#path:packages/dsh-softui-skin"
# Or clone, then install from local paths
git clone https://github.com/Vast-Unhurried/dsh-toolkit.git
cd dsh-toolkit
# 2. Install plugins (only the ones you need)
dsh plugin --profile web add file:./packages/dsh-note
dsh plugin --profile web add file:./packages/dsh-api-balance
dsh plugin --profile web add file:./packages/dsh-reasoning-levels
dsh plugin --profile web add file:./packages/dsh-session-delete
dsh plugin --profile web add file:./packages/dsh-session-nav
dsh plugin --profile web add file:./packages/dsh-softui-skin
Adjust
--profile webto your actual profile;file:supports relative paths — run from the repo root.
Restart the dsh service after installing, then hard-refresh the browser (Ctrl+Shift+R).
Uninstall
# Family-bundle install: remove the whole bundle in one go
dsh plugin --profile web remove dsh-toolkit
# Individual installs: remove each one
dsh plugin --profile web remove dsh-note
dsh plugin --profile web remove dsh-api-balance
dsh plugin --profile web remove dsh-reasoning-levels
dsh plugin --profile web remove dsh-session-delete
dsh plugin --profile web remove dsh-session-nav
dsh plugin --profile web remove dsh-softui-skin
Uninstalling fully restores the original state. Note data ($DSH_HOME/storages/dsh-note.json) is kept by default — delete the file manually if you want it gone; after removing dsh-reasoning-levels, you may clean the reasoningEfforts / reasoning / compat.supportsReasoningEffort fields the plugin wrote under llm-pi-ai in settings.yaml.
Compatibility & security
- Client only consumes official slots:
conversation.input.left,conversation.session.header.actions,conversation.chat.assistant-actions,settings.general.item, etc. (dsh-session-navis pure client: it only reads DOM contracts and thesessionsservice, mounts no slot;dsh-softui-skinis pure client too: only thesettings.general.itemslot and the theme service, no host route) - Host only adds dedicated API routes (
/plugins/dsh-note/api,/plugins/api-balance/api,/plugins/reasoning-levels/api,/plugins/session-delete/api); no core state is modified or subscribed. - All API routes enforce same-origin checks (loopback Host + exact Origin/Host match), rejecting cross-site and DNS-rebinding requests.
- No telemetry; no sensitive data beyond credentials is read; nothing is sent to third parties.