The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(tts): add optional provider parameter to text_to_speech tool
Carlos Diosdado462b3cf994c0
diff --git a/tools/tts_tool.py b/tools/tts_tool.pyindex 9ad3d2f1d29..2167264fff5 100644--- a/tools/tts_tool.py+++ b/tools/tts_tool.py@@ -2577,6 +2577,7 @@ def text_to_speech_tool(output_path: Optional[str] = None,speed: Optional[float] = None,instructions: Optional[str] = None,+ provider: Optional[str] = None,) -> str:"""Convert text to speech audio.@@ -2596,6 +2597,14 @@ def text_to_speech_tool(accent, whispering). Forwarded to the OpenAI backend(gpt-4o-mini-tts and OpenAI-compatible servers). Silentlyignored by backends that don't support it.+ provider: Optional TTS provider override. When set, bypasses the+ configured ``tts.provider`` and uses this provider instead.+ Accepts built-in names (``edge``, ``openai``, ``elevenlabs``,+ ``minimax``, ``xai``, ``mistral``, ``gemini``, ``neutts``,+ ``kittentts``, ``piper``), user-declared command provider names+ from ``tts.providers.<name>``, or plugin-registered provider+ names. When ``None`` (the default), the configured provider+ from ``tts.provider`` in config.yaml is used.Returns:str: JSON result with success, file_path, and optionally MEDIA tag.@@ -2619,7 +2628,12 @@ def text_to_speech_tool(clamped = max(0.25, min(4.0, float(speed)))tts_config = dict(tts_config) # shallow copy to avoid mutating the cachetts_config["speed"] = clamped- provider = _get_provider(tts_config)++ # Allow per-call provider override; fall back to the configured default.+ if provider:+ provider = provider.lower().strip()+ else:+ provider = _get_provider(tts_config)# User-declared command provider (type: command under tts.providers.<name>)# resolves BEFORE the built-in dispatch. Built-in names short-circuit here@@ -3355,6 +3369,16 @@ TTS_SCHEMA = {"Forwarded to the OpenAI backend (gpt-4o-mini-tts and OpenAI-compatible ""voice-design servers). Silently ignored by backends that don't support it.")+ },+ "provider": {+ "type": "string",+ "description": (+ "Optional TTS provider override. Accepts built-in names "+ "(edge, openai, elevenlabs, minimax, xai, mistral, gemini, "+ "neutts, kittentts, piper), user-declared command provider "+ "names from tts.providers.<name>, or plugin-registered names. "+ "When omitted, the configured tts.provider from config.yaml is used."+ )}},"required": ["text"]@@ -3369,7 +3393,8 @@ registry.register(text=args.get("text", ""),output_path=args.get("output_path"),speed=args.get("speed"),- instructions=args.get("instructions")),+ instructions=args.get("instructions"),+ provider=args.get("provider")),check_fn=check_tts_requirements,emoji="🔊",)