POST
/
extend
Python
import requests

url = "https://api.musicgpt.com/api/public/v1/extend"
headers = {"Authorization": "<API_KEY>"}
data = {
  "extend_after": 35.0,
  "prompt": "Add a calming piano outro",
  "lyrics": "Let the journey fade away",
  "gender": "neutral",
  "webhook_url": "https://example.com/webhook"
}

# Option 1: audio_url
data["audio_url"] = "https://mybucket.s3.amazonaws.com/song.mp3"
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())
{
  "success": true,
  "message": "Extend request submitted successfully",
  "task_id": "task-extend-789",
  "conversion_id_1": "extend-a1b2",
  "conversion_id_2": "extend-c3d4",
  "eta": 38,
  "credit_estimate": 42
}

Authorizations

Authorization
string
header
required

Body

multipart/form-data

Response

200
application/json

Successfully initiated extend task

The response is of type object.