Text To Speech API

All the available APIs needed to generate audio from text.

Convai's Text-To-Speech API endpoint

POST https://api.convai.com/tts/

This endpoint is called to convert a user provided text to audio in the voice mentioned by the user.

Headers

Request Body

{
    "ERROR" : "api_key error."
}

List of available public voices and their supported languages:

All the voices support the wav format. Only GCP Voices support both wav and mp3 formats.

Please provide the Voice Code in the voice field of the payload.

Please note if an unsupported audio encoding is specified along with a voice in the request body, it will result in a 400 error response.

The above section only lists the public voices. As Convai supports third-party integrations, to get the full list of voices available to a user, please check out Voice List API.

List of available voices:

Here are some sample codes to demonstrate the request format for the endpoint -->

import requests
import json

url = "https://api.convai.com/tts/"

payload = json.dumps({
  "transcript": "Hello World from us",
  "voice": "WUMale 1",
  "filename": "testAudio",
  "encoding": "mp3"
})
headers = {
  'CONVAI-API-KEY': '<your api key>',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

with open('testAudio.mp3','wb') as f:
  f.write(response.content)

Last updated