Clone a voice using uploaded audio samples
Table of contents
December 27, 2024
Please configure at least one www.hailuo.ai account for this endpoint, see Setup MiniMax for details.
Make sure that you have no manually cloned voices and all slots are available. To check, please navigate to https://www.hailuo.ai/audio/voices and select “My Voices” as shown below. If you see any voices in that list, please delete them. Using the API, you will be able to clone as many voices as you want, but you will need to remove all manually cloned voices for that feature to work properly.
Screenshot www.hailuo.ai/audio/voices
Please be patient, voice cloning can take up to 60 seconds. This endpoint can only support one or two parallel tasks maximum, so organize internal queuing if you need to clone many voices in bulk.
https://api.useapi.net/v1/minimax/audio/clone-voice
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"account": "Optional MiniMax www.hailuo.ai API account",
"voice_name": "Doctor Who",
"language_tag": "English",
"files": "user:user_id-minimax:account-file:file_id1,user:user_id-minimax:account-file:file_id2",
}
-
account
is optional when only onewww.hailuo.ai
account configured. However, if you have multiple accounts configured, this parameter becomes required. -
voice_name
is required.
Maximum length: 30 characters. -
language_tag
is required. Use tag_name from arrayvoice_tag_language
of GET audio/config. -
files
is required. Provide up to 10 comma-separatedfileID
values of audio samples uploaded via POST audio/upload-sample. Each audio sample should be between 10 to 60 seconds long. -
need_noise_reduction
is optional.
Supported values:true
(default),false
.
Responses
-
{ "input_sensitive": false, "input_sensitive_type": 0, "voice_info": { "voice_id": "1122334455667788", "parent_voice_id": "0", "voice_name": "Doctor Who", "tag_list": [ "English" ], "file_id": "1234567890", "cover_url": "https://cdn.hailuoai.video/...png", "create_time": 1122334455667, "update_time": 1122334455668, "collected": false, "voice_status": 2, "sample_audio": "https://cdn.hailuoai.video/...mp3", "uniq_id": "<uniq_id>", "group_id": "<group_id>" }, "base_resp": {} }
-
{ "error": "<Error message>" }
-
{ "error": "Unauthorized" }
Model
{ // TypeScript, all fields are optional
input_sensitive: boolean
input_sensitive_type: number
voice_info: {
voice_id: string
parent_voice_id: string
voice_name: string
tag_list: string[]
file_id: string
cover_url: string
create_time: number
update_time: number
collected: boolean
voice_status: number
sample_audio: string
uniq_id: string
group_id: string
managed_by_api?: boolean
}
base_resp: {
status_code: number
status_msg: string
}
}
Examples
-
curl -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -X POST https://api.useapi.net/v1/minimax/audio/clone-voice \ -d '{"account": "…", "voice_name": "…", "language_tag": "…", "files": …}'
-
const account = "Previously configured audio account"; const voice_name = "Voice Name"; const language_tag = "Voice Language"; const files = "fileID1,fileID2"; const apiUrl = `https://api.useapi.net/v1/minimax/audio/clone-voice`; const api_token = "API token"; const data = { method: 'POST', headers: { 'Authorization': `Bearer ${api_token}`, 'Content-Type': 'application/json' } }; data.body = JSON.stringify({ account, voice_name, language_tag, files }); const response = await fetch(apiUrl, data); const result = await response.json(); console.log("response", {response, result});
-
import requests account = "Previously configured audio account" voice_name = "Voice Name" language_tag = "Voice Language" files = "fileID1,fileID2" apiUrl = f"https://api.useapi.net/v1/minimax/audio/clone-voice" api_token = "API token" maxJobs = 1 headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {api_token}" } body = { "account": f"{account}", "voice_name": f"{voice_name}", "language_tag": f"{language_tag}", "files": files } response = requests.post(apiUrl, headers=headers, json=body) print(response, response.json())