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, andmonthlyquota 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/monthlypercentages in order; missing windows are counted as0%. - 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-authCookie input. - API Key parsing priority is: Plugin configuration card > Process environment variables > “Settings → Model” Credential Store > Project
.envor.envunder$DSH_HOME. - Supports the
monitorinterface for the International version of GLM Z.AI and the Mainland version of GLM Zhipu. - Supports the official Kimi Code
/usagesinterface, and thekimi-authCookie can be used to enhance monthly membership quota. - Pure JS, zero build; installing from GitHub source code does not require configuring
allowBuildsinpnpm-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:
- Turn on the “Enable Plan Usage Badge” global switch.
- Turn on the switches for the plans you want to display.
- Fill in the API Key for the corresponding plan; if Kimi Code monthly membership quota is needed, fill in the
kimi-authCookie.
The location for placing API Keys can be:
- Plugin configuration card;
- Process environment variables;
- “Settings → Model” Credential Store;
- Project
.envor.envunder$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, andmonthlyquota windows as an independent plan channel; missing windows are counted as0%. - GLM Z.AI: International channel, uses the
monitorinterface to fetch data. - GLM Zhipu: Mainland channel, uses the
monitorinterface to fetch data; independently configured from GLM Z.AI. - Kimi Code: Uses the official
/usagesinterface; thekimi-authCookie is only used to enhance the monthly membership quota.
Notes on Kimi Code¶
- The
sk-kimi-xxxKey for Kimi Code is not compatible with the Kimi Open Platform’ssk-xxxpay-as-you-go Key. - The monthly membership quota interface corresponding to the
kimi-authCookie 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
weeklyand5-hourwindows. - 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