npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-plugin-balance-english

v1.4.6

Published

DeepSeek / OpenCode Go / OpenAI credit floating widget: shows above the input box, supports DSH model-list sync, custom quota endpoints, drag & theme adaptation; built-in DSH session token usage stats (by day/month/model) with official peak/off-peak cost

Readme

dsh-plugin-balance-english

A floating LLM credit / quota widget for DeepSeek Harness Web — plus DSH session token usage and cost stats.

English

English — the English variant of the original Chinese plugin.


✨ Introduction

dsh-plugin-balance-english is a DSH (DeepSeek Harness) Web plugin that floats a small widget right above the input box. It can:

  • Query LLM account balance / plan usage: supports DeepSeek official, OpenCode Go, OpenAI, and any custom quota endpoint.
  • OpenCode Go: the main window directly shows 5h / weekly / monthly usage percentage badges (auto-colored by usage level: green → amber → red).
  • DSH session token usage stats: how many tokens your DSH chats consumed in total, accumulated per day / per month / in total and broken down by model, persisted to disk.
  • Cost estimation: estimates token usage cost with official rates from DeepSeek (peak/off-peak), Kimi, GLM, and others.

The widget is draggable, adapts to light/dark themes, and keeps a refresh button when collapsed into a small pill.

🖼 Preview

① Animation — hover to expand, move away to collapse (spring animation)

Animation

② Usage detail — OpenCode Go 5h / weekly / monthly usage and reset times

Usage detail

③ Token usage stats — today / this month / total + last-7-days bar chart + per-model stats + cost estimate

Token stats

④ In context — the floating widget inside the chat

In context

⑤ Balance type — auto-detects DeepSeek official balance vs plan (OpenCode Go) usage

Balance type

Features

| Area | What you get | | --- | --- | | Account type | DeepSeek official (/user/balance), OpenCode Go (/usage via host proxy), OpenAI credit_grants, or a custom quota endpoint synced from the DSH model list | | OpenCode Go display | 5h / weekly / monthly percentage badges in the main row; the collapsed pill shows only the percentage; the detail panel shows reset times | | Token usage | Today / this month / total token counts, a last-7-days mini bar chart, per-model breakdown (input / output / cache-hit) | | Cost estimate | ≈¥ badge (official rates: DeepSeek peak = off-peak × 2, Beijing 9:00–12:00 & 14:00–18:00; Kimi K2/K3 and GLM 4.x/5.x at constant rates; non-CNY official prices converted at 7.2) | | UX | Draggable with remembered position, click-outside collapses, theme-adaptive, refresh button on the pill too |

🚀 Install as a DSH plugin

The plugin is published to npm (dsh-plugin-balance-english) and ships a dsh.bundle manifest, so it installs with the standard DSH plugin command:

dsh plugin add dsh-plugin-balance-english           # default profile
# or explicitly the Web profile:
dsh plugin --profile web add dsh-plugin-balance-english

This resolves the npm package, writes the bundle entry, and enables the plugin. Restart dsh web (or hot-reload) and refresh the browser page.

🛒 Install from the plugin market (listed on dsh-market)

This plugin is listed in the awesome-dsh-plugin catalog and available on dsh-market, the plugin market built into DSH Settings. With dsh-market installed, search for dsh-plugin-balance-english under Settings → Plugin Market and install / upgrade with one click:

dsh plugin --profile web add dshmarket

Manual install (edit the profile yourself)

If you manage the profile yourself (offline environment / no dsh CLI):

  1. Add a dependency to your Web profile's package.json (e.g. ~/.dsh/profiles/web/package.json) — an npm version, a tarball, or a local path:

    "dependencies": {
      "dsh-plugin-balance-english": "^1.3.6"
    }
  2. Enable it in cordis.patch.yml (the package ships the exact entry as cordis.patch.yml):

    - insert:
        - id: plugin-balance
          name: dsh-plugin-balance-english
  3. Install and restart:

    cd ~/.dsh/profiles/web
    pnpm install
    # restart `dsh web`, then refresh the browser page

Requires the webServer and credentials services (provided by @deepseek-ai/dsh-web-app in the web profile). The host half depends on credentials, webServer, llm, settings, and sessions.

⚙️ Usage

Click the switch button to open settings:

  • DeepSeek official balance: the key can be left blank (auto-uses DSH's DEEPSEEK_API_KEY) or entered in the browser (stored in localStorage); a custom /user/balance base URL is supported.
  • OpenCode Go plan usage: nothing to fill in — auto-reads the DSH credential OPENCODE_GO_API_KEY (falls back to OPENCODE_API_KEY).
  • Custom quota endpoint: pick a vendor from the DSH model list (auto-fills baseURL and apiKeyEnv) or fill it in manually; secrets are resolved host-side and never sent to the browser.

Click the bar-chart button to open the Token usage panel: today / this month / total + last-7-days bar chart + per-model stats + cost badges.

🧮 Token usage & cost

The host half listens to the DSH session event stream (session/event), folds each request's reported token usage (cache-miss input + cache write, cache hit, output) by day / month / model, and persists it to ~/.dsh/storages/dsh-plugin-balance-english-usage.json.

  • Idempotent: a newer sample for the same turn:step replaces the earlier one; replaying logs after a reload / restart never double-counts.
  • Model attribution follows each request's request/header, so sessions that switch models mid-flight stay in the right bucket.
  • Cost uses each vendor's official rates (DeepSeek peak/off-peak; Kimi K2/K3 and GLM 4.x/5.x at constant rates, non-CNY prices converted at ~7.2), priced by the exact moment each sample occurred (see the note in the UI).
  • Served to the client at GET /api/dsh-plugin-balance-english/tokens.
  • Store format is version 9: legacy data is no longer estimated — it is rebuilt exactly by replaying the session event stream (including archived on-disk logs).

📄 License

BSD-3-Clause