> ## Documentation Index
> Fetch the complete documentation index at: https://platform.perso.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Text to Speech

> Convert text into speech audio with any voice, as a single file or a live stream.

Convert text into natural speech using any voice from the [Voices](/docs/voices) API. Served from
`https://platform.perso.ai`; authenticate with `PersoPlatform-APIKey` (or `xi-api-key` for
ElevenLabs-compatible SDKs).

## Synthesize speech

`POST /api/speech/v1/text-to-speech/{voice_id}`

The `output_format` query parameter is **required**. Supported values: `wav_24000` (default),
`wav_44100`, `mp3_44100`, `pcm_24000`, `pcm_44100`.

Request body:

| Field            | Required | Description                                                    |
| ---------------- | -------- | -------------------------------------------------------------- |
| `text`           | yes      | The text to synthesize.                                        |
| `model_id`       | no       | TTS model; defaults to `perso_multilingual_v1`.                |
| `voice_settings` | no       | Optional tuning object (e.g. `stability`, `similarity_boost`). |

```shellscript theme={null}
curl -X POST 'https://platform.perso.ai/api/speech/v1/text-to-speech/<VOICE_ID>?output_format=mp3_44100' \
  -H 'PersoPlatform-APIKey: <YOUR-KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "text": "Hello from Perso!",
    "model_id": "perso_multilingual_v1"
  }' \
  --output speech.mp3
```

The response body is the raw audio in the requested `output_format`.

## Stream

For low-latency playback, stream the audio as it is generated instead of waiting for the full
file:

`POST /api/speech/v1/text-to-speech/{voice_id}/stream`

Same path, query parameter, and body — the response is a chunked audio stream you can play or save
progressively.

```shellscript theme={null}
curl -X POST 'https://platform.perso.ai/api/speech/v1/text-to-speech/<VOICE_ID>/stream?output_format=mp3_44100' \
  -H 'PersoPlatform-APIKey: <YOUR-KEY>' \
  -H 'Content-Type: application/json' \
  -d '{ "text": "Streaming speech, chunk by chunk." }' \
  --output stream.mp3
```

<Tip>
  Use `wav_24000` for the lowest latency and `mp3_44100` for a smaller download. Find a
  `voice_id` with the [Voices](/docs/voices) API.
</Tip>
