Skip to main content

Enterprise: Voice Upload Endpoint

Overview

The audio voice endpoint allows you to upload audio and use the voice_id returned with Text To Audio Endpoint

Request

--request POST 'https://modelslab.com/api/v1/enterprise/voice/voice_upload' \

Make a POST request to https://modelslab.com/api/v1/enterprise/voice/voice_upload endpoint and pass the required parameters as a request body.

Body Attributes

ParameterDescription
keyYour API Key used for request authorization
nameDisplay name of the voice you want to upload
init_audioAudio url. Only mp3 and wav are allowed. Make sure the audio url is between 10 and 25 seconds for better result
languageThe language of the voice. The supported languages includesenglish,arabic,spanish,german,czech,brazilian portuguese, chinese, dutch,french, hindi, hungarian,italian, japanese, korean,polish, russian, turkish. Default english . It is important that the language of the voice you uploaded is what you pass here

Example

Body

Body
{   
"key":"",
"name":"Jacob",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav",
"language":"english"
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key":"",
"name":"Jacob",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav",
"language":"english"
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v1/enterprise/voice/voice_upload", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"message": "voice uploaded successfully",
"voice_id": "jacob"
}