Skip to main content
In this tutorial, you will learn how to use the Vox platform to synthesize text to speech both synchronously and asynchronously. By the end of this tutorial, you will be able to convert text into speech using our API.

Requirements

Before you begin, ensure you have:
  • Nodejs
  • A Vox API Key
  • Basic understanding of HTTP and JSON

API Endpoint

POST /api/v1/get_speech

Generates and streams speech audio.

Headers

Authorization: Bearer {YOUR_API_KEY_HERE}
Content-Type: application/json

Body

{
  "text": "Text to convert to speech",
  "voice_id": "khvTFYgvagfvagvfuavdf",
  "language": "en",
  "addWavHeader": true,
  "speed":1.0,
  "sample_rate": 24000
}

Response

  • Streams audio/wav bytes
  • Headers include:
    • X-Request-ID

Sample cURL request

Below is a synchronous example using Python + requests.
curl -X POST "https://api.tts.timepay.ai/api/v1/get_speech" \
  -H "Authorization: Bearer $YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello world! This is Vox speaking.",
    "voice_id": "khvTFYgvagfvagvfuavdf",
    "language": "en",
    "addWavHeader": true,
    "speed":1.0,
    "sample_rate": 24000
  }' \
  --output output.wav

Parameters

ParameterTypeDefaultDescription
textstringrequiredText to convert
voice_idstringrequiredSelect voice
languagestring"en"Language code
sample_ratenumber24000Audio sample rate
speednumber (float)1.0Audio sample rate
addWavHeaderbooleantrueAdds WAV header

Need Help?

If you have any questions or need assistance, please contact our support team at support@timepay.ai.