dsh-plugin-deepseek-clock
DiscoveredDeepSeek price clock and balance for DeepSeek Harness: a composer chip shown only while a DeepSeek route is selected — peak/off-peak price window (green/red, Beijing hours) plus the topped-up balance
dsh-plugin-deepseek-clock — DeepSeek price clock and balance for DeepSeek Harness
A contextual meter in the composer tool row, next to the model selector. It is
rendered only while the session's selected provider is a DeepSeek route
(deepseek-official, deepseek-account, …); with any other provider the row is
untouched.

The chip shows a price dot and the API balance:
- dot — green = off-peak (half price), red = peak;
- text — the balance:
$12.34from the API key, or$14.46from the signed-in account's Platform wallets;loginwhen the account is signed in but its wallets cannot be read;no keywhen neither route is available.
The popover adds the window schedule, the next switch, the per-1M rates of the current window, the topped-up/granted balance and the account state.
Three facts, three sources
| Fact | Source |
|---|---|
| price window | computed locally — no network |
| balance | GET https://api.deepseek.com/user/balance with DEEPSEEK_API_KEY |
| account | the deepseek-account-platform/* grant record, and its Platform wallets |
Price window
DeepSeek bills half price outside peak hours. Peak is Beijing time (UTC+8), Monday–Friday 09:00–12:00 and 14:00–18:00; everything else — nights, weekends — is off-peak (official pricing page). Chinese public holidays are off-peak too, but they are not tracked here, so a holiday Monday reads as peak.
The popover lists the published rates for the current window (CNY per 1M tokens, USD when the balance is in USD):
| per 1M | cached | input | output |
|---|---|---|---|
| Flash (off-peak / peak) | 0.02 / 0.04 | 1 / 2 | 4 / 8 CNY |
| Pro (off-peak / peak) | 0.15 / 0.30 | 4.5 / 9 | 13.5 / 27 CNY |
Balance
Two routes, two sources, one number on the chip:
API key — DEEPSEEK_API_KEY is resolved the way DSH resolves provider keys:
ctx.credentials first, then the environment, then the refs block of
$DSH_HOME/.credentials.yaml. GET https://api.deepseek.com/user/balance returns
{is_available, balance_infos:[{currency, total_balance, granted_balance, topped_up_balance}]}.
Account (device login) — the stored grant in
deepseek-account-platform/default (a token plus its issuer) is sent as
x-dsh-auth-token to GET https://platform.deepseek.com/api/v0/users/get_user_summary
— the very call the app's own Settings card uses. The payload is wrapped twice:
data.biz_data.normal_wallets is the topped-up balance and bonus_wallets the
granted one, both {currency, balance} string pairs. The token never leaves the
host process, and the request is only made when the grant's issuer matches the
configured platformOrigin.
The API key wins when both exist. Readings are cached for a minute, and a failed
refresh keeps the last good value marked stale. With neither route the chip says
no key; a signed-in account whose wallets cannot be read says login.
Account
The login state is read from the credential records
(deepseek-account-platform/default, …/device): their presence means the
device login is stored. Nothing is requested from the network for this.
Route
GET /api/deepseek/meter[?refresh=1]
→ { ok, price, account, api, rates, fetchedAt }
apiBase (default https://api.deepseek.com) can be overridden in the row config.
Install
DSH Desktop: Settings → Plugins → add plugin, type the package name. From the
CLI: dsh plugin --profile <your-profile> add <name>, then restart the harness.
name: dsh-plugin-deepseek-clock
Checks
node test/smoke.mjs # price windows at fixed instants, balance route, account detection, chip visibility
node test/preview.mjs # renders the chip + popover for a screenshot
The smoke test pins the clock (2026-10-26 is a Monday) and asserts the window boundaries in Beijing time, the balance normalisation, the one-minute cache, the stale fallback, the no-key case, and that the chip renders nothing for a non-DeepSeek provider.
Client-runtime notes (found the hard way)
Two details of the client plugin API are easy to get wrong; both make the chip silently disappear:
injectreceives the session id (a string), not a props object. The slot hands it the id itself, soinject: ({ sessionId }) => …destructures a string and yieldsundefined.- Register the surface inside
ctx.inject(["slots", "modelDirectories"], scope => …)and declareremote.sessionininject. Resolving a session's model directory reaches the session scope's wire face; without the dotted service name everydirectoryFor()call throwscannot get property "remote.session" without inject, which a try/catch turns into "no provider ⇒ render nothing".
The directory is read through directory.store (SnapshotStore:
subscribe/getSnapshot), the same object the composer's model seat uses.
Limits
- Public holidays are not modelled.
- One balance currency is shown on the chip; the popover shows the first entry the API reports.
- The account route reads the Platform wallets, not a spend history: per-request costs stay in the Platform's "View usage" page.
Comments
Loading…
Similar plugins
by geokkjer
DeepSeek API peak/off-peak pricing indicator: a live composer pill (red during peak, green off-peak) with a countdown to the next switch, plus a dsh_peak_status tool the agent can call to warn about cost.
★ 0
MIT
JavaScript
Sep 22, 2026
dsh plugin --profile web add dsh-peakby VviLliAm-qwq
Peak/off-peak billing clock with live DeepSeek balance and per-turn cost above the dsh-tui prompt, plus an optional flashing peak-hour warning frame.
★ 3
MIT
JavaScript
Sep 16, 2026
dsh plugin --profile web add dsh-peak-balanceDeepSeek Harness usage analytics dock on the composer: Beijing-time peak/valley pricing with all-day weekend valley rate, live balance, cross-session history, by-date drill-down and charts.
★ 0
dsh plugin --profile web add @deepseek-ai/dsh-client-ui-usageby zi7tian
DeepSeek Harness (dsh) web plugin: shows whether DeepSeek API pricing is peak or off-peak, plus a countdown to the next switch, below the composer.
★ 0
MIT
JavaScript
Oct 9, 2026
dsh plugin --profile web add dsh-deepseek-billing-periodby davidgereb
Cost overview, peak/off-peak hours indicator, balance on dashboard, off-peak scheduling for DeepSeek Harness.
★ 0
MIT
JavaScript
Aug 21, 2026
dsh plugin --profile web add dsh-plugin-cost-lensby hg1048596-pixel
DeepSeek Harness (dsh) plugin: show the current DeepSeek price tide (peak 梁文峰 / off-peak 梁文谷) and a countdown to the next price switch. Weekdays peak 09:00-12:00 & 14:00-18:00; weekends and Chinese st
★ 0
MIT
JavaScript
Oct 3, 2026
dsh plugin --profile web add dsh-price-indicator