Introduction

If you want to schedule tasks to run during off-peak hours and finish before peak hours arrive, you need to know at any time whether it is peak or off-peak and when the next switch happens. The existing method is to keep a manual schedule and check it yourself; it is troublesome and easy to forget. To check the remaining balance of the DeepSeek API, you also have to stop what you are doing to look it up.

dsh-tool-tariff is a DSH (DeepSeek Harness) plugin that consolidates these tasks into the session: the model can answer time period questions directly, automatically reminds before peak hours, and the Web GUI top bar has an always-on real-time status badge. DSH’s philosophy is “everything is a plugin,” and this kind of capability fits well as a mounted plugin. Below, I will introduce it in the order of features, installation, configuration, usage, and notes.

What is it

dsh-tool-tariff is maintained by omdsh-dev, licensed under MIT, current version 0.0.2, npm package name @deepseek-ai/dsh-tool-tariff. One-sentence positioning: Peak-valley tariff period query + DeepSeek API balance query + Peak time switch reminder + Top bar status badge.

Breaking it down, the plugin does four things:

  1. Registers two tools, tariff and api_balance, for the model to call during conversation;
  2. Built-in reminder scheduler triggers peak time switch reminders according to configured times;
  3. Opens a /tariff RPC channel (with status and balance actions) for the browser side to retrieve data;
  4. Injects a status badge component into the Web GUI top bar.

In terms of code structure, the time period logic (src/tariff.ts), balance query (src/balance.ts), and reminder scheduling (src/reminder.ts) are three independent modules. src/index.ts handles integration, and client/client.js is the browser-side badge component.

Core Features

tariff Tool: Peak-Valley Period Query

Returns three types of information after invocation: whether currently in peak or off-peak, the complete time period table, and the next switch time.

The default time period table is as follows:

00:00 – 09:00  Off-peak
09:00 – 12:00  Peak time
12:00 – 14:00  Off-peak
14:00 – 18:00  Peak time
18:00 – 24:00  Off-peak

Boundaries are handled by “switch upon arrival”: 09:00 marks the entry into peak time. The time period logic includes timezone conversion, where the timezone can be specified via the configuration option timezone (IANA name, e.g., Asia/Shanghai), defaulting to the host’s local timezone.

api_balance Tool: Balance Query

Queries the DeepSeek API account balance. The endpoint defaults to https://api.deepseek.com, can be overridden by the environment variable DEEPSEEK_BASE_URL, consistent with the DSH built-in llm-deepseek adapter. Balance results are cached on the host side for 60 seconds; repeated queries within the cache period do not trigger new API requests.

Implementation relies on the global fetch (built-in in Node 22+), and the plugin’s engines require node ^22.19.0 || >=24.0.0. If using a non-official gateway and that gateway does not implement the /user/balance endpoint, it will return a clear HTTP error message.

Peak Time Switch Reminder

By default, two reminder windows are triggered daily at 08:50 and 13:50 (10 minutes in advance), prompting “10 minutes until peak time.” The corresponding windows are 08:50–09:00 and 13:50–14:00, with a reminder for each window once a day. Both the time and window length are configurable.

When reminderWake is true (default), the agent is woken up for one round, and the model announces the reminder; if set to false, only the next-step context is injected without triggering a model call.

Web GUI Top Bar Status Badge

The badge is attached to the right side of the conversation header (slot conversation.session.header.utilities, item id tariff-status), displaying three segments: Time | Current period and switch countdown | Account balance. Time and countdown refresh every second and are calculated locally without network traffic; Orange for peak time, Green for off-peak.

Balance is not automatically polled: it is queried only when the balance badge is clicked. There is an additional 60-second cache on the host side; frequent clicks will not repeatedly hit the balance API. While querying, it shows “Querying…”; when the connection is unavailable or the Key is not configured, it shows “Balance Unavailable”. Hovering reveals the reason, and clicking allows retry.

Data goes to the host side via a dedicated /tariff RPC channel, and the API Key exists only on the host side, not in the browser. A design premise worth noting here is that the plugin should not occupy the /api channel—this is a dedicated shared channel for the DSH gateway (Typert Remote). Third-party plugins seizing this channel will cause Remote features like the plugin list and command execution to silently fail, so this plugin uses an independent /tariff channel.

Installation and Verification

Install first, then verify. Install to the web profile via Profile Bundle:

dsh plugin --profile web add github:omdsh-dev/dsh-tool-tariff

For one-off tasks or headless environments, install to the headless profile:

dsh plugin --profile headless add github:omdsh-dev/dsh-tool-tariff

After installation, verify the plugin is mounted:

dsh --profile web --dump-config | grep tool-tariff

If the command has output, it means the mount was successful. Note: The frontend badge only takes effect after restarting the Web GUI, as HMR is disabled for the web profile.

Configuration

All configuration items are optional and are written under plugins.tool-tariff in cordis.yml. The file location is $DSH_HOME/profiles/web/cordis.yml, or can be passed via --patch.

Field Default Description
timezone Host local timezone IANA timezone name, e.g., Asia/Shanghai
baseURL $DEEPSEEK_BASE_URL or https://api.deepseek.com Balance query endpoint
apiKeyEnv DEEPSEEK_API_KEY Credential reference name
reminderTimes ["08:50", "13:50"] List of daily reminder times (HH:MM)
reminderWindowMinutes 10 Length of each reminder window (minutes)
reminderTickMs 20000 Reminder scheduler polling interval (milliseconds)
reminderWake true true wakes the agent for the model to announce; false only injects next-step context
balanceCacheMs 60000 Balance result cache duration (milliseconds)

Configuration example:

plugins:
  tool-tariff:
    timezone: Asia/Shanghai
    reminderTimes: ['08:50', '13:50']
    reminderWake: true

Typical Usage

With the above installation and configuration, you can simply ask questions directly in the conversation:

  • Ask “What time is it now?” or “When will peak time begin?” — the model will call the tariff tool;
  • Ask “Check the API balance” — the model will call the api_balance tool;
  • Automatically receive peak time switch reminders at 08:50 and 13:50 every day, which by default will wake the model to announce in one sentence.

There is a prerequisite for balance queries: you must first configure the DeepSeek API Key, choose either of the two methods:

  1. Configure the credential DEEPSEEK_API_KEY in the DSH settings page (Model/Credentials page);
  2. Or export the environment variable DEEPSEEK_API_KEY.

Applicable Scenarios and Notes

Suitable for two types of users: those who need to schedule task rhythms based on peak-valley periods and want to receive reminders before peak hours arrive; and those who want to directly check DeepSeek API balance in the conversation and have it displayed permanently in the top bar.

A few points to note before use:

  • The plugin runs with the permissions of the current dsh process. Before installing third-party plugins, you should read the source code and confirm the license. dsh-tool-tariff uses the MIT license, and the source code is public on the GitHub repository.
  • The “once daily” semantics of reminders exist only in process memory: if the process restarts during a reminder window, it will trigger again that day (as expected); reminders are only delivered to currently alive top-level agents, and silently skipped if no agent is alive.
  • The headless profile does not have a connection service, so the RPC channels will be skipped automatically. The two tools and reminder functionality are not affected.

Summary

dsh-tool-tariff integrates high-frequency queries like “what time is it now,” “how long until the switch,” and “how much balance is left on the API” into DSH: the model can answer, it is visible in the top bar, it reminds at the right time, and the API Key stays on the host side throughout. Source code and documentation can be found in the GitHub repository https://github.com/omdsh-dev/dsh-tool-tariff, or you can view its entry in the community plugin directory: https://www.skillhub.cn/plugins/omdsh-dev/dsh-tool-tariff.