Stream Text to Speech
Convert text to speech with streaming response for real-time playback.
Prerequisites
You must have at least one cloned voice. Use Create Voice (POST /v1/voices/add) to create a voice, then retrieve its voice_id from List Voices (GET /v2/voices).
Authenticate using the PersoPlatform-APIKey header.
--header 'PersoPlatform-APIKey: <your-api-key>'
URL Path Parameters
Replace {voice_id} in the URL with your voice ID. Retrieve available voice IDs from List Voices (GET /v2/voices).
POST /v1/text-to-speech/{voice_id}/stream
Request Parameters
| Parameter | Required | Description |
|---|---|---|
text | Yes | Text to convert to speech |
model_id | No | Default: perso_multilingual_v1 |
Query Parameters
| Parameter | Required | Description |
|---|---|---|
output_format | Yes | Audio format for streaming. Default: wav_24000 (see formats below) |
How It Works
Audio chunks are streamed as they are generated, enabling:
- Lower latency for first audio
- Real-time playback during generation
- Reduced memory usage for long text
Example
Select “TextToSpeechStreamRequest” from the Examples dropdown to see a request example.
curl -X POST "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}/stream?output_format=mp3_44100_192" -H "PersoPlatform-APIKey: <your-api-key>" -H "Content-Type: application/json" -H "Accept: */*" -d '{"text": "Hello, this is a streaming test."}' --output audio.mp3
Authorizations
Use this header if you want to call the API with an ElevenLabs-compatible SDK. Pass your Perso API key as the xi-api-key header value.
Path Parameters
The ID of the voice to use for speech generation. Retrieve available voice IDs from List Voices (GET /v2/voices).
Query Parameters
The desired audio output format.
mp3_44100, pcm_24000, pcm_44100, wav_24000, wav_44100 Body
Response
Streaming audio binary. Content-Type depends on output_format: audio/wav, audio/mpeg, or audio/L16.
The response is of type file.

