DeepSeek Harness Plugin: Qwen AI Platform Quota Sidebar Component

Preface

DeepSeek Harness (DSH) adopts a “everything is a plugin” architecture, where all functionality is delivered through plugins. When working with the Qwen AI platform, we often need to check the remaining quota of a Token Plan, but the official console does not expose an API endpoint—only manual browsing after login is available. The dsh-qwen-plan-usage plugin displays the remaining quota in the sidebar, provides a /qwen-plan command for quick lookups, and guides the assistant to automatically extract Cookies from the browser when none are configured, eliminating the need for manual copy-paste.

What Is This

dsh-qwen-plan-usage is a DSH client plugin that displays the remaining Token Plan quota information for the Qwen AI platform in the DSH sidebar and provides a /qwen-plan chat command for quick queries. Maintained by jasocheung, it is released under the MIT license, current version 0.2.1.

The core value proposition: the inference API Key (sk-sp-…) cannot read plan quota. The remaining quota only exists in the console session. The plugin replays console API calls using browser Cookies to retrieve usage data.

Core Features

The bottom of the sidebar displays the following:
- Plan name / status / days remaining
- Monthly usage progress bar (percentage + remaining/total + reset countdown)
- Top-up pack balance and expiration date
- Collapsed state: a 36px badge showing the monthly usage percentage

Progress bar color rules: ≥90% red, ≥70% yellow, otherwise green.

/qwen-plan Command

Type /qwen-plan directly in chat to check the remaining quota—no need to switch to the browser.

If no Cookie is configured after installing the plugin, the assistant receives a set of instructions and automatically runs a built-in script to extract the Cookie from an already-logged-in browser and establish a connection. Once connected successfully, the guidance prompt disappears automatically. The script decrypts the qianwenai.com session Cookie via CDP without touching the browser you are currently using.

Same-Origin Quota Proxy + Configuration Card

Cookies are stored only in the local DSH credential store; the browser side has no access to them.

Installation & Activation

The recommended approach is CLI installation:

dsh plugin --profile web add dsh-qwen-plan-usage

Alternative methods:
- DSH Plugins page: Settings → Plugins → Install, search by package name dsh-qwen-plan-usage (registry: npmjs.org or npmmirror.com)
- Plugin Manager tool:

  plugin_manager action=install_bundle target=dsh-qwen-plan-usage
  # or
  plugin_manager action=install_bundle target=github:jasocheung/dsh-qwen-plan-usage

After the first installation, refresh the GUI page (Ctrl+R) to see the widget at the bottom of the sidebar; the configuration card is located at Settings → Plugins → dsh-qwen-plan-usage.

After modifying the plugin source code, you must restart DSH Desktop for the changes to take effect.

Compatibility

  • DSH: tested on 0.1.7-rc.2 (desktop profile); engines.dsh declares >=0.1.0-rc.1 <0.3.0-0
  • Node: >= 18
  • Profiles: web / desktop
  • Automatic Cookie extraction script: currently supports Windows + Edge/Chrome (headless profile copy)

Connection Methods

Prerequisite: you are already logged in to https://platform.qianwenai.com in a browser (Edge/Chrome).

The assistant will automatically run the built-in extraction script:

node scripts/extract-cookie.mjs --domain qianwenai.com --sign-in http://127.0.0.1:43120/qwen-plan/sign-in

The script automatically detects Edge/Chrome → copies the browser profile to a temporary directory → launches a headless browser copy to decrypt the session Cookie via CDP → submits it to the local plugin route. It does not touch the browser you are currently using; no visible window appears and no extensions are loaded. On Windows, if the Cookie database is exclusively locked by the browser, the script uses handle-based copy-reading.

Method 2: Manual Paste (Fallback)

  1. Open the console usage page at https://platform.qianwenai.com/home/analytics/token-plan/individual and log in.
  2. Press F12 → Network → select any request → copy the full value of the Cookie request header.
  3. Configuration card → paste into “Console Cookie” → click “Save Cookie”.

Do not paste an API Key (sk-…)—it will be rejected. If the Cookie expires, the widget will display “Not connected or Cookie has expired”; simply reconnect to restore access.

Displayed Content

The plugin retrieves data via the following gateways:
- sec_token: GET https://platform-home.qianwenai.com/tool/user/info.json (home gateway, with Cookie) → data.secToken
- Usage: POST https://cs-data.qianwenai.com/data/api.json?product=sfm_bailian&action=BroadScopeAspnGateway&api=<Api URL-encoded> (bailian cs-data gateway, with &api=)

Main plan commodity code: sfm_tokenplansolo_public_cn; top-up pack: sfm_tokenplansoloaddon_public_cn.

The response is three levels nested: data.DataV2.data.data contains the actual fields (unwrapZelda has already unwrapped to this level).

The domestic individual-tier usage field only returns per1MonthPercentage (0..1) + per1MonthResetTime (ms); there is no weekly or 5-hour window.

Configuration Options

Gateway constants adjustable in the Configuration card “Advanced” section:
- csDataUrl / homeUrl / region / commodityCode / addonCode / consoleSite / consoleDomain

Routes

Method Path Description
GET /qwen-plan/state Connection snapshot
GET /qwen-plan/usage[?refresh=1] Quota proxy (with cache)
POST /qwen-plan/sign-in {cookie} Validate and save Cookie
POST /qwen-plan/sign-out Delete Cookie
GET/POST /dsh-qwen-plan-usage/config Configuration card
GET /dsh-qwen-plan-usage/client.js Self-hosted browser bundle

All routes perform same-origin validation; Cookies never appear in any response.

Use Cases & Notes

Suited for developers who need to frequently check Qwen AI platform quota and want to reduce manual console switching. The plugin runs with the current DSH process permissions; review the source code and license (MIT) before installing.

In Short

The plugin retrieves Qwen platform quota via a browser Cookie proxy, eliminating the need for manual copy-paste. Related links: GitHub, DSH Plugins page.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye