Upload audio samples for voice cloning
December 27, 2024
Table of contents
Please configure at least one www.hailuo.ai account for this endpoint, see Setup MiniMax for details.
Upload .mp3
and .wav
audio samples that you want to use for your voice cloning via POST audio/clone-voice. Each audio sample should be between 10 to 60 seconds long.
POST raw content using Make.com and similar nocode tools.
https://api.useapi.net/v1/minimax/audio/upload-sample/?…
Request Headers
Authorization: Bearer {API token}
Content-Type: select from the table below
API token
is required, see Setup useapi.net for details.Content-Type
is required, select from the table below:
Content-Type | File Extension |
---|---|
audio/mpeg | mp3 |
audio/wav | wav |
audio/wave | wav |
Query Parameters
account
is optional when only onewww.hailuo.ai
account configured. However, if you have multiple accounts configured, this parameter becomes required.
Responses
-
{ "ossPath": "<file url>", "fileID": "user:user_id-minimax:account-file:file_id" }
-
{ "error": "<Error message>", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
Model
{ // TypeScript, all fields are optional
ossPath: string
fileID: string
error: string
code: number
}
Examples
-
curl "https://api.useapi.net/v1/minimax/audio/upload-sample/?account=account" \ -H "Authorization: Bearer …" \ -H "Content-Type: audio/mpeg" \ --data-binary /path/to/your/voice-sample.mp3
-
const token = "API token"; const account = "Previously configured audio account"; const apiUrl = `https://api.useapi.net/v1/minimax/audio/upload-sample/?account=${account}`; let blob; /* // Example 1: Fetch audio from URL const audioUrl = "https://upload.wikimedia.org/wikipedia/commons/voice-sample.mp3"; const responseAudio = await fetch(audioUrl); blob = await responseAudio.blob(); */ /* // Example 2: Load audio from local file (Blob) const fsp = require('fs').promises; const audioFileName = "./voice-sample.mp3"; blob = new Blob([await fsp.readFile(audioFileName)]); */ /* // Example 3: Load from input file html element // <input id="audio-file" type="file"> const audioFile = document.getElementById(`audio-file`); if (audioFile.files[0]) blob = audioFile.files[0]); */ const response = await fetch(apiUrl, { method: "POST" headers: { "Authorization": `Bearer ${token}`, }, body: blob }); const result = await response.json(); console.log("response", {response, result});
-
import requests token = "API token" account = "Previously configured audio account" apiUrl = f"https://api.useapi.net/v1/minimax/audio/upload-sample/?account={account}" headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'audio/mpeg' } # # Example 1: Fetch audio from URL # audio_url = "https://upload.wikimedia.org/wikipedia/commons/voice-sample.mp3" # response_audio = requests.get(audio_url) # file_content = response_audio.content # # Example 2: Load audio from local file # audio_file_path = "./voice-sample.mp3" # with open(audio_file_path, 'rb') as audio_file: # file_content = audio_file.read() response = requests.post(api_url, headers=headers, data=file_content) print(response, response.json())