Introduction¶
DSH (DeepSeek Harness) adopts a plugin-based architecture, allowing any developer to enhance functionality through extensions. For users who self-host New API or One API-compatible gateways, viewing the model call cost of the current conversation in the Web Composer is a common need. Existing gateway billing dashboards are usually on separate pages and lack integration with the conversation context.
The dsh-gateway-billing plugin integrates this feature into the Dock area of the DSH Web Composer, allowing real-time cost viewing without leaving the conversation interface.
Plugin Overview¶
This plugin was developed by maintainer LeslieWylie and generalized from a de-identified internal gateway billing dashboard. It is an independent Skill and works with any self-hosted gateway that exposes a /pricing endpoint in New API / One API format.
Core Features¶
-
Price list fetching
Automatically fetches the price list from the configured gateway URL. The server refreshes it every 10 minutes and caches it. -
Support for dual billing modes
Compatible with two billing methods:
- Token-based pricing (quota_type=0)
- Fixed unit pricing (quota_type=1) -
Per-conversation calculation
Traverses all model call nodes in the current conversation and calculates the total cost based onusage(input/output/cache tokens) and the price list. -
Composer Dock display
Displays a line of information below the input bar:
- Total cost
- Most recently called model and count
- Input/output/cache token counts
Automatically splits into multiple lines for multi-model conversations. -
Status distinction
Distinguishes between the “not configured” and “fetch failed” states, and highlights model calls for which no entry was found in the price list.
Installation and Enablement¶
Method 1: Manual Installation (Currently Recommended)¶
- Clone the repository locally:
git clone https://github.com/LeslieWylie/dsh-gateway-billing.git ~/Desktop/01-Projects/dsh-gateway-billing
- Go to your DSH profile directory, edit
package.json, and add the dependency:
"dsh-gateway-billing": "link:~/Desktop/01-Projects/dsh-gateway-billing"
- Edit
cordis.patch.yml, add the plugin configuration and specify the pricing URL:
- id: gateway-billing
name: 'dsh-gateway-billing'
config:
pricingUrl: 'https://your-gateway.example.com/api/pricing'
- Run
pnpm installand restart the DSH process.
Method 2: Plugin Command (To Be Released)¶
dsh plugin add dsh-gateway-billing
Configuration¶
The plugin requires pricingUrl in the config field of cordis.patch.yml.
| Option | Description | Example |
|---|---|---|
pricingUrl |
Gateway pricing endpoint URL. Must return data in New API / One API format | https://your-gateway.example.com/api/pricing |
Design Principles and Considerations¶
- Gateway-agnostic: The plugin does not include a built-in gateway address; the pricing source is entirely user-configured.
- Failure visibility: Missing configuration and fetch failures show different messages; issues are not handled silently.
- Single refresh: The price list is refreshed on the server every 10 minutes. The Composer Dock reads snapshots via RPC and does not fetch repeatedly.
Conclusion¶
dsh-gateway-billing provides DSH users with a way to understand conversation costs without additional navigation. It originated from a de-identified internal version, removed sensitive information, while retaining practical billing functionality.
- GitHub: https://github.com/LeslieWylie/dsh-gateway-billing
- Directory page: https://www.skillhub.cn/plugins/LeslieWylie/dsh-gateway-billing