Guides

Text To Speech

🎤 Generate Speech from Text
Convert your text into speech using our Text-to-Speech API. Submit your text along with the desired language and voice settings, and our API will process your request. After audio generation, credits will be deducted from your account based on the exact duration in seconds. For example, if the generated audio is 1 minute and 5 seconds long, 65 seconds will be deducted from your account.

🎯 Voice Types We offer two types of voices:

  • Lite Voices: Standard quality voices with up to 50,000 characters per request
  • Pro Voices (Beta): Premium quality voices with advanced features, currently limited to 1,000 characters per request. Pro voices are in beta.

📋 Request Parameters
The following parameters are required in the JSON body of your POST request:

text (string, required):
The text to be converted into speech.

  • Maximum 50,000 characters for Lite voices
  • Maximum 1,000 characters for Pro voices (beta)

language (string, required):
The language code for the speech output (e.g., en-US). You can refer to this array of languages:

[
    'af-ZA',    # Afrikaans (South Africa)
    'sq-AL',    # Albanian (Albania)
    'am-ET',    # Amharic (Ethiopia)
    'ar-EG',    # Arabic (Egypt)
    'ar-SA',    # Arabic (Saudi Arabia)
    'hy-AM',    # Armenian (Armenia)
    'az-AZ',    # Azerbaijani (Azerbaijan)
    'eu-ES',    # Basque (Basque)
    'bn-IN',    # Bengali (India)
    'bs-BA',    # Bosnian (Bosnia and Herzegovina)
    'bg-BG',    # Bulgarian (Bulgaria)
    'my-MM',    # Burmese (Myanmar)
    'ca-ES',    # Catalan (Spain)
    'zh-HK',    # Chinese (Cantonese, Traditional)
    'zh-CN',    # Chinese (Mandarin, Simplified)
    'zh-TW',    # Chinese (Taiwanese Mandarin)
    'hr-HR',    # Croatian (Croatia)
    'cs-CZ',    # Czech (Czech)
    'da-DK',    # Danish (Denmark)
    'nl-BE',    # Dutch (Belgium)
    'nl-NL',    # Dutch (Netherlands)
    'en-AU',    # English (Australia)
    'en-CA',    # English (Canada)
    'en-HK',    # English (Hong Kong SAR)
    'en-IN',    # English (India)
    'en-IE',    # English (Ireland)
    'en-GB',    # English (United Kingdom)
    'en-US',    # English (United States)
    'et-EE',    # Estonian (Estonia)
    'fil-PH',   # Filipino (Philippines)
    'fi-FI',    # Finnish (Finland)
    'fr-BE',    # French (Belgium)
    'fr-CA',    # French (Canada)
    'fr-FR',    # French (France)
    'fr-CH',    # French (Switzerland)
    'gl-ES',    # Galician (Galician)
    'ka-GE',    # Georgian (Georgia)
    'de-AT',    # German (Austria)
    'de-DE',    # German (Germany)
    'de-CH',    # German (Switzerland)
    'el-GR',    # Greek (Greece)
    'he-IL',    # Hebrew (Israel)
    'hi-IN',    # Hindi (India)
    'hu-HU',    # Hungarian (Hungary)
    'is-IS',    # Icelandic (Iceland)
    'id-ID',    # Indonesian (Indonesia)
    'ga-IE',    # Irish (Ireland)
    'it-IT',    # Italian (Italy)
    'ja-JP',    # Japanese (Japan)
    'jv-ID',    # Javanese (Indonesia)
    'kn-IN',    # Kannada (India)
    'kk-KZ',    # Kazakh (Kazakhstan)
    'km-KH',    # Khmer (Cambodia)
    'ko-KR',    # Korean (Korea)
    'lo-LA',    # Lao (Laos)
    'lv-LV',    # Latvian (Latvia)
    'lt-LT',    # Lithuanian (Lithuania)
    'mk-MK',    # Macedonian (North Macedonia)
    'ms-MY',    # Malay (Malaysia)
    'ml-IN',    # Malayalam (India)
    'mt-MT',    # Maltese (Malta)
    'mn-MN',    # Mongolian (Mongolia)
    'ne-NP',    # Nepali (Nepal)
    'nb-NO',    # Norwegian (Bokmål, Norway)
    'ps-AF',    # Pashto (Afghanistan)
    'fa-IR',    # Persian (Iran)
    'pl-PL',    # Polish (Poland)
    'pt-BR',    # Portuguese (Brazil)
    'pt-PT',    # Portuguese (Portugal)
    'ro-RO',    # Romanian (Romania)
    'ru-RU',    # Russian (Russia)
    'sr-RS',    # Serbian (Cyrillic, Serbia)
    'si-LK',    # Sinhala (Sri Lanka)
    'sk-SK',    # Slovak (Slovakia)
    'sl-SI',    # Slovenian (Slovenia)
    'so-SO',    # Somali (Somalia)
    'es-MX',    # Spanish (Mexico)
    'es-ES',    # Spanish (Spain)
    'su-ID',    # Sundanese (Indonesia)
    'sw-KE',    # Swahili (Kenya)
    'sv-SE',    # Swedish (Sweden)
    'ta-IN',    # Tamil (India)
    'te-IN',    # Telugu (India)
    'th-TH',    # Thai (Thailand)
    'tr-TR',    # Turkish (Türkiye)
    'uk-UA',    # Ukrainian (Ukraine)
    'ur-PK',    # Urdu (Pakistan)
    'uz-UZ',    # Uzbek (Uzbekistan)
    'vi-VN',    # Vietnamese (Vietnam)
    'cy-GB',    # Welsh (United Kingdom)
    'zu-ZA',    # Zulu (South Africa)
]

voice_name (string, required):
Specify the desired voice name. You can use any voice name available in your Speaktor dashboard at https://speaktor.com/. Voice names are displayed both in the project creation screen and within your projects.

simply use the exact name as shown in the web interface. Voice names may vary based on your dashboard language preference.

Below are the en-US(English – American accent) voice names , grouped by voice type:

Pro Voices:

[   "Alexander",   "Michelle",   "Catherine",   "Michael",   "Robert",   "Rebecca",   "Andrew",   "Rachel",   "Brian",   "Madison",   "Dylan",   "Kevin",   "Richard",   "Caroline",   "Christopher",   "Susan",   "Thomas",   "Hannah",   "Olivia",   "Emily",   "Jason",   "David",   "Jennifer",   "Isabella",   "Alex",   "Matthew",   "Evan",   "Benjamin",   "Serena" ]

Pro voices are marked with a "Pro" badge in the web interface.

Lite Voices:

[   "Chloe",   "Lara",   "Mark",   "Ethan",   "Julian",   "Laura",   "Tara",   "Sienna",   "Vanessa",   "Gabriel",   "Nathan",   "James",   "Liam",   "Emma",   "Sophia",   "Clara",   "Jack",   "Elena",   "Sophie",   "Maya",   "Chloe",   "Victor",   "Lily",   "Leo",   "Ava",   "Ravi",   "Julia",   "Noah",   "Liam",   "Ivy",   "Jasper" ]

speed_rate (float, optional):
Adjust the speaking speed of the generated audio. Default: 1.0

  • Range: 0.5 (half speed) to 2.0 (double speed)
  • Example: 0.75 for 75% speed, 1.5 for 150% speed

generate_subtitle (boolean, optional):
Generate SRT subtitle file alongside the audio. Default: false

  • Returns an additional subtitleUrl in the response when set to true
  • Subtitles are synchronized with the audio playback speed

emotion (string, optional - Pro voices only):
Apply emotional tone to the speech. This parameter is only available for Pro voices.

  • Lite voices do not support emotion parameter

  • Emotions:

