For real-time playback, use POST /v1/tts/stream. It returns raw 16-bit PCM at 44.1 kHz as it is generated, so you can start playing before synthesis finishes:
Python
import requestswith requests.post( "https://api.chariot.in/v1/tts/stream", headers={"chariotai-api-key": "YOUR_API_KEY"}, json={ "voice_id": "bac7d666-094d-4698-91fa-741d60fce662", "text": "This audio streams back as it is generated.", }, stream=True,) as resp: resp.raise_for_status() for chunk in resp.iter_content(chunk_size=4096): # Feed each PCM chunk straight into your audio player. play(chunk) # replace with your playback sink
The stream is headerless PCM (audio/L16, 44100 Hz, mono, signed 16-bit little-endian), not a WAV file. Your player must be configured for that format, or you must prepend a WAV header yourself. The fully assembled WAV is also available at the X-audio-url header once the stream completes.