curl --request POST \
--url https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id} \
--header 'Content-Type: application/json' \
--header 'PersoPlatform-APIKey: <api-key>' \
--header 'xi-api-key: <api-key>' \
--data '
{
"text": "Hello, this is a text to speech test.",
"model_id": "perso_multilingual_v1"
}
'import requests
url = "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}"
payload = {
"text": "Hello, this is a text to speech test.",
"model_id": "perso_multilingual_v1"
}
headers = {
"PersoPlatform-APIKey": "<api-key>",
"xi-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'PersoPlatform-APIKey': '<api-key>',
'xi-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Hello, this is a text to speech test.',
model_id: 'perso_multilingual_v1'
})
};
fetch('https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'Hello, this is a text to speech test.',
'model_id' => 'perso_multilingual_v1'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PersoPlatform-APIKey: <api-key>",
"xi-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}"
payload := strings.NewReader("{\n \"text\": \"Hello, this is a text to speech test.\",\n \"model_id\": \"perso_multilingual_v1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PersoPlatform-APIKey", "<api-key>")
req.Header.Add("xi-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}")
.header("PersoPlatform-APIKey", "<api-key>")
.header("xi-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is a text to speech test.\",\n \"model_id\": \"perso_multilingual_v1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PersoPlatform-APIKey"] = '<api-key>'
request["xi-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is a text to speech test.\",\n \"model_id\": \"perso_multilingual_v1\"\n}"
response = http.request(request)
puts response.read_body"<string>"Text to Speech
Convert text to speech audio using a specified voice.
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).
| Parameter | Required | Description |
|---|---|---|
voice_id | Yes | The ID of the voice to use for speech generation. Retrieve available voice IDs from List Voices (GET /v2/voices). |
output_format | Yes | Audio format. Default: wav_24000 (see formats below) |
Request Body Parameters
| Parameter | Required | Description |
|---|---|---|
text | Yes | Text to convert to speech |
model_id | No | Default: perso_multilingual_v1 |
Output Formats
| Format | Content-Type | Description |
|---|---|---|
pcm_24000 | audio/L16 | Raw PCM 24kHz |
wav_24000 | audio/wav | WAV 24kHz |
mp3_44100_192 | audio/mpeg | MP3 44.1kHz 192kbps |
Example
Select “TextToSpeechRequest” from the Examples dropdown to see a request example.
curl --request POST
--url "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}?output_format=mp3_44100_192"
--header "PersoPlatform-APIKey: <your-api-key>"
--header "Content-Type: application/json"
--header "Accept: */*"
--data '{"text": "Hello, this is a text to speech test."}'
curl --request POST \
--url https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id} \
--header 'Content-Type: application/json' \
--header 'PersoPlatform-APIKey: <api-key>' \
--header 'xi-api-key: <api-key>' \
--data '
{
"text": "Hello, this is a text to speech test.",
"model_id": "perso_multilingual_v1"
}
'import requests
url = "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}"
payload = {
"text": "Hello, this is a text to speech test.",
"model_id": "perso_multilingual_v1"
}
headers = {
"PersoPlatform-APIKey": "<api-key>",
"xi-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'PersoPlatform-APIKey': '<api-key>',
'xi-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Hello, this is a text to speech test.',
model_id: 'perso_multilingual_v1'
})
};
fetch('https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'Hello, this is a text to speech test.',
'model_id' => 'perso_multilingual_v1'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PersoPlatform-APIKey: <api-key>",
"xi-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}"
payload := strings.NewReader("{\n \"text\": \"Hello, this is a text to speech test.\",\n \"model_id\": \"perso_multilingual_v1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PersoPlatform-APIKey", "<api-key>")
req.Header.Add("xi-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}")
.header("PersoPlatform-APIKey", "<api-key>")
.header("xi-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is a text to speech test.\",\n \"model_id\": \"perso_multilingual_v1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/speech/v1/text-to-speech/{voice_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PersoPlatform-APIKey"] = '<api-key>'
request["xi-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is a text to speech test.\",\n \"model_id\": \"perso_multilingual_v1\"\n}"
response = http.request(request)
puts response.read_body"<string>"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
Audio binary. Content-Type depends on output_format: audio/wav, audio/mpeg, or audio/L16.
The response is of type file.

