Skip to main content

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/v6/voice/voice_to_voice' \

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

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorizationstring
init_audioSource utterances. Must be a valid URL or base64 data for a wav/mp3 file. Maximum length: 30 seconds.MP3/WAV URL or base64 data
target_audioTarget voice that replicates the original utterances. Must be a valid URL or base64 data for a wav/mp3 file. Maximum length: 30 seconds.MP3/WAV URL or base64 data
base64Whether the input sound clip is in base64 format. Defaults to false.TRUE or FALSE
tempWhether you want temporary links, useful if your country blocks access to certain storage sites. Defaults to false.TRUE or FALSE
webhookURL to receive a POST API call once the audio generation is complete.URL
track_idID returned in the response for the webhook API call, used to identify the webhook request.integral value

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/v6/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"
}