Text To Speech
curl --request POST \
--url https://api.sunbird.ai/tasks/runpod/tts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"speaker_id": 248,
"temperature": 0.7,
"max_new_audio_tokens": 2000
}
'import requests
url = "https://api.sunbird.ai/tasks/runpod/tts"
payload = {
"text": "<string>",
"speaker_id": 248,
"temperature": 0.7,
"max_new_audio_tokens": 2000
}
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>',
speaker_id: 248,
temperature: 0.7,
max_new_audio_tokens: 2000
})
};
fetch('https://api.sunbird.ai/tasks/runpod/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://api.sunbird.ai/tasks/runpod/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' => '<string>',
'speaker_id' => 248,
'temperature' => 0.7,
'max_new_audio_tokens' => 2000
]),
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://api.sunbird.ai/tasks/runpod/tts"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"speaker_id\": 248,\n \"temperature\": 0.7,\n \"max_new_audio_tokens\": 2000\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://api.sunbird.ai/tasks/runpod/tts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"speaker_id\": 248,\n \"temperature\": 0.7,\n \"max_new_audio_tokens\": 2000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sunbird.ai/tasks/runpod/tts")
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 \"speaker_id\": 248,\n \"temperature\": 0.7,\n \"max_new_audio_tokens\": 2000\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Legacy Text to Speech
Text to Speech (RunPod)
deprecated
RunPod Text-to-Speech endpoint.
Converts input text to speech audio using a specified speaker voice.
This endpoint uses the RunPod inference server for TTS generation.
Args:
request (Request): The incoming HTTP request object (required for rate limiting).
tts_request (TTSRequest): The request body containing text, speaker ID, and synthesis parameters.
background_tasks (BackgroundTasks): FastAPI background tasks for logging.
current_user (User): The authenticated user making the request.
Returns:
dict: A dictionary containing the generated speech audio with signed URL and metadata.
Raises:
BadRequestError: For invalid input parameters.
ValidationError: For invalid speaker_id, temperature, or max_new_audio_tokens.
ServiceUnavailableError: If the service is unavailable due to timeout.
ExternalServiceError: For connection errors or worker errors.
Speaker IDs:
241: Acholi (female)
242: Ateso (female)
243: Runyankore (female)
245: Lugbara (female)
246: Swahili (male)
248: Luganda (female)
Example Response:
{
"output": {
"audio_url": "https:...",
"blob": "tts/20251003082338_f2ff97b3-9cb9-42fb-850d-0657f51e539e.mp3",
"sample_rate": 16000
}
}
POST
/
tasks
/
runpod
/
tts
Text To Speech
curl --request POST \
--url https://api.sunbird.ai/tasks/runpod/tts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"speaker_id": 248,
"temperature": 0.7,
"max_new_audio_tokens": 2000
}
'import requests
url = "https://api.sunbird.ai/tasks/runpod/tts"
payload = {
"text": "<string>",
"speaker_id": 248,
"temperature": 0.7,
"max_new_audio_tokens": 2000
}
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>',
speaker_id: 248,
temperature: 0.7,
max_new_audio_tokens: 2000
})
};
fetch('https://api.sunbird.ai/tasks/runpod/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://api.sunbird.ai/tasks/runpod/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' => '<string>',
'speaker_id' => 248,
'temperature' => 0.7,
'max_new_audio_tokens' => 2000
]),
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://api.sunbird.ai/tasks/runpod/tts"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"speaker_id\": 248,\n \"temperature\": 0.7,\n \"max_new_audio_tokens\": 2000\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://api.sunbird.ai/tasks/runpod/tts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"speaker_id\": 248,\n \"temperature\": 0.7,\n \"max_new_audio_tokens\": 2000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sunbird.ai/tasks/runpod/tts")
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 \"speaker_id\": 248,\n \"temperature\": 0.7,\n \"max_new_audio_tokens\": 2000\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/json
Response
Successful Response

