Text To Speech
curl --request POST \
--url https://api.topmediai.com/v1/text2speech \
--header 'Content-Type: application/json' \
--data '
{
"text": "Welcome to our API",
"speaker": "00151554-3826-11ee-a861-00163e2ac61b",
"emotion": "Neutral"
}
'import requests
url = "https://api.topmediai.com/v1/text2speech"
payload = {
"text": "Welcome to our API",
"speaker": "00151554-3826-11ee-a861-00163e2ac61b",
"emotion": "Neutral"
}
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: 'Welcome to our API',
speaker: '00151554-3826-11ee-a861-00163e2ac61b',
emotion: 'Neutral'
})
};
fetch('https://api.topmediai.com/v1/text2speech', 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://api.topmediai.com/v1/text2speech",
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' => 'Welcome to our API',
'speaker' => '00151554-3826-11ee-a861-00163e2ac61b',
'emotion' => 'Neutral'
]),
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://api.topmediai.com/v1/text2speech"
payload := strings.NewReader("{\n \"text\": \"Welcome to our API\",\n \"speaker\": \"00151554-3826-11ee-a861-00163e2ac61b\",\n \"emotion\": \"Neutral\"\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://api.topmediai.com/v1/text2speech")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Welcome to our API\",\n \"speaker\": \"00151554-3826-11ee-a861-00163e2ac61b\",\n \"emotion\": \"Neutral\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topmediai.com/v1/text2speech")
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\": \"Welcome to our API\",\n \"speaker\": \"00151554-3826-11ee-a861-00163e2ac61b\",\n \"emotion\": \"Neutral\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Text-to-Speech
Text To Speech
Converts text into speech using a voice of your choice and returns audio.
POST
/
v1
/
text2speech
Text To Speech
curl --request POST \
--url https://api.topmediai.com/v1/text2speech \
--header 'Content-Type: application/json' \
--data '
{
"text": "Welcome to our API",
"speaker": "00151554-3826-11ee-a861-00163e2ac61b",
"emotion": "Neutral"
}
'import requests
url = "https://api.topmediai.com/v1/text2speech"
payload = {
"text": "Welcome to our API",
"speaker": "00151554-3826-11ee-a861-00163e2ac61b",
"emotion": "Neutral"
}
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: 'Welcome to our API',
speaker: '00151554-3826-11ee-a861-00163e2ac61b',
emotion: 'Neutral'
})
};
fetch('https://api.topmediai.com/v1/text2speech', 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://api.topmediai.com/v1/text2speech",
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' => 'Welcome to our API',
'speaker' => '00151554-3826-11ee-a861-00163e2ac61b',
'emotion' => 'Neutral'
]),
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://api.topmediai.com/v1/text2speech"
payload := strings.NewReader("{\n \"text\": \"Welcome to our API\",\n \"speaker\": \"00151554-3826-11ee-a861-00163e2ac61b\",\n \"emotion\": \"Neutral\"\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://api.topmediai.com/v1/text2speech")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Welcome to our API\",\n \"speaker\": \"00151554-3826-11ee-a861-00163e2ac61b\",\n \"emotion\": \"Neutral\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topmediai.com/v1/text2speech")
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\": \"Welcome to our API\",\n \"speaker\": \"00151554-3826-11ee-a861-00163e2ac61b\",\n \"emotion\": \"Neutral\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Body
application/json
Required string length:
1 - 500Example:
"Welcome to our API"
Example:
"00151554-3826-11ee-a861-00163e2ac61b"
some voice have emotion: Angry, Cheerful, Sad, Excited, Friendly, Terrified, Shouting, Unfriendly, Whispering, Hopeful, Soulful, Pleasant, Complaining, Surprised, Uneasy, Fearful, Disgust
Example:
"Neutral"
Response
Successful Response
⌘I
