enoughpower/dsh-desktop-mac--plugins-dsh-cost-meter ↗★ 1

dsh-cost-meter

DSH会话费用统计与多模型计费插件 支持多厂商模型计费、额度查询及峰谷提醒。适合需要精确控制和分析API成本的用户。

套件
dsh-cost-meter
相容性
待驗證
Harness 依賴範圍
^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.3-0 || ^0.1.5-0 || >=0.2.0-rc.1 <0.3.0-0
版本
1.7.45
授權
MIT
最近更新
2026年9月29日

同名套件的其他儲存庫

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:enoughpower/dsh-desktop-mac#b2baba7244038a6d32900613ef17af8884c0bf1c&path:plugins/dsh-cost-meter

dsh-cost-meter

English | 简体中文

Session cost tracking plugin for the DeepSeek Harness web GUI (bilingual UI)

Per-conversation cost · daily totals · OpenCode Go subscription quota display · budget with usage percentage · official account balance · custom provider balance · balance progress bar · history · peak/off-peak pricing hours display (peak hours UTC 01:00–04:00, 06:00–10:00; weekends and Chinese public holidays are off-peak all day, with separate labels) · pre-switch popup & system-notification alerts for peak/off-peak changes (position / lead time / alert type configurable) · one-click price sync from the official docs · Codex-style token usage heat grid · multi-vendor model pricing (built-in 90+ model price catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / Volcano Ark / Qwen / Xiaomi MiMo) plan/API dual-track billing (subscription quota vs pay-as-you-go money separated, per-1% & full-window token/equivalent-cost estimates with daily/weekly/monthly curves) · · quota strip above the input box (budget / Go / coding-plan usage in one row, toggleable)

version

v1.7.45 fixes composer dock layout and complete Token totals, and shows per-model session costs. See the release notes.

npm license dsh awesome · DSH plugin WhaleHarness audit


Promo art

Feature overview

