dsh-alibaba-token-plan: View Alibaba Cloud Token Plan Monthly Usage in DeepSeek Harness

Introduction

After switching to a model provided by Alibaba Cloud Model Studio in DeepSeek Harness (DSH), inference consumes subscription quota from the Token Plan, but the client does not by default display “percentage used this month, when it resets” right before your eyes. During long conversations or dense tool loops, it is easy to inadvertently exhaust the monthly window without knowing.

The community plugin dsh-alibaba-token-plan (npm package name @wasp/dsh-alibaba-token-plan, maintainer kkazakov) adds three capabilities to the Harness Web UI: the environment bar below Composer, the independent settings page, and the agent-callable alibaba_token_plan_usage tool. Implementation-wise, it follows the same bundle / slot / route pattern as dsh-opencode-usage and dsh-deepseek-balance, and can be considered a DSH port of Paseo’s alibaba-usage.

What is this

One sentence: Reads the usage percentage of the Alibaba Cloud Token Plan subscription month (and optional Seat Credits), and displays and injects it into the DSH client context.

The plugin does not use model inference keys like sk-sp-... to check usage; it requires a RAM AccessKey capable of reading Model Studio subscription information.

Core Features

Composer Environment Bar

Displays an entry below the input area similar to Token Plan · Monthly [bar] 5% · resets in 29d. It polls every 60 seconds, forcing a re-fetch of upstream data each time. The strip turns amber when usage reaches the configured warnPercent, and turns red at 100%.

Only displays when the provider id of the model selected in the current session matches providerMatch (default alibaba); session-level model selection takes precedence over global defaults. This is mutually exclusive with the DeepSeek balance bar and OpenCode usage bar by provider, avoiding multiple strips stacking together. Even if the model ID starts with deepseek-, as long as the provider remains alibaba, only the Alibaba Cloud strip will appear.

Settings Page

The path is Settings → Alibaba Token Plan. Always available, independent of the currently selected model. The page displays a large monthly usage dial, local clock and countdown for reset time, package label, credential source, endpoint, warnPercent threshold, and provides a manual Refresh. If the package reports Seat Credits, it shows Used / Remaining / Total; for personal Token Plans which often only have a percentage, the page explains rather than fabricating the total.

Agent Tool alibaba_token_plan_usage

Returns the same source data as text, facilitating agent confirmation of remaining balance before long tool loops. When passing credits: true, it will additionally attempt to read the Seat Credits summary.

Threshold Notice

After the monthly window usage crosses warnPercent, a short notice line is appended to the prompt, asking the model to be frugal before the monthly reset; no injection when below the threshold. Can be completely disabled via contextNotice: false.

Digital Meanings

The percentage on the strip comes from the Alibaba Cloud API, indicating the ratio of consumed Token Plan Credits within the subscription month, not the natural month. The reset countdown comes from the API’s per1MonthResetTime.

Installation and Activation

Prerequisites: DeepSeek Harness with Web UI (Desktop, or web profile).

Installation is executed in-process under the current DSH process permissions, only from trusted sources.

From GitHub (Web UI Plugins → Add plugin, or spec accepted by plugin_manager):

github:kkazakov/dsh-alibaba-token-plan-plugin

From npm (after package publication):

@wasp/dsh-alibaba-token-plan

Local development can use manual link, in ~/.dsh/profiles/<profile>/package.json:

"dependencies": { "@wasp/dsh-alibaba-token-plan": "link:/path/to/dsh-alibaba-token-plan-plugin" },
"dsh": { "profile": { "bundles": [ /* … */ "@wasp/dsh-alibaba-token-plan" ] } }

DSH currently does not automatically upgrade plugins; switching to a new version requires uninstalling before installing. You can specify a fixed version by writing @wasp/dsh-alibaba-token-plan@1.0.0.

Credentials and Permissions

AccessKey takes the first complete set of ID + Secret in the following order:

  1. accessKeyId / accessKeySecret in plugin config
  2. Environment variables (ALIBABA_CLOUD_ACCESS_KEY_ID / ALIBABA_CLOUD_ACCESS_KEY_SECRET, and ALIBABA_*, ALIYUN_*, BAILIAN_* etc.)
  3. refs.ALIBABA_CLOUD_ACCESS_KEY_ID and refs.ALIBABA_CLOUD_ACCESS_KEY_SECRET in Harness credential store ~/.dsh/.credentials.yaml
  4. $DSH_HOME/.env
  5. Current profile in ~/.aliyun/config.json

The official recommendation is to prioritize the credential store (Item 3) for centralized rotation with model keys.

The RAM user needs AliyunTokenPlanReadOnlyAccess, and the console path also needs modelstudio:GenerateCLIAccessToken. If Team.NotAuthorised is returned, it means the RAM user has not joined the Model Studio workspace and needs to be granted administrator or subscription plan-related permissions in the console account management.

Configuration Example

Bundle configuration can be overridden in the profile’s patch layer ~/.dsh/profiles/<profile>/cordis.patch.yml to persist even after plugin updates:

- id: alibaba-token-plan
  name: '@wasp/dsh-alibaba-token-plan'
  config:
    warnPercent: 60
    refreshSeconds: 120
    providerMatch: 'alibaba'

Common fields (full table in README):

Key Default Meaning
warnPercent 80 Monthly usage percentage that triggers strip highlight and prompt notice
refreshSeconds 300 Interval for host to re-read upstream (min 30)
providerMatch 'alibaba' Shows strip when provider id contains this substring
contextNotice true Whether to write to model context when crossing threshold
openApiHost modelstudio.ap-southeast-1.aliyuncs.com International / Singapore Token Plan OpenAPI host

Typical Usage

  1. Install the bundle in DSH and configure the AccessKey (recommend writing to ~/.dsh/.credentials.yaml).
  2. Select a model with provider alibaba in the session, confirm the monthly usage bar appears below Composer.
  3. Open Settings → Alibaba Token Plan to verify endpoint, reset time, and manual refresh work normally.
  4. Let the agent call alibaba_token_plan_usage in the conversation; pass credits: true when Seat Credits details are needed.

If dsh-deepseek-balance is also installed, please keep its showForAllProviders at the default false, otherwise it will bypass provider matching and appear side-by-side with the Alibaba Cloud strip.

Use Cases and Notes

Suitable for: Individuals or small teams who use Alibaba Cloud Model Studio (including DeepSeek series models routed via the alibaba provider) for development in DSH for a long time, who want to grasp the monthly subscription usage in the same interface, and want the model to receive frugality prompts when usage is high.

Notes:

  • The plugin accesses the network and reads credentials with the current Harness process permissions; please read the source code and MIT license before installing.
  • The community directory SkillHub Plugin Page and GitHub are independent entry points for the ecosystem, not the official DeepSeek / Hypothesis application store.
  • The default openApiHost is modelstudio.ap-southeast-1.aliyuncs.com, corresponding to the International / Singapore Token Plan path.

Conclusion

dsh-alibaba-token-plan brings the Alibaba Cloud Token Plan subscription monthly usage into the DSH client: the environment bar, settings page, and alibaba_token_plan_usage tool displayed by provider, running in parallel with DeepSeek balance and OpenCode usage plugins without conflicting. For further details on installation and the full configuration table, please refer to the SkillHub directory page and the GitHub repository README.

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

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

Xiaoye