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
audio_url
string
required

URL or S3 path to the input audio.

Example:

"https://mybucket.s3.amazonaws.com/song.mp3"

extend_after
number
required

Time in seconds after which to start the extension.

Example:

35

audio_file
file

Uploaded audio file to be extended.

prompt
string

Describes how the extended section should sound.

Example:

"Add a calming piano outro"

lyrics
string

Optional lyrics for the extended segment.

Maximum length: 2000
Example:

"Let the journey fade away"

gender
enum<string>

Voice style if vocal content is generated.

Available options:
male,
female,
neutral
Example:

"neutral"

webhook_url
string

Callback URL for async processing results.

Example:

"https://example.com/webhook"

Response

Successfully initiated extend task

success
boolean
message
string
task_id
string
conversion_id_1
string
conversion_id_2
string
eta
integer

Estimated processing time in seconds

credit_estimate
number