DeepSeek Harness (DSH) is built on the core philosophy that “everything is a plugin.” When using relays (such as new-api or one-api) instead of the official endpoints, developers of agents often face a pain point: they cannot directly see the balance and usage of the relay site. The dsh-plugin-relay-quota plugin addresses this by reading billing interface data from the relay. It provides the /quota command and the quota_check tool so DSH can query the remaining quota and usage of any OpenAI-compatible relay.
Features¶
The plugin primarily offers:
/quotacommand: Lists configured relays one by one, showing “used / limit / remaining” values, with a percentage bar and markers for “exhausted” or “below 10%”. Optionally lists the models provided by each relay.quota_checktool: Lets agents self-check quota before running large tasks to avoid interruptions due to insufficient balance.- Fault tolerance:
- When the endpoint response is missing fields, it outputs
?instead of guessing values. - Recognizes 1e8 as the “no limit” sentinel.
- If a relay endpoint fails, it affects only that row’s display and does not impact other relays.
Installation and Activation¶
This plugin must run under the @deepseek-ai/dsh@0.1.7-alpha.1 environment, and the system must have pnpm installed.
- Install the plugin package
Use the following command to install the plugin into the specified profile:
dsh plugin --profile web add github:121212165/dsh-plugin-relay-quota
-
Apply a configuration patch
Merge the content ofcordis.patch.ymlin the plugin repository root into$DSH_HOME/profiles/web/cordis.patch.yml.
Note: Do not simply append. This file defaults to an empty array; direct appending will cause a YAML parsing error (end of the stream or a document separator is expected). -
Restart the service
Both the configuration layer and the client must be restarted to take effect (the client applies settings based on startup configuration; a hard browser refresh will not help).
Verify that the installation succeeded:
dsh --profile web --dump-config | grep dsh-plugin-relay-quota
Typical Usage¶
Configuration Example¶
Add the following configuration to the insert array in cordis.patch.yml:
- insert:
- id: relay-quota
name: dsh-plugin-relay-quota
config:
enabled: true
providers:
- name: my-relay
baseUrl: http://localhost:3002/v1
apiKeyEnv: RELAY_API_KEY
listModels: true
Query Relay Quota¶
In a conversation, simply input:
/quota
This lists the balance, limit, remaining amount, and status bars for all relays.
Agent Self-Check Quota¶
Agents can call the quota_check tool. Before running large tasks, the agent automatically checks each relay’s remaining quota; if the balance is insufficient or below a threshold, the task logic will typically adjust or abort.
Notes¶
- Dependencies: Ensure
pnpmis in the system PATH and that DSH version is0.1.7-alpha.1. - Permissions and Security: The
apiKeyEnvfield in the configuration specifies an environment variable name. Avoid hardcoding API keys directly in the config file to prevent leakage. - Validation Status: According to the project documentation, the endpoint data format has been verified against real relays using curl, and the parsing logic has unit tests; however, the plugin itself has not been validated via a live mount in a running DSH process.
- License: This plugin is released under the MIT License.
Ecosystem and Links¶
This plugin is maintained by community developers and is not an official DeepSeek product. As part of the DSH ecosystem, it works alongside other plugins (such as task-forge and cost-ledger) to form a toolchain for building agents.