Skip to main content
POST
/
api
/
v1
/
tts
/
speech
Generate Speech
curl --request POST \
  --url https://dev.voice.ai/api/v1/tts/speech \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>",
  "voice_id": "<string>",
  "audio_format": "mp3",
  "temperature": 1,
  "top_p": 0.8,
  "language": "en",
  "dictionary_id": "<string>",
  "dictionary_version": 2
}
'
import requests

url = "https://dev.voice.ai/api/v1/tts/speech"

payload = {
"text": "<string>",
"voice_id": "<string>",
"audio_format": "mp3",
"temperature": 1,
"top_p": 0.8,
"language": "en",
"dictionary_id": "<string>",
"dictionary_version": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: '<string>',
voice_id: '<string>',
audio_format: 'mp3',
temperature: 1,
top_p: 0.8,
language: 'en',
dictionary_id: '<string>',
dictionary_version: 2
})
};

fetch('https://dev.voice.ai/api/v1/tts/speech', 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://dev.voice.ai/api/v1/tts/speech",
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' => '<string>',
'voice_id' => '<string>',
'audio_format' => 'mp3',
'temperature' => 1,
'top_p' => 0.8,
'language' => 'en',
'dictionary_id' => '<string>',
'dictionary_version' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://dev.voice.ai/api/v1/tts/speech"

payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_format\": \"mp3\",\n \"temperature\": 1,\n \"top_p\": 0.8,\n \"language\": \"en\",\n \"dictionary_id\": \"<string>\",\n \"dictionary_version\": 2\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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://dev.voice.ai/api/v1/tts/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_format\": \"mp3\",\n \"temperature\": 1,\n \"top_p\": 0.8,\n \"language\": \"en\",\n \"dictionary_id\": \"<string>\",\n \"dictionary_version\": 2\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://dev.voice.ai/api/v1/tts/speech")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_format\": \"mp3\",\n \"temperature\": 1,\n \"top_p\": 0.8,\n \"language\": \"en\",\n \"dictionary_id\": \"<string>\",\n \"dictionary_version\": 2\n}"

response = http.request(request)
puts response.read_body
"<string>"
{
"error": "<string>",
"detail": "<string>",
"code": "<string>"
}
{
"error": "<string>",
"detail": "<string>",
"code": "<string>"
}
{
"error": "<string>",
"detail": "<string>",
"code": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"error": "<string>",
"detail": "<string>",
"code": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your API key as the bearer token. Format: Authorization: Bearer

Body

application/json
text
string
required

The text to generate speech for. Supports inline spelling markup such as [SPELL:BX42] to spell acronyms, names, or codes character by character.

voice_id
string

Voice ID to use. Omit to use the default built-in voice.

audio_format
enum<string>
default:mp3

Audio output format (32kHz sample rate)

Available options:
mp3,
wav,
pcm,
alaw_8000,
mp3_22050_32,
mp3_24000_48,
mp3_44100_32,
mp3_44100_64,
mp3_44100_96,
mp3_44100_128,
mp3_44100_192,
opus_48000_32,
opus_48000_64,
opus_48000_96,
opus_48000_128,
opus_48000_192,
pcm_8000,
pcm_16000,
pcm_22050,
pcm_24000,
pcm_32000,
pcm_44100,
pcm_48000,
ulaw_8000,
wav_16000,
wav_22050,
wav_24000
temperature
number
default:1

Sampling temperature (0.0-2.0)

Required range: 0 <= x <= 2
top_p
number
default:0.8

Nucleus sampling parameter (0.0-1.0)

Required range: 0 <= x <= 1
model
enum<string>

TTS model to use. If not provided, automatically selected based on language. English uses non-multilingual models; other languages use multilingual models.

Available options:
voiceai-tts-v1-latest,
voiceai-tts-v1-2026-02-10,
voiceai-tts-multilingual-v1-latest,
voiceai-tts-multilingual-v1-2026-02-10
language
enum<string>
default:en

Language code (ISO 639-1 format)

Available options:
en,
ca,
sv,
es,
fr,
de,
it,
pt,
pl,
ru,
nl
dictionary_id
string

Optional managed pronunciation dictionary identifier.

dictionary_version
integer

Optional managed dictionary version. Defaults to latest when omitted.

Required range: x >= 1

Response

Successful Response - Returns binary audio file (32kHz sample rate)

MP3 audio file (32kHz sample rate, compressed)