The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
chore: merge origin/main (resolve apps/desktop/src/lib/voice-client-direct.ts, hermes_cli/config_defaults.py, tools/voice_client_config.py, website/docs/user-guide/features/tts.md)
teknium1ec2c4eeb8032
diff --cc apps/desktop/src/lib/voice-client-direct.tsindex 827ce99dbc2,dc456714cf0..972c8da7420--- a/apps/desktop/src/lib/voice-client-direct.ts+++ b/apps/desktop/src/lib/voice-client-direct.ts@@@ -38,8 -40,8 +40,10 @@@ export interface DirectTtsConfigmodel: null | stringvoice: null | stringspeed: null | number+ /** tts.streaming.min_len — shortest first sentence (chars) cut on its own; absent on older backends. */+ min_len?: null | number+ /** Optional tts.openai fields the server forwards verbatim (lang_code, consent_attestation). */+ extra_body?: Record<string, unknown>}interface RelayConfig {diff --cc hermes_cli/config_defaults.pyindex 7aa1f50844b,9338fb22a3e..3ea40e1e1d8--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@@ -1037,9 -1044,9 +1049,12 @@@ DEFAULT_CONFIG =# gpt-4o-mini-tts voices: alloy, ash, ballad, cedar, coral, echo, fable, marin, nova,# onyx, sage, shimmer, verse"voice": "alloy",+ # 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,+ # Forwarded verbatim in the request body for OpenAI-compatible servers whose cloned+ # voices demand it (400 consent_required otherwise); "" sends nothing.+ "consent_attestation": "",},"gemini": {"model": "gemini-2.5-flash-preview-tts",diff --cc tools/tts_streaming.pyindex 4e280608b4d,838cd7e853d..5c4ea4af63c--- a/tools/tts_streaming.py+++ b/tools/tts_streaming.py@@@ -261,16 -215,12 +261,18 @@@ class OpenAIStreamer(StreamingTTSProvidclient = 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 = rateyield from _capped(response.iter_bytes(), "OpenAI streaming TTS")diff --cc tools/voice_client_config.pyindex 109a80f8a9f,97fbdf87f28..c0fb356a4f9--- a/tools/voice_client_config.py+++ b/tools/voice_client_config.py@@@ -179,7 -179,7 +183,8 @@@ def _resolve_tts_client_config() -> Dicspeed = 1.0return _direct(TTS_WIRE_OPENAI, "openai", base_url, api_key, model,voice=oai.get("voice") or tts_tool_openai.DEFAULT_OPENAI_VOICE, speed=speed,- extra_body=tts_tool_openai._openai_extra_body(oai))++ extra_body=tts_tool_openai._openai_extra_body(oai),+ min_len=min_len)if provider == "elevenlabs":api_key = tts._resolve_provider_key("ELEVENLABS_API_KEY", "elevenlabs")if not api_key:diff --cc website/docs/user-guide/features/tts.mdindex 65cdf2d7417,bd94b29f491..af3cf9f324c--- a/website/docs/user-guide/features/tts.md+++ b/website/docs/user-guide/features/tts.md@@@ -56,11 -56,9 +56,12 @@@ ttsmodel: "gpt-4o-mini-tts"voice: "alloy" # alloy, echo, fable, onyx, nova, shimmerbase_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+ streaming:+ min_len: 20 # Streaming TTS: shortest first sentence (chars) spoken on its own; CJK setups use ~6minimax:region: "global" # "global" or "cn"; see selection rules belowmodel: "speech-02-hd" # speech-02-hd (default), speech-02-turbo@@@ -147,10 -145,10 +148,12 @@@ ttsThe 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