DSH (DeepSeek Harness) extends its functionality through a plugin mechanism. During development or usage, managing the usage and balance of third-party API resources (such as CommandCode) often requires opening a web page or a separate dashboard. The dsh-commandcode-usage plugin solves this pain point by directly integrating CommandCode API usage, credit limits, and recurring statistics into the DSH sidebar.

The plugin was developed by zouxiaoyang and is released under the MIT license. It provides a refined card-style panel for real-time monitoring of API consumption.

Core Features

The plugin provides a unified entry point at the bottom of the sidebar, with the following data display and interaction capabilities:

  • Sidebar entry: A “⚡ Usage” button is displayed at the bottom of the sidebar, to the left of the Settings button. Clicking it opens the panel; when the sidebar is collapsed, the icon is displayed automatically.
  • Usage overview: Displays request count, success rate, token consumption, and total cost.
  • Quota periods: Visually displays monthly quota, 5-hour window, and weekly window. Progress bars intuitively show remaining space.
  • Reset time: Each period lists a reset time below it (for example, “Reset today 23:59”), making it easy to plan usage.
  • Account information: Displays plan information, subscription status, and billing period.
  • UI adaptation: Refined card UI (gradient header, plan badge, colored percentage pill) that automatically follows the light/dark theme of DSH.
  • Billing logic: Monthly quota is calculated within the current billing period and does not carry over to the next period.

Installation and Enablement

Install it using DSH’s command-line tool. Make sure DSH is installed in your environment and the corresponding Profile is configured.

dsh plugin --profile web add dsh-commandcode-usage

After installation, restart DSH or refresh the page to apply the changes.

Configuration

The plugin is configured through the config field in cordis.patch.yml. By default, it attempts to load the configuration automatically.

- id: dsh-commandcode-usage
  name: 'dsh-commandcode-usage'
  config:
    # API key(可选,默认自动从环境变量/配置文件读取)
    apiKey: 'your-commandcode-api-key'
    # API 基础地址(可选,默认官方)
    apiBase: 'https://api.commandcode.ai'
    # 环境变量名(可选,默认 COMMANDCODE_API_KEY)
    apiKeyEnv: 'COMMANDCODE_API_KEY'

API Key Resolution Priority

The plugin looks for the API Key in the following order:

  1. Plugin config.apiKey
  2. Environment variable (default: COMMANDCODE_API_KEY)
  3. COMMANDCODE_API_KEY in ~/.dsh/.credentials.yaml
  4. launchctl getenv COMMANDCODE_API_KEY
  5. Other common configuration files

Usage

After enabling it, there are two main ways to view the data:

  1. Sidebar panel: Click the “⚡ Usage” button at the bottom of the sidebar, to the left of the Settings button.
  2. Chat command: The commandcode_usage tool is registered, so you can enter the command directly in chat:
    查询我的 CommandCode 用量

Notes

  • Permissions: The plugin runs with the permissions of the current DSH process. Make sure the DSH process has the necessary permissions to access the CommandCode API.
  • Source code review: Before installing a plugin from an unknown source, it is recommended to review its source code and license (MIT).
  • Version requirement: Node.js environment version >= 18 is required.

Directory and Source Code