Skip to content

The agent that grows with you

chore: merge origin/main (resolve hermes_cli/config_defaults.py)

teknium1c5490df54bc1
diff --cc hermes_cli/config_defaults.py
index 7c507d0f69d,9338fb22a3e..da3da4b8e9d
--- a/hermes_cli/config_defaults.py
+++ b/hermes_cli/config_defaults.py
@@@ -1032,9 -1044,9 +1044,12 @@@ DEFAULT_CONFIG =
# gpt-4o-mini-tts voices: alloy, ash, ballad, cedar, coral, echo, fable, marin, nova,
# onyx, sage, shimmer, verse
"voice": "alloy",
+ # Forwarded verbatim in the request body for OpenAI-compatible servers whose cloned
+ # voices demand it (400 consent_required otherwise); "" sends nothing.
+ "consent_attestation": "",
+ # Raw PCM rate for streaming playback. OpenAI emits 24 kHz; a compatible endpoint that
+ # reports its rate (X-Audio-Sample-Rate header) overrides this automatically.
+ "pcm_sample_rate": 24000,
},
"gemini": {
"model": "gemini-2.5-flash-preview-tts",
diff --cc tools/tts_streaming.py
index e20f66980be,838cd7e853d..7a73fda1d1e
--- a/tools/tts_streaming.py
+++ b/tools/tts_streaming.py
@@@ -251,16 -215,12 +251,18 @@@ class OpenAIStreamer(StreamingTTSProvid
client = OpenAI(
api_key=(self.section.get("api_key") or resolve_openai_audio_api_key()),
base_url=(self.section.get("base_url") or get_env_value("OPENAI_BASE_URL") or None))
+ from tools.tts_tool_openai import _openai_extra_body
+ extra = {"extra_body": body} if (body := _openai_extra_body(self.section)) else {}
with client.audio.speech.with_streaming_response.create(
model=self.section.get("model", "gpt-4o-mini-tts"), voice=self.section.get("voice", "alloy"),
- input=text, response_format="pcm",
+ input=text, response_format="pcm", **extra,
) as response:
+ # Runs on the first next(), before any audio is yielded, so consumers reading
+ # ``sample_rate`` after the first chunk open their device at the endpoint's rate.
+ rate = _sample_rate_from_headers(getattr(response, "headers", None))
+ if rate is not None and rate != self.sample_rate:
+ logger.info("TTS endpoint reports %d Hz PCM (expected %d Hz); honoring it", rate, self.sample_rate)
+ self.sample_rate = rate
yield from _capped(response.iter_bytes(), "OpenAI streaming TTS")
diff --cc website/docs/user-guide/features/tts.md
index a7e37623895,bd94b29f491..822e65246b0
--- a/website/docs/user-guide/features/tts.md
+++ b/website/docs/user-guide/features/tts.md
@@@ -56,9 -56,9 +56,10 @@@ tts
model: "gpt-4o-mini-tts"
voice: "alloy" # alloy, echo, fable, onyx, nova, shimmer
base_url: "https://api.openai.com/v1" # Override for OpenAI-compatible TTS endpoints
+ pcm_sample_rate: 24000 # Streaming PCM rate expected from the endpoint (auto-overridden by X-Audio-Sample-Rate)
speed: 1.0 # 0.25 - 4.0
# language: "es" # Sent as lang_code — only for OpenAI-compatible endpoints that support it (e.g. Kokoro)
+ # consent_attestation: "I have the speaker's consent" # Required by some OpenAI-compatible servers for cloned voices
minimax:
region: "global" # "global" or "cn"; see selection rules below
model: "speech-02-hd" # speech-02-hd (default), speech-02-turbo
@@@ -145,10 -145,10 +146,12 @@@ tts
The rewrite uses `auxiliary.tts_audio_tags` and defaults to your main chat model. Override that auxiliary task if you want tag insertion handled by a cheaper or faster model.
+**Streaming sample rate (OpenAI-compatible endpoints)**: streaming playback receives headerless raw PCM, so Hermes must know its sample rate. The official OpenAI API emits 24 kHz. A compatible server that reports its rate — the `X-Audio-Sample-Rate` response header, or `rate=` in the `Content-Type` (`audio/pcm; rate=44100`) — is honored automatically: the speaker, the temp-WAV player and the gateway audio stream all open at the reported rate once the response arrives. For servers that report nothing, set `tts.openai.pcm_sample_rate` to the endpoint's output rate (e.g. `22050` for Piper-backed servers); otherwise speech plays at the wrong speed and pitch. Invalid values log a warning and fall back to `24000`.
+
**Language (OpenAI-compatible endpoints)**: `tts.openai.language` is forwarded to the endpoint as a `lang_code` request parameter. It is intended for OpenAI-compatible TTS servers that support `lang_code` — for example [Kokoro-FastAPI](https://github.com/remsky/Kokoro-FastAPI), where `language: "es"` selects the Spanish phonemizer instead of the English default. Leave it unset when using the official OpenAI API, which does not accept this parameter. When unset, nothing extra is sent.
+ **Cloned-voice consent (OpenAI-compatible endpoints)**: some self-hosted OpenAI-compatible TTS servers reject a cloned voice with `400 consent_required` unless the request carries a `consent_attestation` field. Set `tts.openai.consent_attestation` to the attestation text your server expects; Hermes forwards it verbatim in the request body on every OpenAI-compatible path (whole-file synthesis, streaming, and the desktop's client-direct voice). Leave it unset for the official OpenAI API — when unset, the field is not sent.
+
### Input length limits