Stream TTS from a Node backend
The minimum viable pattern for shipping low-latency AI voice inside a web app.
- Create an API key with the tts:write scope.
- Call POST /v1/text-to-speech/:voice/stream with output_format=mp3_44100_128 as a query param.
- Pipe response.body straight into your HTTP response with Content-Type audio/mpeg.
- On the client, play the response with new Audio(URL.createObjectURL(blob)).
- Add a small warm-up ping on session start to hide TTS cold starts.