POST
/
VoiceChanger
Python
import requests

url = "https://api.musicgpt.com/api/public/v1/VoiceChanger"

payload = {
    "audio_url": "<string>",
    "voice_id": "<string>",
    "remove_background": "<int>",
    "pitch": "<int>",
    "webhook_url": "<string>"
}

# For file upload instead of URL:
# files = {'audio_file': open('filepath', 'rb')}

headers = {
    "Authorization": "<API Key>"
}

response = requests.post(url, data=payload, headers=headers)
# For file upload:
# response = requests.post(url, data=payload, files=files, headers=headers)

print(response.text)
{
  "success": true,
  "task_id": "84038e1e-3687-4f7a-9c55-692754b125ee",
  "conversion_id": "e3631817-165d-4f17-a7e2-7008d200ff3e",
  "eta": 22
}
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.

Endpoint

POST /VoiceChanger
This is the primary endpoint for initiating voice conversion tasks.

Sample Output

Listen to a real sample output: Output File: Download Audio

Try 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

ParameterTypeRequiredDescription
audio_urlStringOptionalURL of the audio file to convert. Either audio_url or audio_file must be provided.
audio_fileUploadFileOptionalUpload the audio file directly. Either audio_url or audio_file must be provided.
voice_idString✅ YesVoice model to convert the audio into.
remove_backgroundIntegerOptionalSet to 1 to remove background noise. Default is 0.
pitchIntegerOptionalAdjust pitch between -12 and 12 semitones. Default is 0.
webhook_urlStringOptionalCallback URL for async response.
💡 Note: You must provide either audio_url or audio_file — not both as None.

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, and webhook_url before 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_url or audio_file provided.
  • 500 Internal Server Error: Something went wrong on our end.
You can download or stream the result directly from the audio_url.

Payload and Request Formation

Authorizations

Authorization
string
header
required

Body

multipart/form-data
audio_url
string
required

URL of audio file to process

Example:

"https://example.com/audio.wav"

voice_id
string
required

Voice model ID

Example:

"demo-voice-id"

audio_file
file

Audio file to upload

remove_background
enum<integer>
default:0

1 to remove background noise, 0 to keep

Available options:
0,
1
pitch
integer
default:0

Pitch adjustment (-12 to +12)

Required range: -12 <= x <= 12
webhook_url
string

Callback URL

Example:

"https://example.com/callback"

Response

Successful response

success
boolean
task_id
string
conversion_id
string
eta
integer