Clone a voice using uploaded audio samples
Table of contents
December 27, 2024 (January 24, 2025)
Please configure at least one www.hailuo.ai account for this endpoint, see Setup MiniMax for details.
Make sure that you have slots are available for cloned voices. To check, please navigate to https://www.hailuo.ai/audio/voices and select “My Voices” as shown below. Single www.hailuo.ai account can have up to 4 cloned voices, if you need more simple create another www.hailuo.ai account.
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
-
{ "voice_id": "user:user_id-minimax:account_id-audio:voice_id", "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": 1122334455667, "collected": false, "voice_status": 2, "sample_audio": "https://cdn.hailuoai.video/...mp3", "uniq_id": "<uniq_id>", "group_id": "<group_id>" }
-
{ "error": "<Error message>" }
-
{ "error": "Unauthorized" }
Model
{ // TypeScript, all fields are optional
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
}
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())