Introduction¶
When performing daily conversations or agent development using DeepSeek Harness (DSH), model requests often go through the local Trae Relay reverse proxy. Relay itself maintains a ledger and exposes a status interface, but the Harness interface does not display this information by default. To check if account credits are sufficient, how many tokens were consumed today, or the cost of recent requests, one typically has to switch to the Relay directory, scroll through usage logs, or open another tool to check GET /v1/status.
dsh-trae-relay-usage is a community-maintained client plugin that connects the aforementioned data to the conversation title bar and sidebar. All data comes from the running Relay and is not estimated. Below is an introduction to what it does, where the data comes from, how to install it, and what to watch out for when using it.
What is this¶
The plugin’s full name is dsh-trae-relay-usage, maintainer qwqZYLqwq, categorized as “Client” in the SkillHub directory. Version 1.0.0 (see repo package.json), license MIT, requires Node.js >= 18.
One sentence: It reads the local Trae Relay account status, tokens, and request flow, displaying them in DSH using capsules and panels; and estimates RMB costs for tokens in the ledger based on DeepSeek’s official rate card (reference value, not a bill).
Core Features¶
Data Source and Scope¶
Panel content is sourced from the local Relay, consistent with the Desktop port of Relay:
| Panel Content | Source |
|---|---|
| Account Name / Type / Credits / Status | GET /v1/status (Hosted by plugin, page doesn’t need key) |
| Today / Last 7 Days / Last 30 Days / Cumulative Token, Credits, and Estimated Cost | Relay’s usage/usage-YYYYMMDD.jsonl ledger |
| Recent Request Details (including cost per request) | Same as above, taking the latest 40 records |
| Endpoint Address / Key / Any Key | Relay’s config.json |
Token calculation is in + out + cache; credits are only summed from delta values where known: true and greater than 0; daily cutoff is based on local midnight; display uses formatTokens (999.95 rounding, units ""/K/M/B, one decimal place).
Cost Conversion (RMB)¶
Ledger tokens are converted based on DeepSeek’s official pricing, referencing the deepseek-flash rate in the DeepSeek API Pricing Guide (which corresponds to the deepseek-v4.1-flash endpoint serving DeepSeek-V4.1-Flash-1017):
| Yuan / Million Tokens | Off-Peak | Peak |
|---|---|---|
| Input · Cache Hit | 0.02 | 0.04 |
| Input · Cache Miss | 1 | 2 |
| Output | 4 | 8 |
Peak hours are Beijing Time Mon-Fri 09:00–12:00 and 14:00–18:00; off-peak applies to other times, weekends, and Chinese statutory holidays. The ledger’s in already includes cached parts; cache misses are calculated as in - cache to avoid double billing. Each request is judged as peak or off-peak based on its own timestamp; the “Off-Peak / Peak” label on the interface indicates the current time slot; costs in the details are calculated based on the time slot of each record. The holiday schedule is in PRICING.holidays in index.js (currently 2026); the schedule for New Year’s needs to be manually updated once released.
Interface and Routing¶
- Capsule on the right of the conversation title bar:
● Credits, click to expand the panel. - Bottom of the sidebar:
Trae Relay; when the sidebar is collapsed to a 56px track, only the status dot is displayed. - The panel has four sections: current account (including today’s estimated cost), Token and cost range, local endpoint (can show/copy keys), and recent requests. The panel is mounted to
document.bodyviareact-dom’screatePortalto prevent header clipping overflow.
Harness provides GET /trae-relay/api/state (using ?force=1 can bypass the 4-second cache). The return value contains the Relay API Key, so the route rejects cross-site requests (sec-fetch-site) and non-local Hosts, supporting only GET/HEAD.
Features related to the DeepSeek platform in older similar plugins (platform balance, bookmark token retrieval, API Key filtering, etc.) have not been ported over—these concepts do not exist in this plugin’s data source.
Installation and Activation¶
The installation method given in the official README is installing from a local bundle directory (adjust the path according to your environment):
plugin_manager install_bundle target=D:\DSH_plugins\dsh-trae-relay-usage
Please read the repository source code and MIT license before installing; the plugin runs with the current DSH process permissions and will read the Relay data directory and proxy status requests.
Configuration (Optional)¶
Override automatic detection via environment variables:
| Variable | Purpose |
|---|---|
TRAE_RELAY_DIR |
Specify Relay data directory |
TRAE_RELAY_ALLOWED_HOSTS |
Additional hosts allowed to access the route, comma-separated; * disables validation |
Auto-detection order: First TRAE_RELAY_DIR, then use PowerShell to find the TraeRelay process executable path, and take the parent directory of the exe as the data directory (where config.json, usage/, and the exe are at the same level). Cache hit is 5 minutes, miss retries after 30 seconds; you can open the panel before starting Relay.
Typical Usage¶
- Run Trae Relay locally first to ensure
config.jsonandusage/are available. - After installing and enabling the plugin in DSH, open the Harness Web client normally.
- Check the capsule on the right of the title bar or the sidebar
Trae Relay: it shows credits and a status dot when online; click to expand today’s Token, range statistics, endpoint and keys, the latest 40 requests, and estimated costs. - When you need to refresh aggregated data, you can make a request to
GET /trae-relay/api/state?force=1(generally handled by polling in the panel, specifics depend on the client implementation).
When Relay is not running or the account is not enabled, the panel shows an empty state or offline prompt, and does not display fake data.
Use Cases and Considerations¶
Who is this for: Users who use local Trae Relay for model access daily and want to quickly check credits and tokens within DSH without repeatedly opening the Relay directory or third-party monitoring scripts.
Boundaries (explained in README):
- Relay memory only retains the latest 100 records, disk retains 30 days; “cumulative” refers to the ledger retention amount, not the total account history.
- Costs are estimated based on the official rate card and are not the same pricing system as Trae’s credit deduction.
- After official price changes,
PRICINGinindex.jsneeds to be updated synchronously; the plugin does not pull the rate card online. - Panel visuals are based on the actual page; it is difficult to verify UI details via screenshots in a non-browser environment.
The DSH ecosystem advocates “Everything is a plugin”; the SkillHub directory is a community site and has no official affiliation with DeepSeek / Fudan.
Conclusion¶
dsh-trae-relay-usage connects Trae Relay’s status, ledger, and configuration to the Harness title bar and sidebar, consistent with Relay’s scope, and includes RMB reference costs based on DeepSeek’s rate card. If you are already using Trae Relay, you can install it using plugin_manager install_bundle as per the README, or specify the data directory with TRAE_RELAY_DIR if necessary.
- Directory page: https://www.skillhub.cn/plugins/qwqZYLqwq/dsh-trae-relay-usage
- Source code: https://github.com/qwqZYLqwq/dsh-trae-relay-usage