편집자 노트

Token 成本

Live token cost + account balance readouts for the DeepSeek Harness Web chat UI.

이것은 DeepSeek Harness(DSH) 플러그인입니다. 이 사이트는 GitHub README, 설치 정보, 유지보수 상태, 공개 보안 시그널을 모아 보여줍니다.

업스트림에서 중국어 README를 제공하지 않아 저장소 원본 내용을 표시합니다.

dsh-token-price

Live token cost + account balance readouts for the DeepSeek Harness Web chat UI.

What it shows

  • Per-turn cost — a ¥ figure after each assistant reply's stats line (01:27 · 用时 · 首 token · tok/s), revealed on the same hover.
  • Total cost — the running session cost under the composer's stats line, summed per turn at each turn's own peak/off-peak rate.
  • Account balance — your DeepSeek account balance (CNY) from GET /user/balance.

Prices are the official DeepSeek USD rates (peak/off-peak, cache-hit aware) bundled in src/prices.ts; the browser converts to ¥ with a live USD→CNY rate.

Install

One command (requires pnpm):

dsh plugin --profile web add dsh-token-price

The package declares dsh.bundle + dsh.client, so this installs and activates both halves in one step: the host half (balance service + tokenCost projection) and the browser half (the readouts).

Configuration

- id: token-price
  name: dsh-token-price
  config:
    balanceBaseURL: https://api.deepseek.com
    balanceApiKeyEnv: DEEPSEEK_API_KEY
    balanceRefreshIntervalMs: 60000
    requestTimeoutMs: 5000

balanceApiKeyEnv names the credential holding your DeepSeek API key (the same one the dsh-llm-deepseek adapter uses). The balance reads "未获取" until the key is set; failures are logged with ctx.logger.

Pricing

Per-model prices (src/prices.ts / prices.json) mirror the official page (Models & Pricing):

  • schema v2, USD per 1M tokens, with peak / offPeak periods;
  • peak windows in Beijing time: 09:00–12:00 and 14:00–18:00 (off-peak is half price);
  • each period prices cache-hit input, cache-miss input, and output separately.

The USD→CNY rate is fetched live in the browser (open.er-api.com, then frankfurter.app — both free and CORS-enabled), cached in localStorage for 6 hours, with a bundled fallback constant.

How it works

  • The host registers a tokenCost session projection that folds per-turn disjoint token usage (uncached / cache-read / cache-write / output) from the durable session log, so per-turn cost stays exact across model switches and compaction.
  • The browser bills each turn at its own time's peak/off-peak price, converts with the live rate, and renders ¥.
  • The balance is fetched host-side (the key never reaches the browser) and rides the projection.

Development

npm install
npm run build   # esbuild bundles + tsc declarations -> lib/

After changing source, rebuild and restart the DSH web process (the profile links this package and loads the lib/ artifacts).

License

MIT

REPOSITORY SIGNALS

보안 및 설치 증거

이 점수는 공개 저장소 메타데이터와 이 사이트에 등록된 설치 증거에만 기반하며, 코드 보안 감사와 다릅니다.

출처 추적 가능

공개 플러그인 카탈로그에서 왔으며, 공개 GitHub 저장소로 연결됩니다.

라이선스

저장소가 MIT 라이선스를 선언했습니다.

유지보수 활동

최근 180일 내 코드 업데이트가 있습니다.

설치 증거

재현 가능한 정확한 설치 메타데이터가 아직 등록되지 않았습니다. 저장소 설명에 따라 직접 확인하세요.

설치 라이프사이클 스크립트

검사한 패키지 메타데이터에 설치 라이프사이클 스크립트가 선언되지 않았습니다.