dsh-plugin-opencode2api: One-Click Local OpenAI-Compatible Free API in DSH

Introduction

DSH (DeepSeek Harness) adopts an “everything is a plugin” architecture — extending functionality simply requires installing a plugin. However, when using a local free API, you often need to manually download the program, configure the environment, start the process, and then fill in the endpoint address and Key into DSH. The steps are numerous and error-prone. dsh-plugin-opencode2api is an official catalog plugin that encapsulates the installation and execution of opencode2api into DSH. It automatically downloads the binary for the corresponding platform, generates configuration, starts the process, and registers the local API as a model provider in DSH.

Plugin Scope

This is an unofficial one-click installer and auto-runner for running opencode2api — a local free OpenAI-compatible API gateway — within DSH. The plugin itself is licensed under the MIT License, does not modify the opencode2api source code, and downloads the official binary from upstream GitHub Releases during installation. The maintainer is king-andthe-nice.

The plugin provides a desktop Web UI settings page and a dsh-go native panel (supporting Windows, macOS, Linux, and Android). After installation, you can directly select local free models in DSH’s model selector without manually configuring the address and Key.

Installation

The most convenient way is via npm (already published, synced with domestic mirrors):

dsh plugin --profile web add dsh-plugin-opencode2api

Other methods (excerpts from the documentation):

Method Command Prerequisite
GitHub dsh plugin --profile web add github:king-andthe-nice/dsh-plugin-opencode2api GitHub accessible
Local package dsh plugin --profile web add ./dsh-plugin-opencode2api-1.2.2.tgz Have the 17 KB tgz file
LAN dsh plugin --profile web add http://<phone-IP>:8000/dsh-plugin-opencode2api-1.2.2.tgz Run python3 -m http.server 8000 on the phone first

After installation, the engine will automatically download the program (~5 MB), generate the configuration, and start it on 0.0.0.0:8080 (accessible from both localhost and the local network). If the initial download fails, it will retry every 30 seconds.

Once installed, you can find the status and action buttons under “Settings → Local Free API” in the DSH Web UI (default http://127.0.0.1:3080); on the mobile app, look under the “Local API” capsule/panel.

Feature Overview

Start & Control

The plugin provides start/stop/restart/reinstall functionality. Reinstall will re-download the program. Start/stop is based on process management: Windows uses netstat + taskkill, while macOS/Linux/Android use lsof/fuser//proc — no longer relying on potentially lost pid files. If the process crashes, it will be automatically restarted.

Listening Address

Supports switching between “Localhost only” (127.0.0.1) and “LAN accessible” (0.0.0.0), so that you can access the local API from a phone or other devices on the local network.

Auto-Configuration

Once the gateway is ready, the plugin will automatically perform the following:

  • Register http://127.0.0.1:8080/v1 as the provider opencode2api for llm-pi-ai, with display name “Local Free API”;
  • Write the local API Key into DSH credential OPENCODE2API_API_KEY (not stored in the config file);
  • Read models from /v1/models, and write in the context window, output limit, image input, and reasoning tier;
  • Automatically update when the model list changes; skip writing if nothing has changed.

On desktop, you can retry by clicking “Auto-Configure” under “Settings → Local Free API”; on mobile, the same button is available in the “Local API” panel.

Manual Setup (if Auto-Configuration Fails)

If auto-configuration fails, you can manually configure it under “Settings → Models” in DSH:

  1. Open the “Local Free API” panel.
  2. Click “Copy Address” to get the local/LAN address, and click “Copy Key” to get the API Key:
   Local: http://127.0.0.1:8080/v1
   LAN: http://<your-LAN-IP>:8080/v1
   API Key: <randomly generated>
   Recommended model: big-pickle
  1. In DSH, add an OpenAI-compatible provider, enter the address above as the Base URL, and the generated Key as the API Key.

Log Viewing

The desktop settings page allows you to expand and view the last 40 lines of runtime logs; the mobile panel has a new “View Logs” option, and you can also check opencode2api.log in the data directory.

Data Directory & Configuration

The data directory is located at $DSH_HOME/dsh-go/opencode2api/ (default ~/.dsh/dsh-go/opencode2api/), containing:

  • opencode2api: program binary
  • config.json: gateway configuration (listening, Key, anonymous toggle, etc.)
  • webui-password.txt: initial admin password (becomes invalid after changing in the admin panel)
  • auto-provider.json: auto-configuration state (model list fingerprint)
  • opencode2api.log: runtime log

The plugin enables the anonymous free channel by default and generates a random server_keys to protect /v1/*. The anonymous channel is provided upstream and may be rate-limited or blocked — intended for personal lightweight use only; for long-term use, it is recommended to enter your own Zen / Go Key in the admin panel and comply with OpenCode’s and each model service’s terms.

Admin Panel

Open http://127.0.0.1:8081 (or the LAN address) in a browser. Username: admin, initial password shown on the desktop settings page (localhost only) or in webui-password.txt. The admin panel allows you to change the password, view requests, manage upstream Keys, and more.

Uninstallation

Uninstall command:

dsh plugin --profile web remove dsh-plugin-opencode2api

Uninstalling does not delete $DSH_HOME/dsh-go/opencode2api/. Remove that directory manually if needed.

Supported Platforms

Platform Architecture Status
Windows 10/11 x64 / arm64 Supported
macOS Intel / Apple Silicon Supported
Linux x64 / arm64 Supported
Android (DSH Go, proot) arm64 Supported
iOS — Not supported (App sandbox cannot run external programs)

Capabilities & Risks

The plugin reads and writes local files, downloads and runs external programs, and accesses the network. Please only install from trusted sources; when publicly distributing a proxy for free models, comply with upstream service terms.

Closing

After installing the plugin, closing and reopening DSH will automatically restart the local API. The model list is fetched dynamically from the gateway — no manual maintenance required. To switch to a different opencode2api version, set the environment variable OPENCODE2API_VERSION to override and reinstall. For more details, refer to the plugin catalog page and the GitHub repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye