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
Parameter | Description |
---|---|
key | Your API Key used for request authorization |
name | Display name of the voice you want to upload |
init_audio | Audio url. Only mp3 and wav are allowed. Make sure the audio url is between 10 and 25 seconds for better result |
language | The 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
- JS
- PHP
- NODE
- PYTHON
- JAVA
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));
<?php
$payload = [
"key" => "",
"name" => "Jacob",
"init_audio" => "https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav",
"language" => "english"
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/voice/voice_upload',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://modelslab.com/api/v1/enterprise/voice/voice_upload',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key":"",
"name":"Jacob",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav",
"language":"english"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://modelslab.com/api/v1/enterprise/voice/voice_upload"
payload = json.dumps({
"key":"",
"name":"Jacob",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav",
"language":"english"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"key\":\"\",\n \"init_audio\":\"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav\",\n \"language\":\"english\",\n \"name\":\"Jacobs\"\n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v1/enterprise/voice/voice_upload")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
{
"status": "success",
"message": "voice uploaded successfully",
"voice_id": "jacob"
}