dsh-tts: Text-to-Speech with OpenAI-Compatible Backend

Preface

Making an agent “speak” in DSH usually involves writing separate invocation logic for each TTS service, querying voice lists, and handling response formats. Once the backend is switched to a self-built or third-party OpenAI-compatible interface, the glue code has to be rewritten all over again. dsh-tts is an out-of-tree plugin published by the maintainer xuan25 (community directory category: model inference). It provides a unified tts tool that writes text to audio files via any OpenAI-compatible TTS backend, and comes with capabilities such as listing voices, probing routes, and calling the development-only phonemize, reducing the cost of splitting tools per backend.

What Is This

dsh-tts (npm package name dsh-tts, version 0.1.0 in the current documentation, MIT license) targets the DeepSeek Harness profile: after installation it registers a tts tool supporting output formats such as wav, mp3, flac, aac, opus, and pcm. The plugin does not create configuration files or state files; configuration is merged hierarchically, and the providers verb indicates which layer each field comes from, avoiding silent overrides.

Core Features

The tts tool distinguishes behaviors by verb. The table below is excerpted from the official README.

verb Network access Purpose
synth Yes Synthesize speech, write to disk, and validate the container of the returned bytes
voices Yes List backend voices; if GET {baseURL}/audio/voices returns 404, fall back to the static OpenAI table and mark source: static
providers No List configured routes, field sources, and credential status
models Depends If a model is declared, use the configuration; otherwise live-probe GET {baseURL}/models
status Yes Probe each route: /models and the optional service root GET /health
phonemize Yes Call the service root POST /dev/phonemize; if 404/405, report as unsupported

Key points for synth (consistent with the documentation):

  1. voice is required, with no default value; available ids can be queried via voices.
  2. When model is not passed: if the route declares exactly one model, use that model; if none is declared, live-probe /models; if there is more than one candidate, fail and list the candidates.
  3. response_format defaults to wav, passed to the backend as-is.
  4. The tool validates the returned container (e.g., the RIFF walk for wav, magic bytes for other formats); if it does not match the declared format, it fails but keeps the file; known defects (e.g., placeholder RIFF sizes) can be reported via warnings in the success result.
  5. Output path: if out is set, it is a file or directory; when omitted, writes to <process.cwd()>/tts/<unixts>_<voice>.<ext>.
  6. speed and language are only forwarded when provided by the caller.
  7. Timeouts: synth 180 s; probing 15 s; phonemize 30 s.

The plugin ships with a dsh-tts skill so agents can consult the parameter table, environment variable conventions, and error shapes in their context.

Installation and Activation

Run the official install command under the specified dsh profile:

dsh plugin --profile <name> add dsh-tts

Before installing, it is recommended to review the GitHub repository source code and MIT license yourself; the plugin runs with the permissions of the current dsh process and will access the network and read/write output paths as configured.

Configuration

Priority from low to high: built-in defaults (api: openai-compatible) → TTS_* environment variables (static at process startup) → cordis patch (the config with id dsh-tts or a profile-level patch) → the dsh-tts: section in $DSH_HOME/settings.yaml (re-read on every invocation; changing settings does not require a restart).

Settings example:

dsh-tts:
  defaultProvider: local
  providers:
    local:
      baseURL: http://<host>:<port>/v1
    hosted:
      baseURL: https://api.example.com/v1
      apiKeyEnv: TTS_HOSTED_KEY
      models: [kokoro-v2]
      displayName: Hosted Speech

Environment variables correspond one-to-one with configuration fields: TTS_DEFAULT_PROVIDER; each route <NAME> maps to TTS_PROVIDER_<NAME>_BASEURL, TTS_PROVIDER_<NAME>_API, TTS_PROVIDER_<NAME>_APIKEYENV, TTS_PROVIDER_<NAME>_HEADERS (a JSON string), TTS_PROVIDER_<NAME>_MODELS (comma-separated), and TTS_PROVIDER_<NAME>_DISPLAYNAME. <NAME> is uppercase with - converted to _. baseURL must include the /v1 prefix; the plugin appends /audio/speech, /audio/voices, and /models after it, and strips the trailing /v1 from the base to access the service root’s /health and /dev/phonemize. apiKeyEnv contains only the environment variable name; it is resolved from the process environment or $DSH_HOME/.credentials.yaml at request time.

Typical Usage

The following JSON call examples come from the README; you can read them directly alongside the verbs to understand the parameters.

// Default route and its single declared model
{ "verb": "synth", "input": "hello world", "voice": "zf_xiaoxiao" }
// Specify route, format, speed, and output
{ "verb": "synth", "provider": "hosted", "input": "the quick brown fox",
  "voice": "zf_xiaoxiao", "response_format": "mp3", "speed": 1.1, "out": "/tmp/hi.mp3" }
// Filter voices by id prefix
{ "verb": "voices", "filter": "zf_" }
// Match by id/name substring (case-insensitive)
{ "verb": "voices", "query": "zf" }
{ "verb": "providers" }
{ "verb": "status" }
{ "verb": "phonemize", "text": "hello world", "language": "zh" }

Recommended flow: first use providers to confirm routes and credentials → status / voices to confirm backend reachability and voices → then synth. With multiple routes and no default set, you must pass provider in the call, or set TTS_DEFAULT_PROVIDER / defaultProvider.

Use Cases and Notes

Suitable for: developers already running agents in DSH who want to use a single set of tools to integrate local or hosted OpenAI-compatible TTS (including listing models/voices, health checks, and optional phonemize).

Notes:

  1. The plugin’s capability boundaries are defined by the README and the skill; do not assume backend behaviors that do not appear in the documentation.
  2. When voices returns source: static, the list may not match the backend’s actual voices.
  3. Failures return JSON with an error field; common cases include TTS_NOT_CONFIGURED, credentials not set, unknown provider, multiple routes without a default, and container validation failures. The README’s Troubleshooting section has corresponding explanations.
  4. The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub directory page is a community site with no official affiliation with DeepSeek / High-Flyer (幻方).

Summary

dsh-tts consolidates synthesis, voices, route status, and phonemize into a single tts tool, with layered, observable configuration, making it easy for agents to implement voice output on OpenAI-compatible TTS without writing glue code for each backend.

  • Directory page: https://www.skillhub.cn/plugins/xuan25/dsh-tts
  • Source code and documentation: https://github.com/xuan25/dsh-tts
羽毛球分组比赛记分
小程序二维码

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

Xiaoye