FeatureLocationDescription
Per-model cost cardSidebar / composer dock (optional)Disabled by default; inline Top-N, Other totals, shares and optional tokens, Today / Last 90 days, remembered expansion and a Top-1 chip. See the guide
Per-conversation costBelow the composer / session title barLive accumulated cost + input/cache/output tokens; the composer footer shows cache hit rate before Input (cache reads / all input, including cache writes); position configurable
Official balanceSidebar top / Settings page (configurable)Total / granted / topped-up balance, auto-refresh + manual refresh; optional three-segment progress bar (blue/orange/gray), whose today segment only counts official-channel spend (coding plans / custom providers excluded)
Custom provider balanceSidebar / Settings page (configurable)Configurable HTTP balance lookup (e.g. LiteLLM); bilingual labels, currency, extract rules (dot path / number / add / subtract / divide — use divide for NewApi-style quota endpoints, see example); collapsible panel alongside Coding Plan quotas
OpenCode Go quotaSidebar / Settings / bottom-right dock (configurable)Rolling-5h / weekly / monthly usage percent and reset times, each window toggleable independently, budget used % can show alongside; key auto-discovered (dedicated ref / official Go route apiKeyEnv / env / opencode login) or entered manually
Coding plan quotasSidebar / Settings page (per vendor)Multi-vendor coding-plan quota queries (Anthropic Claude Pro/Max, Z.ai / Zhipu GLM Coding Plan, MiniMax Token Plan, Kimi Code weekly + 5-hour quotas with PAYG balance fallback when no subscription key, OpenRouter credits, SiliconFlow balance, CommandCode 5h/weekly windows + monthly credits balance, Xiaomi MiMo Token Plan plan/compensation credit windows + period-end reset + balance via console cookie); per-vendor enable switch, key, display position and refresh interval (sidebar card in the same box style as the Go quota; the collapsed rail shows percentages), official endpoints by default, with a configurable trusted MiniMax origin; neutral hints when no credentials/subscription; SCNet Token Plan supports external console snapshots; without a valid snapshot, monthly usage is estimated from the local ledger via the official credits deduction table (no credentials needed)
Quota stripAbove the input box (toggle in Display settings)One compact chip row for budget used % / the Go main window / each enabled coding-plan usage window (short label + mini progress bar, ≥80% warn, ≥100% over, hover for reset times); click any chip to refresh its data source (budget → state, Go → Go quota, vendor → all its windows); multiple windows of one vendor merge into a single segmented chip; a first-run guide card lets you decide whether to enable it; hides itself when there is no quota data
Click to refreshSidebar balance/quota boxesClick the official balance / custom balance / coding-plan box (collapsed rail included) to fetch the latest data immediately; the box pulses while refreshing, failures keep the previous value and surface the reason in the hover tooltip; keyboard Enter/Space also triggers; a one-time guide card appears after the update
Simple sidebar displaySettings → Cost → DisplayOptional, with a one-time choice after updating. Condenses cards and caps panel height at 38% of the viewport and 320 px, while preserving amounts, quotas, refresh actions and hover details. Turn off to restore your layout. Guide
Today's costSidebar bottom (above the settings button)“Today ¥x”, hover for call count and token details
Budget boxSidebar bottom (between the balance row and the settings button)Rounded-square frame: budget, used %, progress bar, today's cost & share of budget, used/limit; ≥80% warning, ≥100% over-budget
Summary cardsSettings pageToday / this month / cumulative cost and call counts
External usageSettings → CostRead-only snapshots from other processes on the same account; per-source tokens/calls/cost and recent days, plus DSH + external daily/monthly/all-time totals. Fresh external cost for today joins official balance reconciliation.
Token usage statsSettings page (Cost section)All-time token totals (input/cache/output/calls) + a Codex-style 26-week daily usage heat grid that fills the settings width; hover a cell for that day's detail
Token Plan usage statsSettings page (Usage)Per enabled coding plan (incl. Go): per-1% quota and full-window token / equivalent-cost estimates for the current windows (sample delta / live ratio), plus daily/weekly/monthly usage curves; plan-channel amounts are equivalent-only and never touch real money (issue #64)
Today's sessionsSettings pagePer-session call count, input/cache/output tokens and cost
HistorySettings pagePer-day totals; retention days configurable (default 180)
Pre-install history importAutomatic on first launchAfter install/upgrade, the first launch automatically replays all host session logs to import conversations from before the plugin was installed (missing dates are rebuilt whole; existing dates only gain previously unknown sessions; idempotent and never double-counts live metering; costs priced at per-event historical rates); a manual re-run entry remains in Settings
Budget settingsSettings page, topLimit, period (today / month / cumulative / custom date range), used %
Price tableSettings pagePer-model off-peak / peak prices (input/output shorthand supported; cache prices derived automatically); fully editable
Peak/off-peak hours displaySettings / budget / todayShows UTC peak hours 01:00–04:00 and 06:00–10:00 with the current tier; weekends and configured Chinese public holidays (Beijing dates) are off-peak all day, with separate labels; expanded view shows a period strip and countdown, collapsed view shows a vertical bar; independently toggleable
Peak/off-peak switch popup alertGlobal overlayA full-width bracketed popup appears when the next tier switch is within the configured lead time (default 2 minutes, 1–30), with an alert-colored badge distinguishing entering peak vs off-peak; position selectable (bottom-right / screen center), alert type selectable (entering peak / entering off-peak / both), one alert per switch point; optionally sends a browser (system) notification (so you still get alerted when the page is backgrounded; requires granting notification permission); configured in the peak pricing panel in Settings, with a one-click popup preview (rendered by the real component — copy, position and notifications exactly as they will fire)
Official price syncSettings pageFetches and parses the official pricing page, applies with one click; the official price currency is selectable (USD · English page / CNY · Chinese page) — CNY prices are booked at the display exchange rate and match the official CNY bill when displayed in CNY
UI languageSettings → Display settingsSimplified Chinese / English / Follow browser (auto); switches instantly and auto-saves
Hide official balance / hide today's costSettings → Display settingsTwo independent toggles: when on, the matching UI blocks (sidebar balance row & panels / today's cost row, budget details, overview today card) are not rendered at all; token and call-count stats stay visible — safe for screen sharing and screenshots
AI price syncpromptDeepSeek official sync; other providers use the verified official price catalog and manual configuration
Model & Plan adaptation guideadaptation docAdaptation matrix for per-model billing and the Coding Plan vendors, the auto-matching mechanism and price sources (中文)
Peak/off-peak alert guidealert docFully illustrated guide to the pre-switch popup and system notification: effect screenshots (EN/中文), settings reference and usage tips (中文)
Token Plan usage stats guidepanel docMeaning of the four columns in the per-1% & full-window panel, the end-to-end delta estimation method and precision tags, the scope boundary (dsh-made calls only) and usage curves (中文)
OpenRouter passthrough pricingpricing docToken reference prices: offline snapshot, scoped zero-cost backfill, public-catalog refresh, custom-price preservation and failure fallback (中文)
Multi-provider billingSettings / ledgerOpenAI, Anthropic, Google Gemini, Mistral and other providers with input/output, cache and reasoning-token pricing isolated by provider + model
Model-name auto-matchingSettings / ledgerUnknown model ids are matched against the price table: case/spaces/hyphens/dots and bracket annotations (e.g. (go)) are ignored — a normalized-equal or containing name hits (e.g. gpt5.6 luna(go)); router providers (opencode/zen etc.) search across all vendors; can be restricted to exact match, and unmatched models can be pinned to a specific entry in Settings
Extended price catalogSettings → Extended price catalogBuilt-in reference catalog grouped by vendor and model family (expandable; vendors collapsed by default); mount entries into billing with one click — mounted third-party models live inside the catalog and stay editable; a per-model “Show directly in Cost settings” toggle chooses which models (DeepSeek included) appear directly in the price table

