Introduction

In the web plugin ecosystem of DeepSeek Harness (DSH), quota management for the mainstream development plans opencode.go and commandcode usually requires manually visiting the official websites or querying via the command line. lbwfff/dsh-usage-estimator is a dual-side plugin designed specifically for this purpose. It fetches data on the Host side and renders it on the Browser side, without deploying a separate process, and directly provides real-time usage bars and a model budget estimation table based on official pricing documentation in the DSH sidebar.

Plugin Overview

Plugin Name: lbwfff/dsh-usage-estimator

Maintainer: lbwfff

License: MIT

Core Value: Provides zero-config real-time quota monitoring and budget estimation for opencode.go and commandcode.ai.

Core Features

This plugin mainly provides the following capabilities:

  1. Real-Time Usage Bars: Displays rolling/weekly/monthly quotas for opencode.go and commandcode in the sidebar, and shows reset times.
  2. Model Budget Estimation: Based on official pricing documentation, generates a comparison table including the OpenCode Go and Command Code GOAT plans, showing the request budget for each model (per 5 hours/week/month).
  3. Full Language Support: The UI is fully localized and follows the DSH language setting (Simplified Chinese/English).
  4. Privacy Protection: Reading browser cookies is optional. When enabled, cookies are only sent to the official domains opencode.ai and commandcode.ai, and never leave the local machine. Third-party logging is not performed.
  5. Zero-Configuration Data Source: Request table data is fetched directly from official pricing documentation and does not require manual maintenance by users.

Installation and Enablement

To install this plugin, you must first ensure that pnpm is installed in the system path, then install it through the DSH plugin command.

  1. Install pnpm
    npm i -g pnpm
    # 或者
    corepack enable
  1. Install the Plugin
    dsh plugin --profile web add github:lbwfff/dsh-usage-estimator
  1. Restart DSH Web
    After the plugin is installed, it is automatically registered into dsh.bundle and cordis.patch.yml. You need to restart dsh web to make it take effect.

Configuration Guide

The plugin configuration is located in the Web profile patch file: ~/.dsh/profiles/web/cordis.patch.yml.

Under the config node, you need to set the following fields:

- insert:
    - id: dsh-usage-estimator
      name: dsh-usage-estimator
      config:
        # opencode.go 工作区 ID(必须设置以显示 OpenCode Go 额度条)
        opencodeWorkspaceId: wrk_xxxxxxxxxxxxxxxxxxxxxxxx
        # commandcode 每月信用上限(用于计算月度百分比)
        commandcodeMonthlyCap: 70
        # 是否读取浏览器 Cookie 以进行身份验证
        cookieEnabled: true
        # 当实时 API 不可用时,用于回退的 HAR 文件路径
        # harPath: /path/to/commandcode.ai.har

Field Descriptions

  • opencodeWorkspaceId: The workspace ID for opencode.go (format wrk_...). If left empty, the OpenCode Go usage bar display will be disabled.
  • commandcodeMonthlyCap: The monthly credit cap for commandcode. If not set, the monthly percentage will fall back to the cap reported by the API or be shown as unavailable.
  • cookieEnabled: Defaults to true. Setting it to false disables cookie reading. In this case, the real-time usage bar will be unavailable, but the request count table can still be displayed normally.
  • harPath: The default path is ~/.dsh-usage-estimator/commandcode.ai.har. This is an alternative data source when the real-time API cannot be accessed.

Privacy and Security

When cookieEnabled: true is enabled, the plugin reads browser cookies for opencode.ai and commandcode.ai.

  • Data Flow: Cookies are only sent to the two official domains above to fetch quota data and never leave the local machine.
  • Logging: The plugin does not perform any third-party logging.
  • HAR Fallback: If needed, users can manually export a HAR file through browser developer tools, and the plugin can read that file as a backup data source.

Architecture and Implementation

This plugin uses a “dual-side” architecture, where the Host side and the Browser side work together.

Host Side (lib/index.js)
* Registered as a Cordis plugin, it registers a precise /quota route on the DSH Web server’s webServer.
* This route calls a Python script (scripts/quota.py) via execFile to fetch data.
* The data is cached for approximately 120 seconds and then returned in JSON format.
* It does not require a separate process or port and shares the DSH server context.

Browser Side (lib/client.js)
* A React component loaded through window.__ModuleLoader__.load().
* Injected into the sidebar.footer.action slot at the bottom of the sidebar.
* Polls the /quota route periodically (every 10 minutes). A manual refresh is available via the ?force=1 parameter.
* Uses DSH’s native Modal component to display the request count table.

Data Processing (scripts/quota.py)
* Responsible for calculating the usage bars and the request count table.
* Fetches data from official pricing documentation (cached for approximately 6 hours).

Conclusion

lbwfff/dsh-usage-estimator aims to solve the quota management pain point for opencode.go and commandcode users. By combining official pricing data with the real-time API, it provides developers with a monitoring solution that requires no additional operations. The configuration is simple and privacy-focused, making it suitable for users who need to efficiently manage quotas for these two specific services in a DSH environment.

  • GitHub Repository: https://github.com/lbwfff/dsh-usage-estimator
  • Plugin Directory: https://www.skillhub.cn/plugins/lbwfff/dsh-usage-estimator