disingn / sunotoapi

将 sunoAi web转成 openai 格式进行调用
187 stars 33 forks source link

1. 项目简介

简单的将 suno.ai web转为api接口

2. 部署方式

将 config.yaml.example 重命名为 config.yaml 并修改其中的配置

Server:
    Port: 3560
App:
    Client: #登录 suno.ai 后的 cookie中的__client=xxxxx 的值

启动服务

./sunoweb2api

3. 使用方式

下列 api 都可以增加一个Header参数

Authorization : Bearer Client

其中Client为登录 suno.ai 后的 cookie中的__client=xxxxx 的值

如果不填写 默认使用config.yaml中的配置中的 Client

示例:

curl --location --request POST 'localhost:3560/v1/chat/completions' \
--header 'Authorization: Bearer client' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "chirp-v3-0",
    "messages": [
        {
            "role": "user",
            "content": "制作歌曲《万能的数字》"
        }
    ]
}'

创建音乐任务

curl --location --request POST 'localhost:3560/v2/generate' \
--header 'Content-Type: application/json' \
--data-raw '{
    "gpt_description_prompt": "an atmospheric metal song about dancing all night long",
    "mv": "chirp-v3-0",
    "prompt": "",
    "make_instrumental": false
}'

支持如下参数:

{
  "prompt": "[Verse]\nEvery morning, when I wake up\nI stumble to the kitchen to get my cup (cup)\nThe smell, the taste, it's like a dream\nI'm addicted to that caffeinated beam\n\n[Chorus]\nI need my java fix, it's my daily high (high)\nGotta have my coffee, don't ask me why (why)\nBrew it strong, brew it black, can't get enough\nThat sweet, dark liquid, it keeps me buzzin' (buzzin')\n\n[Verse 2]\nEspresso, latte, cappuccino too\nI'll take it any way, as long as it's brew\nFrom the fancy cafes to the corner shops\nI'm on a mission to find the perfect crop (yeah)",
  "tags": "epic blues",
  "mv": "chirp-v3-0",
  "title": "Coffee Addiction",
  "continue_clip_id": null,
  "continue_at": null
}