import requests
import json
url = "https://api.musicgpt.com/api/public/v1/Extraction"
headers = {
"Authorization": "<API_KEY>"
}
files = {
"audio_file": open("path_to_audio.mp3", "rb")
}
data = {
"audio_url": "",
"stems": json.dumps(["vocals", "drums"]),
"preprocessing_options": json.dumps(["Denoise"]),
"webhook_url": "http://webhook.musicgpt.com"
}
response = requests.post(url, headers=headers, data=data, files=files)
print(response.json())
{
"success": true,
"task_id": "62725d68-01e8-4c87-8fb0-298aa81c529c",
"conversion_id": "46b358c9-b22f-49d1-a68d-17901a6a549b",
"eta": 11,
"credit_estimate": 2.5
}
Process an audio file to extract specified stems (vocals, instrumental, or other components) with optional preprocessing. Supports file upload or URL with webhook callback.
import requests
import json
url = "https://api.musicgpt.com/api/public/v1/Extraction"
headers = {
"Authorization": "<API_KEY>"
}
files = {
"audio_file": open("path_to_audio.mp3", "rb")
}
data = {
"audio_url": "",
"stems": json.dumps(["vocals", "drums"]),
"preprocessing_options": json.dumps(["Denoise"]),
"webhook_url": "http://webhook.musicgpt.com"
}
response = requests.post(url, headers=headers, data=data, files=files)
print(response.json())
{
"success": true,
"task_id": "62725d68-01e8-4c87-8fb0-298aa81c529c",
"conversion_id": "46b358c9-b22f-49d1-a68d-17901a6a549b",
"eta": 11,
"credit_estimate": 2.5
}
Successfully initiated audio extraction
The response is of type object
.