Music Generation
POST
/api/v1/taskThis endpoint from PiAPI's Suno API utilizes either Suno's chirp-v3-0
, chirp-v3-5
and chirp-v4
model to produce music.
You can generate music in two modes: Description and Custom. The Custom mode allows users to input their own lyrics, specify detailed music style preferences and extend music clips.
- To create task under Description mode, set the
task_type
in the request body togenerate_music
. - To create task under Custom mode, set the
task_type
togenerate_music_custom
.
Difference about available params between creating task under Description mode and Custom mode:
In Description mode, the
input
field in request body includes the following fields:gpt_description_prompt
model_version
make_instrumental
(optional)
In Custom mode,the
input
field in request body includes the following fields:prompt
model_version
optional:
make_instrumental
tags
negative_tags
continue_clip_id
continue_at
title
Request
Your API key for authorization
A plain prompt to describe the song.Only available in generate_music
task type.
The title of the song.Only available in generate_music_custom
task type
The prompt to add lyrics into the music. Only available in generate_music_custom
task type
The type of music. Only available in generate_music_custom
task type
Only available in generate_music_custom
task type.
The clip_id of the clip to continue from.Only available in generate_music_custom
task type.
The continuation from the last second of the previous clip. The value 0 indicates restart from the beginning. Only available in generate_music_custom
task type.
{
"model": "suno",
"task_type": "generate_music",
"input": {
"gpt_description_prompt": "Autumn night breeze",
"make_instrumental": true,
"model_version": "chirp-v3-0"
},
"config": {
"service_mode": "",
"webhook_config": {
"endpoint": "",
"secret": ""
}
}
}
Request samples
Responses
{
"code": 200,
"data": {
"task_id": "d6c778aa-44cc-4a07-935d-a4c6e70755a7",
"model": "suno",
"task_type": "generate_music",
"status": "pending",
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "",
"secret": ""
}
},
"input": {},
"output": {
"clips": null
},
"meta": {},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
},
"message": "success"
}