Introduction¶
When running multi-route and multi-model configurations in DeepSeek Harness (DSH), token consumption is often dispersed across individual requests. Switching to separate reports or consoles to check costs interrupts the workflow. This article introduces the community plugin dsh-api-ledger (maintainer: LAwLi3tCoding). It aggregates usage within the conversation, settings page, below the Composer, and the sidebar, providing explainable cost estimates by route/model, and supports toggles for CNY/USD display.
What is this¶
dsh-api-ledger is positioned as a tool for recording API token usage within DSH and providing estimated costs (it does not generate invoices nor reflect account balances). Data and preferences are handled locally by the plugin; the README explicitly states that it does not read plain-text API keys or upload ledgers to any plugin-owned services.
- Repository: LAwLi3tCoding/dsh-api-ledger
- Community Directory: SkillHub Plugin Page
- Category: admin-security
- Current Package Version: 0.4.0 (MIT License)
- Environment Requirements: Node.js 20+; The README notes testing on DSH Desktop 2.0.13 / bundled DSH 0.1.5-rc.2, with no build step required and no runtime npm dependencies.
What the Four Views Answer¶
| View | Function |
|---|---|
| Conversation → API Ledger | How much was spent in this session: recent calls, model costs, token composition, and trends |
| Settings → API Ledger | Cross-session expenditure distribution: date ranges, yesterday vs. today comparison, pricing preferences |
| Below Composer | Cumulative usage/cost for the current session |
| Sidebar Footer | One-line summary for today; click to access the full report on the settings page |
CNY/USD is a display conversion (fixed at 1 CNY = 0.14 USD), not a live exchange rate. Calls are written to usage upon completion; visible views refresh approximately every 10 seconds; “Today” follows the client calendar.
Pricing and Routing¶
Pricing is configured separately by route (account) + model. The same model can have different prices on different routes, preventing contamination of estimates between official endpoints and gateways.
- Routes are tallied separately by default; you can set the same billing group for multiple routes to merge reports. Shared Key references do not silently merge accounts or imply shared balances.
- Each route can be priced for multiple models individually; if unconfigured, the default is Usage only (records tokens only, without fabricating costs).
- Three modes (Settings → API Ledger → Accounts and pricing):
- Price-book estimate: Binds to a price list (including optional peak/off-peak schedules; determined by the price list’s timezone at the start of the request).
- Custom price estimate: Set uncached input, output, cache read, and cache write per million tokens; currency and unit price can be set, and 0 is a valid value.
- Usage only: Records usage only.
The built-in price list deepseek-public-2026 (marked verified 2026-09-21 in the README) covers deepseek-flash, deepseek-v4-flash, deepseek-v4-flash-vision-exp, and deepseek-v4-pro. It includes peak/off-peak hours based on the Shanghai timezone and 2026 holiday rules. Any account can bind to it, though official DeepSeek endpoints bind to it by default only when identified as official URLs. Price lists are updated with plugin releases; there is no live pricing API.
Advanced users can add custom price lists in the tariffs section of $DSH_HOME/api-ledger/config.json (no UI editor currently), for example:
"tariffs": {
"acme-gateway": {
"label": "ACME gateway", "currency": "CNY", "timeZone": "Asia/Shanghai",
"verifiedAt": "2026-10-01", "source": "https://intranet.example/pricing",
"peak": { "days": "mon-fri", "windows": ["09:00-12:00"], "multiplier": 1.5 },
"holidays": { "2026": [["01-01", "01-03"]] },
"models": { "deepseek-v4-pro": { "inputPerM": 4, "outputPerM": 12, "cacheReadPerM": 0.4 } }
}
}
Binding example:
"pricing": { "corporate-gateway/deepseek-v4-pro": { "mode": "tariff", "tariff": "deepseek-public-2026", "window": "auto" } }
Historical calls retain the rate used at the time; price changes only affect subsequent requests. Unknown prices remain “unpriced” and will not show as 0 currency units.
Installation and Activation¶
The plugin runs with the permissions of the current DSH process; it is recommended to read the repository source code and MIT license before installing. SkillHub is a community directory site and is not officially affiliated with DeepSeek or Hithink RoyalFlush.
DSH Desktop (GitHub Installation)¶
The steps provided in the README are as follows. Installation links to the cloned directory, which must be retained; updates are applied via git pull followed by a restart.
git clone https://github.com/LAwLi3tCoding/dsh-api-ledger.git
cd dsh-api-ledger
node scripts/install.mjs
After restarting DSH Desktop, open Settings → API Ledger or use the API Ledger tab within a conversation. To uninstall a linked installation:
node scripts/install.mjs --uninstall
DSH CLI (Profile Management)¶
Replace web with the profile you actually manage. DSH 0.1.5-rc.2 reserves desktop for Electron; dsh plugin --profile desktop add ... will be rejected. For Desktop, use the method in the previous section or wait for marketplace availability.
# From GitHub
dsh plugin --profile web add github:LAwLi3tCoding/dsh-api-ledger
# From npm
dsh plugin --profile web add dsh-api-ledger
Typical Usage¶
- Complete installation and restart DSH.
- In Settings → API Ledger → Accounts and pricing, select a price list or custom unit price for each route/model, and click Save route.
- Send requests in normal conversation; view session cumulative totals below the Composer and today’s one-line summary in the sidebar.
- Open the in-conversation API Ledger to view session details; use the settings page API Ledger for cross-session comparison and currency display toggling.
Recent calls indicate the pricing source to facilitate verification of the estimation basis.
Use Cases and Notes¶
Suitable for: Developers or teams who need continuous visibility of tokens and estimated costs within the DSH workflow, require separate pricing for multi-route/multi-gateway setups, or wish to unify CNY/USD display.
Important to note:
- The figures are estimates, not service provider invoices, remaining quotas, or subscription fees; sums in some pricing instances include only known items.
- Display exchange rates are fixed and do not represent actual settlement currencies.
- Reset/delete only clears the ledger preferences for that route; it does not delete DSH model settings or historical call records.
Conclusion¶
dsh-api-ledger keeps usage capture and preferences within a local plugin, connecting “this conversation, this session, today, and global” through four entry points, while making estimates explainable by route/model. For more details, see the repository README and README.zh.md; installation and classification information can also be found on the SkillHub Directory Page.