Custom provider balance example (NewApi template)

POST with a JSON body: in Settings → Cost → Quota, expand a custom balance entry, select POST, then fill in Request body (JSON). For example, if the endpoint expects an account and returns {"data":{"balance":12.5}}:

{"account_id":"example-account","include_credit":true}

Set Extract rules (JSON) to {"remaining":"data.balance"}. Valid JSON is saved per entry and sent exactly as entered, including nested values and large integer IDs. Invalid JSON shows an error and keeps the last valid configuration; clearing the editor removes the body. GET/HEAD send no body while retaining it for a later switch back to POST. Content-Type: application/json is added automatically unless you supply a Content-Type header (any capitalization).

Existing request.body objects and raw strings remain supported. The body is ordinary saved configuration; {{VAR}} credential substitution applies only to request headers. For header authentication, use a reference such as {"Authorization":"Bearer {{MY_API_KEY}}"} and the credential input below it.

Display currency conversion: open Settings → Cost → Quota, expand a custom balance entry, and enable Convert USD balance to display currency. It defaults to off for each entry. Keep Source currency set to the endpoint's actual currency. With a USD balance of 54.3792, a CNY display rate of 7.2 and two decimal places, the balance displays as ¥391.53. Spend and API/manual limits convert together in the sidebar, settings and tooltips; progress percentages and stored balances do not change. Enter a manual limit in the source currency. The setting persists as convertToDisplayCurrency: true inside that customBalances[] entry (legacy customBalance is also supported).

The global exchange rate converts USD to the display currency. CNY/EUR source balances and Credits keep their original units; the switch is disabled for them. Alibaba Cloud balances use the currency returned by its API. No exchange-rate lookup or extra balance request is made when toggling this setting. Turning it off restores the original currency immediately.

DeepSeek CNY billing: USD prices × the display exchange rate and the official CNY table can give different amounts. Settings → Cost → Prices now explains this and provides a CNY selection button. See currency selection, sync and settlement timing.

For Qianwen / Alibaba Cloud fund accounts, use Add Qianwen / Alibaba Cloud balance to query available funds with a RAM AccessKey signature. The card uses the currency returned by the API. See the setup, permissions and balance definition.

Qwen Token Plan can use the official CLI subscription quota. Install the CLI on the DSH host and run qianwen auth login as the same OS user. Local estimates remain the default; CLI mode shows current account credits without changing the local ledger.

Local Qwen Token Plan credits include only the subscription providers qwen, qwen-tokenplan, qianwen-tokenplan, qwen-token-plan and qianwen-token-plan (case-insensitive, optional llm- prefix). Explicit API classifications are excluded. The qianwen pay-as-you-go provider does not consume estimated plan credits even when its model ID is identical. Use one of the supported subscription provider names; models outside the credits table need all three rates configured.

Xiaomi MiMo Token Plan quotas are queried with the MiMo console cookie, not an API key: log in at platform.xiaomimimo.com, press F12 → Network → find the balanceAlertConfig request and paste the full cookie request header into the MiMo card in Settings → Cost → Quotas (it must include serviceToken and userId; the DSH credenti