Skip to main content

Enterprise: Voice to Voice Endpoint

Overview

The voice to voice endpoint allows you clone a voice from a target audio.

Request

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

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

caution

Make sure you add your s3 details for voice_cloning server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after 24 hours

Body Attributes

ParameterDescription
keyYour API Key used for request authorization
init_audioSouce utterances. Must be a valid URL or base64 data for a wav/mp3 file and The maximum length for init_audio should be 30 seconds.
target_audioTarget voice which should say the original utterances. Must be a valid URL or base64 data for a wav/mp3 file and The maximum length for target_audio should be 30 seconds.
base64Whether the input sound clip is in base64 or not. Should be true or false. Defaults to false.
tempWhether you want temporary links or not. This is useful if your country blocks access to our storage sites. Should be true or false. Defaults
webhookSet an URL to get a POST API call once the image generation is complete.
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook request.

Example

Body

Body

{
"key":"",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav",
"target_audio":"https://assets.modelslab.com/tmp/gEJ3RgkrWumjCJpb8hHYD3OsID7ET9-metaSGlyZV92b2ljZV9hY3RvcnNfYW5kX3ZvaWNlX292ZXJfc2VydmljZXNfLV9CdW5ueV9TdHVkaW9fMiAoMSktW0F1ZGlvVHJpbW1lci5jb21dLm1wMw==-.mp3",
"temp":false,
"base64":false,
"webhook":null,
"track_id":null
}

Request

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

var raw = JSON.stringify({
"key":"",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav",
"target_audio":"https://assets.modelslab.com/tmp/gEJ3RgkrWumjCJpb8hHYD3OsID7ET9-metaSGlyZV92b2ljZV9hY3RvcnNfYW5kX3ZvaWNlX292ZXJfc2VydmljZXNfLV9CdW5ueV9TdHVkaW9fMiAoMSktW0F1ZGlvVHJpbW1lci5jb21dLm1wMw==-.mp3",
"temp":false,
"base64":false,
"webhook":null,
"track_id":null
});

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

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

Response

{
"generationTime": 0.24047088623046875,
"links": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/0af632ff-dd1a-4f29-9dcf-8d61dd00e0ad.wav"
],
"meta": {
"base64": "no",
"filename": "0af632ff-dd1a-4f29-9dcf-8d61dd00e0ad.wav",
"speaker_wav": "tmp/speaker-0af632ff-dd1a-4f29-9dcf-8d61dd00e0ad.wav",
"target_wav": "tmp/target-0af632ff-dd1a-4f29-9dcf-8d61dd00e0ad.wav",
"temp": "no"
},
"proxy_links": [],
"status": "success"
}