[   "Angry",   "Calm",   "Cheerful",   "Conversational",   "Dramatic",   "Emotional",   "Formal",   "Instructional",   "Narrative",   "Newscast",   "Promo",   "Robotic",   "Sorrowful",   "Terrified" ]

📌 Authentication Include the Authorization header in your request:
Authorization: Bearer <your_api_key>

📊 Response Format The API returns a JSON response with the following structure:

{
    "audioUrl": "https://...",           // Pre-signed URL for the generated audio (MP3)
    "subtitleUrl": "https://...",        // (Optional) Pre-signed URL for SRT subtitles
    "appliedSpeedRate": 1.5,            // (Optional) Applied speed rate if different from 1.0
    "appliedEmotion": "happy"           // (Optional) Applied emotion for Pro voices
}

URLs are valid for 1 hour after generation.

💻 Code Examples

import json
import requests

# Set your API endpoint and API key
url = "https://api.tor.app/developer/text_to_speech"
api_key = "your_api_key"  # Replace with your actual API key

# Set headers including the API key for authentication
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {api_key}",
    "Accept": "application/json",
}

# Basic request (backwards compatible)
payload = {
    "text": "Your text goes here",
    "language": "en-US",
    "voice_name": "Ravi Ananda"
}

# Advanced request with new features
payload_advanced = {
    "text": "Your text goes here",
    "language": "en-US",
    "voice_name": "Ravi Ananda",
    "speed_rate": 1.2,              # 20% faster
    "generate_subtitle": True,       # Generate SRT file
    "emotion": "excited"             # Pro voices only
}

# Send the POST request to the text-to-speech API endpoint
response = requests.post(url, json=payload_advanced, headers=headers)

# Print the status code and the complete JSON response
print("Status Code:", response.status_code)
response_json = response.json()
print("Response JSON:", response_json)

# Extract URLs from the response
if "audioUrl" in response_json:
    print("Audio URL:", response_json["audioUrl"])
    
if "subtitleUrl" in response_json:
    print("Subtitle URL:", response_json["subtitleUrl"])
const axios = require('axios');

// Set your API endpoint and API key
const url = "https://api.tor.app/developer/text_to_speech";
const apiKey = "your_api_key"; // Replace with your actual API key

// Set headers including the API key for authentication
const headers = {
  "Content-Type": "application/json",
  "Authorization": `Bearer ${apiKey}`,
  "Accept": "application/json",
};

// Basic request (backwards compatible)
const payload = {
  text: "Your text goes here",
  language: "en-US",
  voice_name: "Ravi Ananda"
};

// Advanced request with new features
const payloadAdvanced = {
  text: "Your text goes here",
  language: "en-US",
  voice_name: "Ravi Ananda",
  speed_rate: 1.2,              // 20% faster
  generate_subtitle: true,       // Generate SRT file
  emotion: "excited"            // Pro voices only
};

// Send the POST request to the text-to-speech API endpoint
axios.post(url, payloadAdvanced, { headers })
  .then(response => {
    console.log("Status Code:", response.status);
    console.log("Response JSON:", response.data);

    // Extract URLs from the response
    if (response.data.audioUrl) {
      console.log("Audio URL:", response.data.audioUrl);
    }
    
    if (response.data.subtitleUrl) {
      console.log("Subtitle URL:", response.data.subtitleUrl);
    }
  })
  .catch(error => {
    console.error("Error making request:", error);
  });

⚠️ Important Notes

  • API access is only available on Pro, Team, and Enterprise plans. Trial and Lite plans do not support API usage.
  • Pro voices are currently in beta. Features and performance may change before the final release.
  • Emotion parameter is exclusive to Pro voices and will be ignored for Lite voices.
  • Generated audio files and subtitles are temporarily stored and accessible via pre-signed URLs for 1 hour.
  • For texts exceeding the character limits, consider splitting your content and making multiple requests.