Add xAI HTTP TTS service

Reworks the xAI TTS integration from #4031 with consistency fixes:
- Rename to XAIHttpTTSService (leaves room for future WebSocket service)
- Add proper language map with all 20 supported xAI languages
- Remove unnecessary deprecated InputParams/params (new service, nothing to deprecate)
- Add encoding as a constructor parameter
- Use Language.EN enum instead of string for default language
- Linting fixes
This commit is contained in:
Mark Backman
2026-03-24 10:30:27 -04:00
parent 79dafb9ac9
commit 9af5c482c6
6 changed files with 277 additions and 134 deletions

View File

@@ -21,7 +21,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
TTSTextFrame,
)
from pipecat.services.xai.tts import XAITTSService
from pipecat.services.xai.tts import XAIHttpTTSService
from pipecat.tests.utils import run_test
@@ -52,7 +52,7 @@ async def test_run_xai_tts_success(aiohttp_client):
base_url = str(client.make_url("/v1/tts"))
async with aiohttp.ClientSession() as session:
tts_service = XAITTSService(
tts_service = XAIHttpTTSService(
api_key="test-key",
base_url=base_url,
aiohttp_session=session,