lets create a simple app gradio that uses this  api gcui-art/suno-api currently mainly implements the following APIs:

- `/api/generate`: Generate music
- `/v1/chat/completions`: Generate music - Call the generate API in a format 
  that works with OpenAI’s API.
- `/api/custom_generate`: Generate music (Custom Mode, support setting lyrics, 
  music style, title, etc.)
- `/api/generate_lyrics`: Generate lyrics based on prompt
- `/api/get`: Get music information based on the id. Use “,” to separate multiple 
    ids.  If no IDs are provided, all music will be returned.
- `/api/get_limit`: Get quota Info
- `/api/extend_audio`: Extend audio length
Feel free to explore the detailed API parameters and conduct tests on this page.

Details of the API and testing it online
This is just a demo, bound to a test account. Please do not use it frequently, so that more people can test online.

suno-api
 1.1.0 
OAS 3.0
Use API to call the music generation service of Suno.ai and easily integrate it into agents like GPTs.

default


POST
/api/generate
Generate audio based on Prompt.

It will automatically fill in the lyrics.

2 audio files will be generated for each request, consuming a total of 10 credits.

wait_audio can be set to API mode:

• By default, it is set to false, which indicates the background mode. It will only return audio task information, and you will need to call the get API to retrieve detailed audio information.

• If set to true, it simulates synchronous mode. The API will wait for a maximum of 100s until the audio is generated, and will directly return the audio link and other information. Recommend using in GPTs and other agents.

Parameters
Cancel
No parameters

Request body

application/json
{
  "prompt": "A popular heavy metal song about war, sung by a deep-voiced male singer, slowly and melodiously. The lyrics depict the sorrow of people after the war.",
  "make_instrumental": false,
  "wait_audio": false
}
Execute
Clear
Responses
Curl

curl -X 'POST' \
  'https://suno.gcui.ai/api/generate' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "prompt": "A popular heavy metal song about war, sung by a deep-voiced male singer, slowly and melodiously. The lyrics depict the sorrow of people after the war.",
  "make_instrumental": false,
  "wait_audio": false
}'
Request URL
https://suno.gcui.ai/api/generate
Server response
Code	Details
500
Undocumented
Error: response status is 500

Response headers
 cache-control: public,max-age=0,must-revalidate 
 content-length: 0 
 date: Sun,22 Sep 2024 12:51:27 GMT 
 server: Vercel 
 strict-transport-security: max-age=63072000 
 vary: RSC,Next-Router-State-Tree,Next-Router-Prefetch,Next-Url 
 x-matched-path: /api/generate 
 x-vercel-cache: MISS 
 x-vercel-id: cpt1::iad1::hqpm9-1727009487025-9e4313b6b85b 
Responses
Code	Description	Links
200	
success

Media type

application/json
Controls Accept header.
Example Value
Schema
[
  {
    "0": {
      "id": "string",
      "title": "string",
      "image_url": "string",
      "lyric": "string",
      "audio_url": "string",
      "video_url": "string",
      "created_at": "string",
      "model_name": "string",
      "status": "string",
      "gpt_description_prompt": "string",
      "prompt": "string",
      "type": "string",
      "tags": "string"
    },
    "1": {
      "id": "string",
      "title": "string",
      "image_url": "string",
      "lyric": "string",
      "audio_url": "string",
      "video_url": "string",
      "created_at": "string",
      "model_name": "string",
      "status": "string",
      "gpt_description_prompt": "string",
      "prompt": "string",
      "type": "string",
      "tags": "string"
    }
  }
]
No links

POST
/v1/chat/completions
Generate audio based on Prompt - OpenAI API format compatibility.

Convert the /api/generate API to be compatible with the OpenAI /v1/chat/completions API format.

Generally used in OpenAI compatible clients.

Parameters
Cancel
No parameters

Request body

application/json
{
  "prompt": "A popular heavy metal song about war, sung by a deep-voiced male singer, slowly and melodiously. The lyrics depict the sorrow of people after the war."
}
Execute
Clear
Responses
Curl

curl -X 'POST' \
  'https://suno.gcui.ai/v1/chat/completions' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "prompt": "A popular heavy metal song about war, sung by a deep-voiced male singer, slowly and melodiously. The lyrics depict the sorrow of people after the war."
}'
Request URL
https://suno.gcui.ai/v1/chat/completions
Server response
Code	Details
500
Undocumented
Error: response status is 500

Response headers
 cache-control: public,max-age=0,must-revalidate 
 content-length: 0 
 date: Sun,22 Sep 2024 12:53:08 GMT 
 server: Vercel 
 strict-transport-security: max-age=63072000 
 vary: RSC,Next-Router-State-Tree,Next-Router-Prefetch,Next-Url 
 x-matched-path: /v1/chat/completions 
 x-vercel-cache: MISS 
 x-vercel-id: cpt1::iad1::kv8zr-1727009587871-ea997728550b 
