LogoAICore Docs

Suno API 文生歌曲

Suno API 的歌词生成、歌曲生成与结果查询示例

第一步:生成歌词接口

将下面示例中的 sk-xxx 替换为实际 API Key。

# 请求格式
curl https://api.xty.app/suno/submit/lyrics       -H "Content-Type: application/json"       -H "Authorization: Bearer sk-xxx"       -d '{
    "prompt": "关于爱情的中文歌词"
}'

# 返回格式(其中 data 字段为异步任务 id)
{
    "code": "success",
    "message": "",
    "data": "5d868e3d-986a-4980-a2f9-79aba5860d9e"
}

第二步:查询歌词结果

# 请求格式(请求接口地址后面的 id 为第一步接口返回的“异步任务 id”)
curl https://api.xty.app/suno/fetch/5d868e3d-986a-4980-a2f9-79aba5860d9e       -H "Content-Type: application/json"       -H "Authorization: Bearer sk-xxx"

# 返回格式(其中 text 为歌词内容)
{
    "code": "success",
    "message": "",
    "data": {
        "task_id": "5d868e3d-986a-4980-a2f9-79aba5860d9e",
        "action": "",
        "status": "SUCCESS",
        "fail_reason": "",
        "submit_time": 1722502065,
        "start_time": 1722502065,
        "finish_time": 1722502075,
        "progress": "100%",
        "data": {
            "id": "5d868e3d-986a-4980-a2f9-79aba5860d9e",
            "text": "[Verse]\n在那初春的街道\n你走进了我的心跳\n阳光洒在你微笑\n那一刻世界变得美好\n\n[Verse 2]\n夜晚星空下我们依靠\n沉默中听懂彼此心跳\n细雨中我们欢笑\n那感觉纯真无可替代\n\n[Chorus]\n你是爱的旋律\n在我心底不停响起\n每个瞬间都神奇\n与你同在全是奇迹\n\n[Verse 3]\n生活偶尔会疲惫\n有你陪伴不再心碎\n你的眼睛像海水\n让我忘掉所有的泪\n\n[Bridge]\n一起走过的时光\n每一刻都难以遗忘\n在你臂弯中守望\n心跳共鸣如诗如画\n\n[Chorus]\n你是爱的旋律\n在我心底不停响起\n每个瞬间都神奇\n与你同在全是奇迹",
            "title": "爱的旋律",
            "status": "complete"
        }
    }
}

第三步:生成歌曲接口

将下面示例中的 sk-xxx 替换为实际 API Key。

# 请求格式
curl https://api.xty.app/suno/submit/music       -H "Content-Type: application/json"       -H "Authorization: Bearer sk-xxx"       -d '{
    "gpt_description_prompt": "关于爱情的歌曲"
}'

# 返回格式(其中 data 字段为异步任务 id)
{
    "code": "success",
    "message": "",
    "data": "1dcc200b-bf9c-4f5f-94dd-b20104d066e4"
}

# body 参数说明:
# 1. 灵感模式
{
    "gpt_description_prompt": "cat"
}

# 2. 自定义模式
{
    "prompt": "[Verse]\nWalking down the streets\nBeneath the city lights\nNeon signs flickering\nLighting up the night\nHeart beating faster\nLike a drum in my chest\nI'm alive in this moment\nFeeling so blessed\n\nStilettos on the pavement\nStepping with grace\nSurrounded by the people\nMoving at their own pace\nThe rhythm of the city\nIt pulses in my veins\nLost in the energy\nAs my worries drain\n\n[Verse 2]\nConcrete jungle shining\nWith its dazzling glow\nEvery corner hiding secrets that only locals know\nA symphony of chaos\nBut it's music to my ears\nThe hustle and the bustle\nWiping away my fears",
    "tags": "emotional punk",
    "mv": "chirp-v3-0",
    "title": "City Lights"
}

# 3. 续写模式
{
    "prompt": "[Verse]\nWalking down the streets\nBeneath the city lights\nNeon signs flickering\nLighting up the night\nHeart beating faster\nLike a drum in my chest\nI'm alive in this moment\nFeeling so blessed\n\nStilettos on the pavement\nStepping with grace\nSurrounded by the people\nMoving at their own pace\nThe rhythm of the city\nIt pulses in my veins\nLost in the energy\nAs my worries drain\n\n[Verse 2]\nConcrete jungle shining\nWith its dazzling glow\nEvery corner hiding secrets that only locals know\nA symphony of chaos\nBut it's music to my ears\nThe hustle and the bustle\nWiping away my fears",
    "tags": "bass-driven atmospheric heavy metal",
    "mv": "chirp-v3-0",
    "title": "City Lights",
    "task_id": "736a6f88-bd29-4b1e-b110-37132a5325ac",
    "continue_clip_id": "ce2cfbce-9ea0-45b0-9386-020c0ff54a49",
    "continue_at": 80
}

Suno API 示例界面

第四步:查询歌曲结果

# 请求格式(请求接口地址后面的 id 为第三步接口返回的“异步任务 id”)
curl https://api.xty.app/suno/fetch/1dcc200b-bf9c-4f5f-94dd-b20104d066e4       -H "Content-Type: application/json"       -H "Authorization: Bearer sk-xxx"

# 返回格式
{
    "code": "success",
    "message": "",
    "data": {
        "task_id": "1dcc200b-bf9c-4f5f-94dd-b20104d066e4",
        "action": "",
        "status": "IN_PROGRESS",
        "fail_reason": "",
        "submit_time": 1722503319,
        "start_time": 1722503335,
        "finish_time": 0,
        "progress": "0%",
        "data": [
            {
                "id": "a4548a77-a67b-48a5-988c-d9aa86c7a27c",
                "title": "爱在呼吸间",
                "status": "streaming",
                "audio_url": "https://audiopipe.suno.ai/?item_id=a4548a77-a67b-48a5-988c-d9aa86c7a27c",
                "image_url": "https://cdn2.suno.ai/image_a4548a77-a67b-48a5-988c-d9aa86c7a27c.jpeg"
            },
            {
                "id": "21060ead-904b-4ce3-9497-ba0fac01e90c",
                "title": "爱在呼吸间",
                "status": "complete",
                "audio_url": "https://cdn1.suno.ai/21060ead-904b-4ce3-9497-ba0fac01e90c.mp3",
                "video_url": "https://cdn1.suno.ai/21060ead-904b-4ce3-9497-ba0fac01e90c.mp4"
            }
        ]
    }
}