Python
import requests
url = "https://api.musicgpt.com/api/public/v1/VoiceChanger"
headers = {
"Authorization": "<API_KEY>"
}
data = {
"voice_id": "e0bb585f-b798-4bac-ac4e-de7fff38f9d75",
"remove_background": 1,
"pitch": 0,
"webhook_url": "https://example.com/my-webhook"
}
# Option 1: audio_url
data["audio_url"] = "<YOUR_AUDIO_URL>"
response = requests.post(url, headers=headers, data=data)
# Option 2: File Upload
# with open("song.mp3", "rb") as f:
# files = {"audio_file": f}
# response = requests.post(url, headers=headers, data=data, files=files)
print(response.json())<?php
$url = "https://api.musicgpt.com/api/public/v1/VoiceChanger";
$apiKey = "<API_KEY>";
$data = [
"voice_id" => "voice_12345",
"remove_background" => 1,
"pitch" => 0,
"webhook_url" => "https://example.com/my-webhook"
];
// Option 1: audio_url
$data["audio_url"] = "<YOUR_AUDIO_URL>";
// Option 2: File Upload
// $data["audio_file"] = new CURLFile("song.mp3");
$headers = [
"Authorization: " . $apiKey
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.musicgpt.com/api/public/v1/VoiceChanger"
apiKey := "<API_KEY>"
payload := map[string]string{
"voice_id": "voice_12345",
"remove_background": "1",
"pitch": "0",
"webhook_url": "https://example.com/my-webhook",
}
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
for key, val := range payload {
_ = writer.WriteField(key, val)
}
// Option 1: audio_url
writer.WriteField("audio_url", "<YOUR_AUDIO_URL>")
// Option 2: File Upload
// file, _ := os.Open("song.mp3")
// defer file.Close()
// part, _ := writer.CreateFormFile("audio_file", "song.mp3")
// io.Copy(part, file)
writer.Close()
req, _ := http.NewRequest("POST", url, body)
req.Header.Set("Authorization", apiKey)
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
response, _ := io.ReadAll(resp.Body)
fmt.Println(string(response))
}import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class VoiceChanger {
public static void main(String[] args) throws IOException {
String url = "https://api.musicgpt.com/api/public/v1/VoiceChanger";
String apiKey = "<API_KEY>";
// Option 1: audio_url
RequestBody requestBody = new FormBody.Builder()
.add("audio_url", "<YOUR_AUDIO_URL>")
.add("voice_id", "voice_12345")
.add("remove_background", "1")
.add("pitch", "0")
.add("webhook_url", "https://example.com/my-webhook")
.build();
// Option 2: File Upload
// File audioFile = new File("song.mp3");
// RequestBody requestBody = new MultipartBody.Builder()
// .setType(MultipartBody.FORM)
// .addFormDataPart("voice_id", "voice_12345")
// .addFormDataPart("remove_background", "1")
// .addFormDataPart("pitch", "0")
// .addFormDataPart("webhook_url", "https://example.com/my-webhook")
// .addFormDataPart("audio_file", audioFile.getName(),
// RequestBody.create(audioFile, MediaType.parse("audio/mpeg")))
// .build();
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.header("Authorization", apiKey)
.build();
OkHttpClient client = new OkHttpClient();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}curl --request POST \
--url https://api.musicgpt.com/api/public/v1/VoiceChanger \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form audio_url=https://example.com/audio.wav \
--form voice_id=demo-voice-id \
--form 'audio_file=<string>' \
--form remove_background=0 \
--form pitch=0 \
--form webhook_url=https://example.com/callback \
--form 0.audio_file='@example-file' \
--form 1.audio_file='@example-file'const form = new FormData();
form.append('audio_url', 'https://example.com/audio.wav');
form.append('voice_id', 'demo-voice-id');
form.append('audio_file', '<string>');
form.append('remove_background', '0');
form.append('pitch', '0');
form.append('webhook_url', 'https://example.com/callback');
form.append('0.audio_file', '{
"fileName": "example-file"
}');
form.append('1.audio_file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.musicgpt.com/api/public/v1/VoiceChanger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/VoiceChanger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.wav\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\ndemo-voice-id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_background\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pitch\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "84038e1e-3687-4f7a-9c55-692754b125ee",
"conversion_id": "e3631817-165d-4f17-a7e2-7008d200ff3e",
"eta": 22
}{
"success": false,
"error": "The file could not be downloaded from the provided URL"
}{
"success": false,
"error": "Insufficient credit balance"
}{
"success": false,
"error": "Both audio_url and audio_file cannot be None"
}{
"success": false,
"error": "Internal Server Error"
}Features
Voice Changer
Convert the voice from an audio file or URL to a different voice.
POST
/
v1
/
VoiceChanger
Python
import requests
url = "https://api.musicgpt.com/api/public/v1/VoiceChanger"
headers = {
"Authorization": "<API_KEY>"
}
data = {
"voice_id": "e0bb585f-b798-4bac-ac4e-de7fff38f9d75",
"remove_background": 1,
"pitch": 0,
"webhook_url": "https://example.com/my-webhook"
}
# Option 1: audio_url
data["audio_url"] = "<YOUR_AUDIO_URL>"
response = requests.post(url, headers=headers, data=data)
# Option 2: File Upload
# with open("song.mp3", "rb") as f:
# files = {"audio_file": f}
# response = requests.post(url, headers=headers, data=data, files=files)
print(response.json())<?php
$url = "https://api.musicgpt.com/api/public/v1/VoiceChanger";
$apiKey = "<API_KEY>";
$data = [
"voice_id" => "voice_12345",
"remove_background" => 1,
"pitch" => 0,
"webhook_url" => "https://example.com/my-webhook"
];
// Option 1: audio_url
$data["audio_url"] = "<YOUR_AUDIO_URL>";
// Option 2: File Upload
// $data["audio_file"] = new CURLFile("song.mp3");
$headers = [
"Authorization: " . $apiKey
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.musicgpt.com/api/public/v1/VoiceChanger"
apiKey := "<API_KEY>"
payload := map[string]string{
"voice_id": "voice_12345",
"remove_background": "1",
"pitch": "0",
"webhook_url": "https://example.com/my-webhook",
}
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
for key, val := range payload {
_ = writer.WriteField(key, val)
}
// Option 1: audio_url
writer.WriteField("audio_url", "<YOUR_AUDIO_URL>")
// Option 2: File Upload
// file, _ := os.Open("song.mp3")
// defer file.Close()
// part, _ := writer.CreateFormFile("audio_file", "song.mp3")
// io.Copy(part, file)
writer.Close()
req, _ := http.NewRequest("POST", url, body)
req.Header.Set("Authorization", apiKey)
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
response, _ := io.ReadAll(resp.Body)
fmt.Println(string(response))
}import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class VoiceChanger {
public static void main(String[] args) throws IOException {
String url = "https://api.musicgpt.com/api/public/v1/VoiceChanger";
String apiKey = "<API_KEY>";
// Option 1: audio_url
RequestBody requestBody = new FormBody.Builder()
.add("audio_url", "<YOUR_AUDIO_URL>")
.add("voice_id", "voice_12345")
.add("remove_background", "1")
.add("pitch", "0")
.add("webhook_url", "https://example.com/my-webhook")
.build();
// Option 2: File Upload
// File audioFile = new File("song.mp3");
// RequestBody requestBody = new MultipartBody.Builder()
// .setType(MultipartBody.FORM)
// .addFormDataPart("voice_id", "voice_12345")
// .addFormDataPart("remove_background", "1")
// .addFormDataPart("pitch", "0")
// .addFormDataPart("webhook_url", "https://example.com/my-webhook")
// .addFormDataPart("audio_file", audioFile.getName(),
// RequestBody.create(audioFile, MediaType.parse("audio/mpeg")))
// .build();
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.header("Authorization", apiKey)
.build();
OkHttpClient client = new OkHttpClient();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}curl --request POST \
--url https://api.musicgpt.com/api/public/v1/VoiceChanger \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form audio_url=https://example.com/audio.wav \
--form voice_id=demo-voice-id \
--form 'audio_file=<string>' \
--form remove_background=0 \
--form pitch=0 \
--form webhook_url=https://example.com/callback \
--form 0.audio_file='@example-file' \
--form 1.audio_file='@example-file'const form = new FormData();
form.append('audio_url', 'https://example.com/audio.wav');
form.append('voice_id', 'demo-voice-id');
form.append('audio_file', '<string>');
form.append('remove_background', '0');
form.append('pitch', '0');
form.append('webhook_url', 'https://example.com/callback');
form.append('0.audio_file', '{
"fileName": "example-file"
}');
form.append('1.audio_file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.musicgpt.com/api/public/v1/VoiceChanger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/VoiceChanger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.wav\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\ndemo-voice-id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_background\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pitch\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "84038e1e-3687-4f7a-9c55-692754b125ee",
"conversion_id": "e3631817-165d-4f17-a7e2-7008d200ff3e",
"eta": 22
}{
"success": false,
"error": "The file could not be downloaded from the provided URL"
}{
"success": false,
"error": "Insufficient credit balance"
}{
"success": false,
"error": "Both audio_url and audio_file cannot be None"
}{
"success": false,
"error": "Internal Server Error"
}Convert the voice from an audio file or URL to a different voice using AI voice models.
The VoiceChanger endpoint provides real-time voice transformation by modifying the pitch, removing background noise, and converting the voice using a selected model. Ideal for creative content, dubbing, or personalized audio experiences.
This is the primary endpoint for initiating voice conversion tasks.
Endpoint
POST /v1/VoiceChanger
Sample Output
Listen to a real sample output: Output File: Download AudioTry it Yourself
Visit the VoiceChanger Endpoint Explorer to test it live. Upload a sample, pick a voice, and experience real-time voice transformation.Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
audio_url | String | Optional | URL of the audio file to convert. Either audio_url or audio_file must be provided. |
audio_file | UploadFile | Optional | Upload the audio file directly. Either audio_url or audio_file must be provided. |
voice_id | String | ✅ Yes | Voice model to convert the audio into. |
remove_background | Integer | Optional | Set to 1 to remove background noise. Default is 0. |
pitch | Integer | Optional | Adjust pitch between -12 and 12 semitones. Default is 0. |
webhook_url | String | Optional | Callback URL for async response. |
💡Note: You must provide eitheraudio_urloraudio_file— not both asNone.
content-type: multipart/form-data
Sample Request
cURL
curl -X POST "https://api.musicgpt.com/api/public/v1/VoiceChanger" \
-H "accept: multipart/form-data" \
-H "Authorization: <api_key>" \
-F "audio_url=https://www.youtube.com/watch?v=jGflUbPQfW8" \
-F "voice_id=Drake" \
-F "remove_background=0" \
-F "pitch=0" \
-F "webhook_url=http://webhook.musicgpt.com"
Python
import requests
url = "https://api.musicgpt.com/api/public/v1/VoiceChanger"
headers = {
"accept": "multipart/form-data",
"Authorization": "<api_key>"
}
input_audio_file = open("{path_to_your_audio_file}", "rb")
payload = {
"audio_url": "",
"voice_id": "Drake",
"pitch": 0,
"remove_background": 0,
"webhook_url": "http://abc.requestcatcher.com/test",
}
response = requests.post(url, headers=headers, data=payload, files={"audio_file": input_audio_file})
print(response.json())
🔐 Replace{path_to_your_audio_file},api_key, andwebhook_urlbefore executing.
Sample Response
Success (200 OK)
{
"success":true,
"task_id": "fdcca59e-9788-43fc-9ee6-e9983064c432",
"conversion_id":"3b8dd3e8-104a-4a2f-86ba-3ed722f5190a",
"eta":16,
"credit_estimate":1.07,
"message":"",
"status":"IN_QUEUE"
}
Webhook Response
Success (200 OK)
{
"success": true,
"conversion_type": "Voice Conversion",
"task_id": "fdcca59e-9788-43fc-9ee6-e9983064c432",
"conversion_id": "67092f68-045d-4e3c-8006-532f144dd610",
"audio_url": "https://lalals.s3.amazonaws.com/projects/67092f68-045d-4e3c-8006-532f144dd610.mp3",
"audio_url_wav": "https://lalals.s3.amazonaws.com/projects/67092f68-045d-4e3c-8006-532f144dd610.wav",
"conversion_cost": "0.78",
"conversion_duration": 272.44
}
Common Errors
- 400 Bad Request: Invalid or missing input file.
- 402 Payment Required: Your credit balance is insufficient.
- 422 Unprocessable Entity: No
audio_urloraudio_fileprovided. - 500 Internal Server Error: Something went wrong on our end.
audio_url.
Payload and Request Formation
Authorizations
Body
multipart/form-data
- Option 1
- Option 2
Input audio URL (supported format: YouTube URL).
Example:
"https://example.com/audio.wav"
Voice model ID
Example:
"demo-voice-id"
Audio file to upload
1 to remove background noise, 0 to keep
Available options:
0, 1 Pitch adjustment (-12 to +12)
Required range:
-12 <= x <= 12Callback URL
Example:
"https://example.com/callback"
⌘I