Responses
Code	Description	Links
200	
success

Media type

application/json
Controls Accept header.
Example Value
Schema
{
  "data": "string"
}
No links

POST
/api/custom_generate
Generate Audio - Custom Mode

The custom mode enables users to provide additional details about the music, such as music genre, lyrics, and more.

2 audio files will be generated for each request, consuming a total of 10 credits.

wait_audio can be set to API mode:

• By default, it is set to false, which indicates the background mode. It will only return audio task information, and you will need to call the get API to retrieve detailed audio information.

• If set to true, it simulates synchronous mode. The API will wait for a maximum of 100s until the audio is generated, and will directly return the audio link and other information. Recommend using in GPTs and other agents.

Parameters
Try it out
No parameters

Request body

application/json
Example Value
Schema
{
  "prompt": "[Verse 1]\nCruel flames of war engulf this land\nBattlefields filled with death and dread\nInnocent souls in darkness, they rest\nMy heart trembles in this silent test\n\n[Verse 2]\nPeople weep for loved ones lost\nBattered bodies bear the cost\nSeeking peace and hope once known\nOur grief transforms to hearts of stone\n\n[Chorus]\nSilent battlegrounds, no birds' song\nShadows of war, where we don't belong\nMay flowers of peace bloom in this place\nLet's guard this precious dream with grace\n\n[Bridge]\nThrough the ashes, we will rise\nHand in hand, towards peaceful skies\nNo more sorrow, no more pain\nTogether, we'll break these chains\n\n[Chorus]\nSilent battlegrounds, no birds' song\nShadows of war, where we don't belong\nMay flowers of peace bloom in this place\nLet's guard this precious dream with grace\n\n[Outro]\nIn unity, our strength will grow\nA brighter future, we'll soon know\nFrom the ruins, hope will spring\nA new dawn, we'll together bring",
  "tags": "pop metal male melancholic",
  "title": "Silent Battlefield",
  "make_instrumental": false,
  "wait_audio": false
}
Responses
Code	Description	Links
200	
success

Media type

application/json
Controls Accept header.
Example Value
Schema
[
  {
    "0": {
      "id": "string",
      "title": "string",
      "image_url": "string",
      "lyric": "string",
      "audio_url": "string",
      "video_url": "string",
      "created_at": "string",
      "model_name": "string",
      "status": "string",
      "gpt_description_prompt": "string",
      "prompt": "string",
      "type": "string",
      "tags": "string"
    },
    "1": {
      "id": "string",
      "title": "string",
      "image_url": "string",
      "lyric": "string",
      "audio_url": "string",
      "video_url": "string",
      "created_at": "string",
      "model_name": "string",
      "status": "string",
      "gpt_description_prompt": "string",
      "prompt": "string",
      "type": "string",
      "tags": "string"
    }
  }
]
No links

POST
/api/extend_audio
Extend audio length.

Extend audio length.

Parameters
Try it out
No parameters

Request body

application/json
Example Value
Schema
{
  "audio_id": "e76498dc-6ab4-4a10-a19f-8a095790e28d",
  "prompt": "",
  "continue_at": "109.96",
  "title": "",
  "tags": ""
}

POST
/api/generate_lyrics
Generate lyrics based on Prompt.

Generate lyrics based on Prompt.

Parameters
Try it out
No parameters

Request body

application/json
Example Value
Schema
{
  "prompt": "A soothing lullaby"
}
Responses
Code	Description	Links
200	
success

Media type

application/json
Controls Accept header.
Example Value
Schema
{
  "text": "string",
  "title": "string",
  "status": "string"
}
No links

GET
/api/get
Get audio information

Parameters
Try it out
Name	Description
ids
string
(query)
Audio IDs, separated by commas. Leave blank to return a list of all music.

ids
Responses
Code	Description	Links
200	
success

Media type

application/json
Controls Accept header.
Example Value
Schema
[
  {
    "0": {
      "id": "string",
      "title": "string",
      "image_url": "string",
      "lyric": "string",
      "audio_url": "string",
      "video_url": "string",
      "created_at": "string",
      "model_name": "string",
      "status": "string",
      "gpt_description_prompt": "string",
      "prompt": "string",
      "type": "string",
      "tags": "string"
    },
    "1": {
      "id": "string",
      "title": "string",
      "image_url": "string",
      "lyric": "string",
      "audio_url": "string",
      "video_url": "string",
      "created_at": "string",
      "model_name": "string",
      "status": "string",
      "gpt_description_prompt": "string",
      "prompt": "string",
      "type": "string",
      "tags": "string"
    }
  }
]
No links

GET
/api/get_limit
Get quota information.

Parameters
Try it out
No parameters

Responses
Code	Description	Links
200	
success

Media type

application/json
Controls Accept header.
Example Value
Schema
{
  "credits_left": 0,
  "period": "string",
  "monthly_limit": 0,
  "monthly_usage": 0
}
No links