From 116984feb7432d858dbc4fe14fbe79b2afbfe652 Mon Sep 17 00:00:00 2001 From: Han Date: Thu, 19 Mar 2026 23:49:14 +0800 Subject: [PATCH] feat(tools): add base_url support to OpenAI TTS provider Allow users to configure a custom base_url for the OpenAI TTS provider in ~/.hermes/config.yaml under tts.openai.base_url. Defaults to the official OpenAI endpoint. Enables use of self-hosted or OpenAI-compatible TTS services (e.g. http://localhost:8000/v1). Also adds a TTS configuration example block to cli-config.yaml.example. --- tools/tts_tool.py | 3 ++- website/docs/user-guide/features/voice-mode.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/tts_tool.py b/tools/tts_tool.py index e05d1efef..962ed47a0 100644 --- a/tools/tts_tool.py +++ b/tools/tts_tool.py @@ -239,6 +239,7 @@ def _generate_openai_tts(text: str, output_path: str, tts_config: Dict[str, Any] oai_config = tts_config.get("openai", {}) model = oai_config.get("model", DEFAULT_OPENAI_MODEL) voice = oai_config.get("voice", DEFAULT_OPENAI_VOICE) + base_url = oai_config.get("base_url", "https://api.openai.com/v1") # Determine response format from extension if output_path.endswith(".ogg"): @@ -247,7 +248,7 @@ def _generate_openai_tts(text: str, output_path: str, tts_config: Dict[str, Any] response_format = "mp3" OpenAIClient = _import_openai_client() - client = OpenAIClient(api_key=api_key, base_url="https://api.openai.com/v1") + client = OpenAIClient(api_key=api_key, base_url=base_url) response = client.audio.speech.create( model=model, voice=voice, diff --git a/website/docs/user-guide/features/voice-mode.md b/website/docs/user-guide/features/voice-mode.md index b0f203556..b52286b87 100644 --- a/website/docs/user-guide/features/voice-mode.md +++ b/website/docs/user-guide/features/voice-mode.md @@ -404,6 +404,7 @@ tts: openai: model: "gpt-4o-mini-tts" voice: "alloy" # alloy, echo, fable, onyx, nova, shimmer + base_url: "https://api.openai.com/v1" # optional: override for self-hosted or OpenAI-compatible endpoints neutts: ref_audio: '' ref_text: ''