dsh-cost
中文
DSH plugin for the DeepSeek Harness: live conversation cost and DeepSeek account balance in the composer stats row. Currency follows the UI locale: RMB (¥) in the Chinese UI, USD ($) in the English UI.
Features
- Conversation cost: cumulative token usage over the whole session log × official DeepSeek pricing, shown as a live estimate —
¥ 0.0123 in the Chinese UI, $ 0.0018 in the English UI. Hover for the input/output/cache-read token breakdown and the pricing tier.
- Account balance: queries the official DeepSeek
GET /user/balance endpoint. A USD account is converted to RMB in the Chinese UI; a CNY account is converted to USD in the English UI (estimated rate, noted in the tooltip). Click to refresh, auto-poll every 60 s.
- DeepSeek only: the cost hides itself for non-DeepSeek models; without a configured API key the balance shows "余额 — / Balance —".
- Supported models:
deepseek-v4-pro / deepseek-v4-flash / deepseek-chat / deepseek-reasoner (other DeepSeek models are estimated with the v4-pro tier).
Install
npm install dsh-cost
Then mount it in the deployment's cordis.yml (or a profile's cordis.patch.yml):
plugins:
- name: 'dsh-cost'
The web client is composed automatically via the dsh.client declaration (platform: web); no further configuration is required.
Config
The Host half follows the llm-deepseek adapter settings ($DSH_HOME/settings.yaml):
| Setting |
Default |
Meaning |
llm-deepseek.apiKeyEnv |
DEEPSEEK_API_KEY |
Credential reference (environment-variable name) for the API key, resolved through the credentials service ($DSH_HOME/.credentials.yaml / environment / .env) |
llm-deepseek.baseURL |
https://api.deepseek.com |
Base URL of the balance endpoint |
Without an API key the balance shows "余额 — / Balance —"; the cost display is unaffected.
Pricing (USD, per 1M tokens)
| Model |
Input |
Output |
Cache read |
| deepseek-v4-pro |
$0.435 |
$0.87 |
$0.003625 |
| deepseek-v4-flash |
$0.14 |
$0.28 |
$0.0028 |
| deepseek-chat |
$0.28 |
$0.42 |
$0.07 |
| deepseek-reasoner |
$0.55 |
$2.19 |
$0.14 |
- Cache writes are billed at the input price (DeepSeek has no separate write fee).
- Official DeepSeek USD pricing (the v4 tiers match the deployment's bundled pi-ai data). In the Chinese UI the same tiers are displayed in RMB.
- Balance conversion uses the estimated rate 1 USD ≈ ¥6.79 (2026-08 central parity 6.7888). To follow official price or rate changes, edit the
PRICING table in lib/client.js and USD_CNY in lib/index.js.
Privacy
- The API key is resolved through the credentials service and used only to send the Bearer request to
api.deepseek.com — it is never logged, never placed on a command line, and never returned to the browser.
- The balance route lives on the harness web server's same-origin path
/api/plugins/dsh-cost/balance; responses carry balance numbers only (no key) with Cache-Control: no-store.
- The balance request runs inside the Host process (native
fetch), not through a sandboxed subprocess.
Limitations
- DeepSeek models and the official DeepSeek balance endpoint only.
- Balance conversion uses a hard-coded estimated rate, not a live rate.
- The cost is an estimate based on official pricing (token counts come from the Harness
tokenUsage projection; discounts and taxes are not included).
License
MIT © 2026 GiantGKL