AssemblyAI outlined Python TTS workflows for one-shot WAV output, WebSocket streaming, barge-in handling and keep-alive sessions.
AssemblyAI published a Python tutorial on streaming text to speech over WebSocket connections, framing it as a workflow for voice agents rather than a simple file-generation task. The company said the approach is designed to handle three live-call problems that saved audio files do not solve: LLM replies that are still being generated, caller interruptions, and long-running sessions that must stay healthy throughout a conversation.
According to the tutorial published on Wed, 28 Oct 2026, the AssemblyAI Text-to-Speech API supports three routes: HTTP for one-shot synthesis, WebSocket for a single session across a conversation, and an OpenAI-compatible speech endpoint. The post says the Python SDK gained text-to-speech support in release 1.8.2 and shows how to install it with pip, set ASSEMBLYAI_API_KEY, and call TextToSpeech.synthesize() to produce a WAV file. It also states that billing is based on billed_characters at $15 per 1M characters, and that the API supports six languages: English, Spanish, French, German, Italian and Portuguese.
The tutorial then moves to TTSSession, which AssemblyAI presents as the preferred interface for a voice agent. In the example code, the session is opened once per conversation, each sentence is spoken as a separate request, and the sample reads the sample rate back from the Begin frame rather than assuming it. The company says WebSocket output is raw 16-bit little-endian PCM in mono, typically at 24 kHz unless configured otherwise, and notes that phone applications often require 8 kHz mu-law instead.
Source link







