
DeepSeek Text to Speech as a Hermes speech provider
Wires DeepSeek's Text to Speech API into Hermes Agent's text_to_speech tool, its streaming voice mode and read-aloud. One file, no dependencies beyond what Hermes already ships, and the vendor caps that would otherwise become a billed 400 are pinned by the tests in tests/.
- Speech —
POST /v1/tools/ttsstreams a WAV back; Hermes writes it and returns the usualMEDIA:tag (and a voice bubble when ffmpeg is present) - Streaming — the same endpoint with
format=pcmfeeds Hermes' streaming voice path as raw 16-bit mono 24 kHz, so voice mode and read-aloud start speaking on the first sentence instead of waiting for the whole reply - Two voices —
stella(female, default) andtide(male). There is no language parameter: the language is detected from the text — Mandarin Chinese, Cantonese, English, Japanese, Korean, Malay, Arabic, Indonesian, Thai and Vietnamese - WAV only — DeepSeek has no MP3/Opus container, so every requested
output_formatlands as a.wav. Hermes converts to Opus itself when a platform needs a voice bubble
At a glance
| Plugin name | deepseek-tts |
| Registered provider | deepseek — the value tts.provider holds |
| Kind | backend — registers one TTS provider: no tools, no hooks |
| Dependencies | none beyond the standard library and the httpx Hermes already ships |
| Tests | 105 stdlib unit + contract tests, 11 Hypothesis property tests — offline, keyless, unbilled — plus tests/dstts-integration.py, 32 checks against a real Hermes install |
| Licence | MIT |
| Affiliation | Community plugin by Jason Swindle. Not affiliated with DeepSeek. DeepSeek is a trademark of its owner; this is an independent client. |
Why this exists
Hermes' default speech backend is Edge TTS: free, keyless, and generic. It is a fine default, but it is not your account and not your voice choice.
This plugin adds a keyed backend on DeepSeek's speech API. You choose one of two voices, the language follows the text, and the streaming voice path gets native 24 kHz PCM instead of falling back to per-sentence synthesis. The failure mode of enabling it is billing, not breakage: if the key is missing or the vendor refuses the text, Hermes reports a failed speech call and the rest of the turn is unaffected.
What actually changes when you enable it
| Before | After | |
|---|---|---|
text_to_speech | Edge TTS (free) | deepseek (your key) |
| Voice mode | per-sentence synthesis unless another streamer is configured | first-sentence PCM streaming from this provider |
| Output format | MP3 (Edge) | WAV — DeepSeek has no compressed container |
| Voices | Edge's catalog | stella (default), tide |
| Cost | $0 | $0.45 per 10,000 characters at list price |
Install
From the plugin catalog once the entry lands (community tier):
hermes plugins install deepseek-tts --enable
Straight from this repository (add --ref <40-character sha> to pin a reviewed commit):
hermes plugins install JasonSwindle/hermes-deepseek-tts --enable
A git or catalog install lands as a top-level plugin, so it is enabled under the plugin name. A manual clone behaves the same:
git clone https://github.com/JasonSwindle/hermes-deepseek-tts \
~/.hermes/plugins/deepseek-tts
hermes plugins enable deepseek-tts
Then point speech at the provider and supply the key:
hermes config set tts.provider deepseek
hermes config set tts.voice tide # optional; stella is the default
export DEEPSEEK_API_KEY=*** # or store it in your Hermes secrets / ~/.hermes/.env
Requires Hermes Agent 0.22.0 or newer (the manifest declares requires_hermes: ">=0.22.0", because the filter_markdown setting uses the 0.22 plugin-settings surface; an older host refuses to load the plugin instead of silently dropping the setting). No extra packages. Installing or enabling takes effect on the next session; a settings change is read per request, and a tts.provider / tts.voice change is picked up on the next speech call.
Confirm with hermes plugins list (expect enabled … deepseek-tts), hermes tools (the speech picker lists DeepSeek TTS), and hermes doctor if a voice mode sentence produces no sound.
To revert:
hermes config unset tts.provider
hermes config unset tts.voice
hermes plugins disable deepseek-tts
That returns speech to Hermes' default provider. It does not restore a different backend you had configured before.
How it works
- Hermes resolves the TTS backend from
tts.provider. This plugin registers the namedeepseekthroughctx.register_tts_provider(), so the tool, thetts.providersetting, thehermes toolspicker and the streaming voice path all see it as one provider. synthesize()posts compact JSON —{text, voice_id, format: "wav"}plusfilter_markdownwhen the setting holds a real boolean — and streams the response into a temporary file beside the destination. The destination is replaced only after the whole body arrived and passed the WAV check (RIFF/WAVE), so a failed attempt can neither truncate nor corrupt a file a previous call wrote.stream()postsformat: "pcm"and yields the vendor's bytes verbatim: signed 16-bit little-endian mono at 24 kHz. It advertisesstreams_pcm = Trueandstream_sample_rate = 24000, which is how Hermes' voice mode, the dashboard speak-stream and gateway streaming audio join this provider. A non-PCMformatis refused rather than mislabelled. Concurrent calls for consecutive sentences share no state.- The text is UTF-8-sanitised (unpaired surrogates become U+FFFD) and stripped. A text over 10,000 billed characters or one whose JSON body would pass 64 KiB is clamped at a word boundary and logged. Hermes'
text_to_speechtool already splits long input at 4,000 characters for a plugin provider, so this is a guard for directsynthesize()callers and for a home that raisedtts.deepseek.max_text_length— not the normal path. tts.voiceis normalised case-insensitively. An unknown voice falls back tostellawith one warning instead of becoming a billed vendor 400.modelandspeedare accepted and ignored: the API has neither.- HTTP 429 (more than 50 requests in progress) and 503 (busy) are retried twice, 1 s then 2 s, each plus up to 0.25 s of jitter, and only before a single audio byte has been read. A retry never resumes a partial stream. 504 (synthesis timed out), 500 and every other status are reported once — a timeout may already have been billed, and a silent second charge is worse than one clear error. Redirects are not followed: the bearer key never leaves
api.deepseek.com(or a loopback test host). - Failures raise, as the ABC requires, and Hermes turns them into its standard
{success: false, error}envelope.is_available()is an environment check only — Hermes calls it every time it paints the tools picker — and a profile-scoped secret refusal is reported as unavailable, never as a traceback.
Costs, limits and behaviour
Billing. DeepSeek bills $0.45 per 10,000 characters at list price ($0.225 at the limited-time 50% price). A Chinese character counts as 2 characters; any other character, including a space, counts as 1. The live acceptance sample below is 123 billed characters, about $0.0055 at list price. Rates change — check DeepSeek's pricing page — and failed syntheses are not separately billed by this plugin's retry logic because it only retries before any audio is produced.
Vendor limits.
| Limit | Value | What the plugin does |
|---|---|---|
| Billed characters per request | 10,000 | clamps at a word boundary and logs one warning |
| Request body | 64 KiB | counts JSON escaping, so quotes and backslashes cannot overflow it silently |
| Audio per request | 30 minutes | passes the vendor error through; Hermes chunking keeps normal replies far below it |
| Requests in progress | 50 per account | retries 429 twice, then reports it |
| Speed control | not supported | speed is ignored |
| Resume | not supported | a cut-off response is a failed synthesis |
| Audio formats | wav or pcm | always WAV for files, PCM for the streaming path |
Formats. synthesize() always asks for wav and returns a path ending in .wav. If Hermes asked for output_format: mp3, ogg, opus or flac, the closest lossless equivalent is WAV; the returned path is the one Hermes uses, so the caller's .mp3 name is never left pointing at WAV bytes. WAV is 24 kHz mono 16-bit — about 2.9 MB per minute, noticeably larger than MP3. That is the vendor's only container, not a plugin choice. DeepSeek streams the WAV unsized — both the RIFF and data chunk sizes arrive as 0xFFFFFFFF — so the plugin back-fills both to the bytes on disk before the file is served; ffmpeg rescans anyway, so voice-bubble conversion is unchanged.
On a Hermes host without ffmpeg the WAV is delivered as-is, and one 4,000-character chunk (~5 min, ~14.5 MB) exceeds the 10 MB delivery cap, so the tool fails with "Final-encoded TTS chunk exceeds ... delivery limit" instead of delivering a partial read.
Chunking. For a provider Hermes does not recognise (this plugin registers under a name, not as a built-in), Hermes splits text at 4,000 characters and synthesises each chunk separately. Every chunk is one vendor request and one file. WAV chunks are delivered as separate files, not concatenated, so a long reply can arrive as several attachments; a platform's upload limit can split them further. Nothing is silently truncated: whatever Hermes hands over is what gets spoken.
A cut-off response is a failure. DeepSeek streams audio while it synthesises, so if synthesis fails after the audio started the response simply ends. The plugin compares the bytes received with Content-Length when the vendor declared one, requires a non-empty body, and requires RIFF/WAVE for a WAV — so a truncated download, a proxy's HTML page or a vendor change is reported instead of being delivered as a 0-second voice note.
Rate limits, observed. The guide states at most 50 requests in progress per account; a 429 beyond that. This plugin's retries were exercised against the vendor only through the documented behaviour above (the live probe was a single short request); no load generation is part of the suite or CI.
Security
- The API key is read through Hermes' provider env helper (
get_provider_env), never logged, and sent only as anAuthorization: Bearerheader toapi.deepseek.com. A profile-scoped refusal becomes an unavailable/error result, never a traceback and never another profile's key. DEEPSEEK_BASE_URLexists for tests and is validated: only the exact originhttps://api.deepseek.com(https, no userinfo, port 443/absent, no path/query/fragment) or a loopback host (127.0.0.1,localhost,::1) is accepted. Another host, plaintext to the real host, userinfo tricks, suffix lookalikes and malformed values are refused with a warning that names only the scheme/host — never the raw value, which could carry a credential. A freely redirectable base URL would hand the bearer key to whoever set the variable, so there is deliberately no escape hatch.- No redirects are followed, for the same reason.
- The response is treated as hostile input: the error body is read through a 4 KiB window, control characters are stripped, detail is capped at 300 characters, a WAV must carry its magic bytes, and a short body is a failure. The destination file is replaced atomically.
- No file I/O outside the output path Hermes hands over, no subprocesses, no dynamic imports, no telemetry. One outbound endpoint.
FAQ
Is this official or affiliated with DeepSeek?
No. It is an independent client of DeepSeek's public API, published as a community plugin.
Why does a 30-second reply produce a multi-megabyte file?
Because the API returns WAV or raw PCM. There is no MP3/Opus option to ask for. Hermes converts WAV to Opus when a platform needs a voice bubble, so the large file is usually short-lived.
Can I use both voices in one reply?
Not through this plugin: tts.voice is the voice for the provider, and the API takes one voice_id per request. A language switch inside a reply does not switch voices.
What happens to a 40,000-character reply?
Hermes splits it into 4,000-character chunks before the plugin sees it, so each request is well under the 10,000-character cap and the files are delivered separately. A direct synthesize() call with more than 10,000 billed characters is clamped, not split, and the clamp is logged.
Does it hold the whole WAV in memory?
No. Both the file and the streaming path consume the response chunk by chunk; only the 12-byte WAV header and a running byte count are kept for validation.
Can I use my own proxy or a local mock?
A loopback host is accepted for tests; any other base URL is refused. That is deliberate: the environment variable must not be able to redirect a bearer key.
Settings
| Setting | Default | Effect |
|---|---|---|
filter_markdown | true | Sends filter_markdown so the vendor removes Markdown before reading. Hermes' text_to_speech already strips Markdown, so this mainly affects direct synthesize() calls. A non-boolean in a hand-edited config is ignored and the vendor default applies; a failed settings read never fails the call. Read per request, so a change lands without a restart. |
Set it in the Desktop/TUI plugin settings, or:
hermes config set plugins.entries.deepseek-tts.settings.filter_markdown false
Tests
# no-Hypothesis tier (stdlib unittest + httpx; no key, no network, no billing)
python -m unittest discover -s tests
# full tier, adding the Hypothesis property tests
uv venv .venv-dev
uv pip install --python .venv-dev/bin/python -r requirements-dev.txt
.venv-dev/bin/python -m unittest discover -s tests
Both tiers run offline against a loopback mock vendor (DEEPSEEK_BASE_URL points at it) and need no API key. The integration tier drives Hermes' real dispatcher:
<hermes-venv>/bin/python tests/dstts-integration.py --hermes-source <hermes-checkout>
It needs a Python with Hermes' dependencies (the Hermes venv) and asserts provider resolution, the tts.voice / format / setting the request carries, the success envelope and MEDIA tag, chunking, the PCM streaming route, and the error envelope for a vendor 400 and a missing key. It never touches the real API.
Then, once and only with a key, the live acceptance — the only run that spends money (about $0.0055):
export DEEPSEEK_API_KEY=***
python tests/dstts-live-accept.py --spend --keep
With no key and no network, python tests/dstts-live-accept.py --check-file <wav> runs the header-versus-bytes checks on an existing file.
Before a catalog pin, validate a clean export (a working tree carrying .venv-dev/ fails the security scan on the virtualenv, not on the plugin):
git archive HEAD | tar -x -C /tmp/dstts-validate
hermes plugins validate /tmp/dstts-validate
Keywords
Hermes Agent, TTS, text-to-speech, speech synthesis, DeepSeek, voice mode, streaming TTS, PCM, WAV, stella, tide, Mandarin, Cantonese, Japanese, Korean, Arabic, Thai, Vietnamese.
License
MIT. See LICENSE.
README from the reviewed commit b21d40e; it updates when the author re-pins.

JasonSwindle
