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

  1. Price list fetching
    Automatically fetches the price list from the configured gateway URL. The server refreshes it every 10 minutes and caches it.

  2. Support for dual billing modes
    Compatible with two billing methods:
    - Token-based pricing (quota_type=0)
    - Fixed unit pricing (quota_type=1)

  3. Per-conversation calculation
    Traverses all model call nodes in the current conversation and calculates the total cost based on usage (input/output/cache tokens) and the price list.

  4. 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.

  5. 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

  1. Clone the repository locally:
   git clone https://github.com/LeslieWylie/dsh-gateway-billing.git ~/Desktop/01-Projects/dsh-gateway-billing
  1. Go to your DSH profile directory, edit package.json, and add the dependency:
   "dsh-gateway-billing": "link:~/Desktop/01-Projects/dsh-gateway-billing"
  1. 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'
  1. Run pnpm install and 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