Introduction

DeepSeek Harness (DSH) extends agent workflows through plugins. For users calling DeepSeek V4 series APIs within DSH, peak-valley pricing creates different trade-offs between model cost and quality during peak and off-peak hours: peak hours prioritize cost, while off-peak hours prioritize model capability.

deepseek-peak-valley-router is a DeepSeek Harness plugin: it automatically routes the model based on the current period, using deepseek-v4-flash during peak hours and deepseek-v4-pro during off-peak hours; if the user explicitly selects a model, the plugin will not override the user’s choice.

What is this

deepseek-peak-valley-router is an automatic model routing plugin for DSH peak-valley pricing, maintained by Eligahyu, licensed under MIT.

It solves the following problems:

  • No need to manually switch between deepseek-v4-flash and deepseek-v4-pro.
  • The plugin automatically routes to the corresponding V4 model based on peak-valley hours.
  • User-selected models are always prioritized.
  • Requests from non-target providers or models other than these two V4 models remain unchanged.

Core Features

Below are the main behaviors of the plugin.

  1. Automatically identify peak-valley hours. The reference timezone defaults to Asia/Shanghai and can be configured to other IANA timezones.

  2. Route models based on peak-valley hours.
    - Automatically route to deepseek-v4-flash during peak hours.
    - Automatically route to deepseek-v4-pro during off-peak hours.

  3. User-selected models are always prioritized. The plugin will not override user choices made in the model selector.

  4. Boundary handling. Requests from non-DeepSeek official providers or models other than deepseek-v4-flash and deepseek-v4-pro remain untouched or passed through as-is.

  5. Switching is auditable. Every model switch is logged into the session’s request/header event, making it easy to check the actual model used.

  6. Provide conversation-level tools.
    - peakvalley_status: Check the current hour, target model, and routing mode.
    - peakvalley_reset: Restore automatic routing.

  7. Configuration fault tolerance. If the timeZone configuration is invalid, the plugin will fall back to the default timezone and alert, avoiding request failures.

  8. Boundary handling. When switching from deepseek-v4-pro to deepseek-v4-flash, the plugin automatically discards reasoningEffort to avoid request rejection.

Installation and Enablement

The plugin requires Node >=20.

The plugin runs inside DeepSeek Harness; @deepseek-ai/dsh-tools is provided by the host and does not require manual installation.

Installation as a Combined Plugin

Install the plugin from GitHub:

dsh plugin --profile web add github:Eligahyu/deepseek-peak-valley-router

Restart the corresponding profile after installation for it to take effect:

dsh --profile web

Installation as a Dynamic Plugin

If you want to try it directly in the current Harness conversation, you can use the dynamic plugin method.

Use the cordis_define tool in a Harness conversation to create the plugin, paste the complete content of HOST_CODE from dynamic/host-code.js into the code.host parameter, and then activate it using cordis_run.

The dynamic version additionally exposes the harness.handle('peak-valley-status') Host channel. The combined version does not have a Host channel; status queries are completed via peakvalley_status.

Timezone Configuration

The default reference timezone is Asia/Shanghai. If modification is needed, append the plugin configuration to the profile’s patch layer:

# ~/.dsh/profiles/web/cordis.patch.yml 追加
- id: deepseek-peak-valley-router
  config:
    timeZone: 'America/New_York'

If an invalid timeZone is configured, the plugin will fall back to the default timezone and alert.

Typical Usage

After installation and enabling, you can view the current routing status in the conversation:

调用 peakvalley_status

It will return the current hour, target model, and routing mode.

If the user explicitly selected a model previously and needs to restore automatic routing, you can call:

调用 peakvalley_reset

This operation clears the user selection record in memory, allowing the plugin to re-enter the automatic routing state.

Applicable Scenarios and Notes

Suitable for users using DeepSeek V4 series APIs in DSH and wishing to automatically switch between deepseek-v4-flash and deepseek-v4-pro based on peak-valley pricing.

Pay attention to the following points before use:

  • Peak-valley hours and prices are subject to official announcements from DeepSeek. The plugin implements based on these announcements and does not guarantee consistency with future price policies.
  • Automatic model switching may alter response quality or behavior. For important tasks, please pay attention to the actual model used in the session’s request/header.
  • For sessions created before the plugin was activated, automatic routing will take effect for those sessions after the next page refresh or reconnection; manually selected models take effect immediately, and the plugin respects that choice.
  • The plugin runs with the permissions of the current dsh process. You should check the source code, license, and behavior before installation to ensure it meets expectations.
  • This plugin has no affiliation with DeepSeek official and is not an official work.

Closing

The value of deepseek-peak-valley-router lies in turning model selection under peak-valley pricing into automatic routing: use deepseek-v4-flash during peak hours and deepseek-v4-pro during off-peak hours, while retaining the priority of user-selected models.

GitHub URL: https://github.com/Eligahyu/deepseek-peak-valley-router

The directory page URL was not verified in this article; it is recommended to search directly for the plugin name deepseek-peak-valley-router in the DSH community directory.