Generate TTS Audio
curl --request POST \
--url https://platform.perso.ai/api/v1/session/{session_id}/tts/ \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, this is Perso Live speaking."
}
'import requests
url = "https://platform.perso.ai/api/v1/session/{session_id}/tts/"
payload = { "text": "Hello, this is Perso Live speaking." }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Hello, this is Perso Live speaking.'})
};
fetch('https://platform.perso.ai/api/v1/session/{session_id}/tts/', 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/v1/session/{session_id}/tts/",
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 Perso Live speaking.'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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/v1/session/{session_id}/tts/"
payload := strings.NewReader("{\n \"text\": \"Hello, this is Perso Live speaking.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/session/{session_id}/tts/")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is Perso Live speaking.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/v1/session/{session_id}/tts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is Perso Live speaking.\"\n}"
response = http.request(request)
puts response.read_body{
"audio": "<string>",
"locale": "<string>",
"normalized_text": "<string>"
}Session Operations
Generate TTS Audio
Convert text to speech audio using the session’s configured TTS voice.
Request Parameters
| Parameter | Required | Description |
|---|---|---|
text | Yes | The text to convert to speech |
locale | No | Language/locale for text normalization (e.g., ko, en) |
Response
Returns base64-encoded audio data in the configured format.
Example
Select “TTSRequest” from the Examples dropdown to see the request format.
POST
/
api
/
v1
/
session
/
{session_id}
/
tts
/
Generate TTS Audio
curl --request POST \
--url https://platform.perso.ai/api/v1/session/{session_id}/tts/ \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, this is Perso Live speaking."
}
'import requests
url = "https://platform.perso.ai/api/v1/session/{session_id}/tts/"
payload = { "text": "Hello, this is Perso Live speaking." }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Hello, this is Perso Live speaking.'})
};
fetch('https://platform.perso.ai/api/v1/session/{session_id}/tts/', 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/v1/session/{session_id}/tts/",
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 Perso Live speaking.'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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/v1/session/{session_id}/tts/"
payload := strings.NewReader("{\n \"text\": \"Hello, this is Perso Live speaking.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/session/{session_id}/tts/")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is Perso Live speaking.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/v1/session/{session_id}/tts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is Perso Live speaking.\"\n}"
response = http.request(request)
puts response.read_body{
"audio": "<string>",
"locale": "<string>",
"normalized_text": "<string>"
}Path Parameters
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Text to convert to speech using the session's configured voice.
Minimum string length:
1Optional locale (e.g. en-US, ko-KR) for text normalization.
Minimum string length:
1Audio format to return: mp3, wav, or pcm.
pcm_24000- pcm_24000pcm_44100- pcm_44100wav_24000- wav_24000wav_44100- wav_44100mp3_44100- mp3_44100mp3- mp3wav- wavpcm- pcm
Available options:
pcm_24000, pcm_44100, wav_24000, wav_44100, mp3_44100, mp3, wav, pcm 
