DeepSeek Harness (DSH) provides plugin-based extension capabilities. In a Web GUI environment, handling multilingual text often requires frequent switching of window context. The dsh-translator plugin solves this problem by using a browser-side floating window component.

Plugin Overview

This plugin is maintained by zhinian558 and licensed under the MIT license. It provides a floating AI translation window for Web GUI, with the following core capabilities:
* Window Interaction: The window is draggable and resizable, and includes language selectors, source text, and result panes.
* Status Monitoring: The bottom of the window displays the provider account balance and estimated consumption for the day (CNY) in real time.
* Service Hosting: Hosts the route /translator/* on the host side for translation, balance queries, and status checks.
* Configuration Management: Provides an independent settings namespace.
* Security: API keys are held by the host and are not passed to the browser page in plaintext.

Installation and Activation

To install this plugin, you need to use the DSH CLI tool.

dsh plugin --profile web add github:zhinian558/dsh-translator

After installation, you must restart the dsh process and refresh the browser page to load the plugin.

Technical Implementation and Installation Methods

The plugin uses a dual-package structure (Host + Browser).

  • Git Installation: Fetch the source code and rely on the prepare script to build the lib/ directory during installation. If using pnpm ≥10, you need to allow this package to be built in pnpm-workspace.yaml.
  • NPM/Tarball Installation: The package includes a prebuilt lib/ directory and requires no additional build permissions.
  • Local Development: You need to run pnpm install && pnpm run build.

The plugin injects host services (webServer, settings, credentials) into the DSH core via cordis.patch.yml, and the browser side loads client resources through window.__ModuleLoader__.load.

Core Features and APIs

Translation Service

The translation API is invoked with a POST request. The request body format is as follows:

{
  "text": "待翻译文本",
  "source": "源语言代码",
  "target": "目标语言代码"
}

Supported source values include 'auto'. The response is JSON and includes the translated text, token usage, serving model, estimated cost (CNY), and latency.

Status and Balance

  • GET /translator/balance: Queries the provider account balance. DeepSeek calls /user/balance, OpenAI uses the public credit-grants endpoint, and other compatible endpoints may return an unsupported response.
  • GET /translator/status: Queries the resolved provider information, the source of the key configuration, and balance query support status.

Configuration

Plugin settings include provider type (deepseek | openai), Base URL, model, API key (supports a literal value or an environment variable reference), and pricing configuration.

Notes

  • Key Resolution Order: The plugin prefers the literal apiKey value in the settings page, then falls back to the credential seam reference.
  • Data Storage: The window position, size, and daily usage ledger (recorded by local date and cleaned up after 30 days) are all stored in browser localStorage.
  • Cost Estimation: Today’s consumption is an estimate based on locally configured prices and provider token usage. It is not an official bill and is for reference only.
  • Permissions: As a DSH plugin, it runs with the permissions of the current dsh process.