Introduction

In DSH development and usage scenarios, monitoring cc-switch provider balances as well as DSH session token usage and costs is an essential requirement. The ccs-balance plugin provides a unified view for this purpose, consolidating scattered information into the DSH dashboard.

Feature Overview

This plugin mainly provides data monitoring in the following areas:

  1. Balance Page: Retrieves the balance for each provider in cc-switch. Supported provider types include newapi / general / DeepSeek / OpenAI / Moonshot / SiliconFlow. Supports independent currency settings (¥/$) for each provider and a global USD→CNY exchange rate conversion.
  2. Usage Page: Aggregates token counts and costs for input, output, cache read, and cache write by day, by month, and in total. The daily view supports viewing data for the last 7 days, the last 30 days, or all data. The interface provides a stacked bar chart to show the model composition.
  3. Sessions Page: Aggregates token usage and costs by session. Supports search and sorting. After all sessions are loaded, you can scroll directly through the list without expanding individual session details.
  4. Panel Size: The Balance, Usage, and Sessions pages all have a fixed height of 500px; content beyond the panel is scrollable inside the panel.

Installation and Activation

Install the plugin using the official command:

dsh plugin add ccs-balance

If manual configuration is required, add "ccs-balance" to dsh.profile.bundles and specify the version ^1.0.0 in dependencies.

After installation and activation, a “CCS Balance” entry appears at the bottom of the sidebar.

Usage Instructions

Balance Settings

  1. Usage instructions are at the bottom of the Balance Page; click the ⚙ icon to expand them.
  2. Costs are displayed in yuan (¥) by default. If your proxy station is billed in actual US dollars, change the “USD→CNY Exchange Rate” on the Balance Page to the corresponding value (for example, 7.2); if the proxy station is billed in yuan, keep the value as 1.
  3. The currency (¥/$) for each provider is set in the dropdown next to the provider name on the Balance Page.

Viewing Data

  • Balance: If it shows 0 or a negative value, the balance query for that proxy station failed or the account is overdrawn. Check the provider configuration and API key.
  • Cost: If it shows 0, the session may not have a cc-switch flow record, or the model did not match the pricing table.
  • Exchange Rate Update: After changing the exchange rate, the values are recalculated automatically when you switch to other tabs.

Data Sources

  • Balance: Reads provider configurations from the cc-switch database and queries real-time balances through the respective proxy station APIs.
  • Usage and Cost: Reads cc-switch usage_daily_rollups and proxy_request_logs (i.e., the actual deduction data from proxy stations). If the above data is missing, the system falls back to estimating based on model_pricing.
  • Session List: Reads the DSH session store directly.

Conclusion

The ccs-balance plugin provides DSH users with end-to-end statistics from provider balances to specific session costs. Its core value lies in unifying data sources and reducing the time spent switching between different systems.

Plugin catalog: https://www.skillhub.cn/plugins/kikomaotu/ccs-balance
Source repository: https://github.com/kikomaotu/ccs-balance