Suno API
Model Page: Suno API
This model card illustartes the steps to use Suno API's endpoint. You can also check out other model cards:
Model Information
Developed by the Suno team in Cambridge, MA, Suno is a leading-edge text-to-music model. While it doesn't have an official API service, PiAPI has introduced an unofficial Suno API, allowing developers globally to integrate Suno’s music creation capabilities into their applications.
Usage Steps
Below we share the code snippets on how to use the Suno API's "Generate Full Song" endpoint.
- The programming language is Python
- This is only applicable for Extended Clips generated from the "Extend" function of the "Generate Music" endpoint.
Create a task ID from the "Generate Full Song" endpoint
import http.client
conn = http.client.HTTPSConnection("api.piapi.ai")
payload = "{\n \"clip_id\": \"0e764cab****************55f76ca44ed6\"\n}"
headers = {
'X-API-Key': "{{x-api-key}}", //Insert your API Key here
'Content-Type': "application/json",
'Accept': "application/json"
}
conn.request("POST", "/api/suno/v1/music/concat", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Retrieve the task ID
{
"code": 200,
"data": {
"task_id": "5440b19a*****************e92de94d5110" //Record the taskID provided in your response terminal
},
"message": "success"
}
Insert the "Generate Full Song" task ID into the fetch endpoint
import http.client
conn = http.client.HTTPSConnection("api.piapi.ai")
headers = {
'Content-Type': "application/json",
'Accept': "application/json"
}
conn.request("GET", "/api/suno/v1/music/task_id", headers=headers) //Replace the "task_id" with your task ID
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
For fetch endpoint responses - Refer to our documentation for more detailed information.
Contact us
Contact us at contact@piapi.ai for any inquires.