Introduction

When using DSH, if multiple plan channels are configured, quota windows are often scattered across different services. dsh-plan-usage is a DSH plugin that centralizes the display of the 5-hour, weekly, and monthly quota windows for OpenCode Go, GLM Z.AI, GLM Zhipu, and Kimi Code in the bottom-right corner of the Web dialog box, reducing the steps required to manually switch consoles.

Plugin Positioning

dsh-plan-usage is provided by chendefine with an MIT license. After installation, it displays plan usage badges in the bottom-right corner of the Web dialog box and provides a “Plan Usage” configuration card in “Settings → Plugins → Plugin Configuration”.

Core Capabilities

  • Display plan usage badges in the bottom-right corner of the Web dialog box.
  • Continuously display the 5-hour, weekly, and monthly quota windows for each plan.
  • Currently supports four plans (channels): OpenCode Go, GLM Z.AI, GLM Zhipu, and Kimi Code.
  • Badge style is multi-line: one line per plan, listing 5-hour / weekly / monthly percentages in order; missing windows are counted as 0%.
  • Status dots at the start of each line are graded based on the worst window for that plan: <50% Green, 50–89% Yellow, ≥90% Red.
  • Click the badge to expand a panel that displays progress bars and reset countdowns grouped by plan, refreshing automatically every 60 seconds.
  • A “Plan Usage” card appears in “Settings → Plugins → Plugin Configuration”, providing a global switch, individual plan switches, API Key input fields, and Kimi Code kimi-auth Cookie input.
  • API Key parsing priority is: Plugin configuration card > Process environment variables > “Settings → Model” Credential Store > Project .env or .env under $DSH_HOME.
  • Supports the monitor interface for the International version of GLM Z.AI and the Mainland version of GLM Zhipu.
  • Supports the official Kimi Code /usages interface, and the kimi-auth Cookie can be used to enhance monthly membership quota.
  • Pure JS, zero build; installing from GitHub source code does not require configuring allowBuilds in pnpm-workspace.yaml.
  • No modification to harness source code is required to install this plugin; keys are write-only, and the interface response does not return key values.

Installation

Install from GitHub source code to the web profile:

dsh plugin --profile web add "github:chendefine/dsh-plugins-plan-usage"

If you wish to use an npm package and lock the version, you can also use:

dsh plugin --profile web add dsh-plan-usage@0.2.1

After installation, check the configuration layer:

dsh --profile web --dump-config

After confirming that the output contains the # == dsh-plan-usage layer, start Web:

dsh web

If debugging in the source code directory, you can also start using the patch method:

dsh web --patch ./cordis.patch.yml

Enabling and Configuration

Open “Settings → Plugins → Plugin Configuration”, find the “Plan Usage” card, and usually perform three things first:

  1. Turn on the “Enable Plan Usage Badge” global switch.
  2. Turn on the switches for the plans you want to display.
  3. Fill in the API Key for the corresponding plan; if Kimi Code monthly membership quota is needed, fill in the kimi-auth Cookie.

The location for placing API Keys can be:

  • Plugin configuration card;
  • Process environment variables;
  • “Settings → Model” Credential Store;
  • Project .env or .env under $DSH_HOME.

Among these, the plugin configuration card has the highest priority. If no usable Key is configured for all channels, the badge and panel will prompt for configuration.

Plan Description

  • OpenCode Go: Displays 5-hour, weekly, and monthly quota windows as an independent plan channel; missing windows are counted as 0%.
  • GLM Z.AI: International channel, uses the monitor interface to fetch data.
  • GLM Zhipu: Mainland channel, uses the monitor interface to fetch data; independently configured from GLM Z.AI.
  • Kimi Code: Uses the official /usages interface; the kimi-auth Cookie is only used to enhance the monthly membership quota.

Notes on Kimi Code

  • The sk-kimi-xxx Key for Kimi Code is not compatible with the Kimi Open Platform’s sk-xxx pay-as-you-go Key.
  • The monthly membership quota interface corresponding to the kimi-auth Cookie is reverse-engineered and unofficial, and may change at any time.
  • Failure to obtain data only affects the monthly limit line and does not impact the weekly and 5-hour windows.
  • The Cookie will expire; after expiration, the panel will prompt “Failed to get monthly membership quota”.
  • All logged-in devices and API Keys share the same quota.

Environment Variables and Key Notes

Process environment variables take precedence over the “Settings → Model” Credential Store. If the variable with the same name already exists in the process environment where the harness is started, saving the credential in the Model page will be rejected; the Key in the plugin configuration card has the highest priority and is not subject to the restrictions of saving in the Credential Store.

Keys are all write-only: the interface response will not return the key value, and the browser side can only see “Configured” or “Not configured”.

Use Cases and Installation Check

Suitable for developers who use OpenCode Go, GLM Z.AI, GLM Zhipu, or Kimi Code simultaneously and wish to view quota windows without leaving the DSH Web dialog box. A valid plan API Key is required before use.

As a DSH plugin, it runs with the permissions of the current dsh process. It is recommended to check the source code and the MIT license before installing.

Related Resources

GitHub repository:

https://github.com/chendefine/dsh-plugins-plan-usage