POST
/
VoiceChanger
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:

Prompt: a song about greenery, nature and forest.

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.

๐Ÿ“ž Webhook Response

When the voice conversion completes, the webhook receives:

{
  "success": true,
  "task_id": "84038e1e-3687-4f7a-9c55-692754b125ee",
  "conversion_id": "e3631817-165d-4f17-a7e2-7008d200ff3e",
  "audio_url": "https://musicgpt.s3.us-east-1.amazonaws.com/conversions/converted_audio.wav",
  "conversion_cost": 0.031,
  "voice_id": "Drake",
  "pitch": 0
}

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

Response

200
application/json

Successful response

The response is of type object.