跳到主要内容

创建音频歌词生成任务

POST 

https://apibox.erweima.ai/api/v1/lyrics

创建一个新的音频歌词生成任务,可以根据提示词生成歌词内容。### 注意事项

  1. 生成的歌词将保留15天
  2. 回调只有一个阶段:complete(生成完成)
  3. 每次生成会返回多个歌词版本供选择

Request

Bodyrequired

    promptstringrequired

    歌词生成提示词,描述想要生成的歌词内容

    Example: A song about peaceful night in the city
    callBackUrlurirequired

    任务完成后的回调URL。查看回调示例

    Example: https://api.example.com/callback

Responses

请求成功

Schema
    codeinteger

    状态码说明

    • ✅ 200 - 请求成功
    • ⚠️ 400 - 参数错误
    • ⚠️ 401 - 没有访问权限
    • ⚠️ 404 - 请求方式或者路径错误
    • ⚠️ 405 - 调用超过限制
    • ⚠️ 413 - 主题或者prompt过长
    • ⚠️ 429 - 积分不足
    • ⚠️ 455 - 网站维护
    • ❌ 500 - 服务器异常

    Possible values: [200, 400, 401, 404, 405, 413, 429, 455, 500]

    Example: 200
    msgstring

    当 code != 200 时,展示错误信息

    Example: success
    data object
    taskIdstring

    任务ID,用于后续查询任务状态

    Example: 5c79****be8e

Callbacks

POST 

{$request.body#/callBackUrl}

当歌词生成完成时,系统会调用此回调通知结果。

回调示例

{
"code": 200,
"msg": "All generated successfully.",
"data": {
"callbackType": "complete",
"taskId": "11dc****8b0f",
"lyricsData": [
{
"text": "[Verse]\n我穿越城市黑暗夜\n心中燃烧梦想的烈火",
"title": "钢铁侠",
"status": "complete",
"errorMessage": ""
},
{
"text": "[Verse]\n风在呼唤我名字\n钢铁盔甲闪得刺眼",
"title": "钢铁侠",
"status": "complete",
"errorMessage": ""
}
]
}
}

Body

    codeinteger

    状态码

    Example: 200
    msgstring

    返回消息

    Example: All generated successfully
    data object
    callbackTypestring

    回调类型,固定为 complete

    Possible values: [complete]

    Example: complete
    taskIdstring

    任务ID

    lyricsData object[]

    生成的歌词列表

  • Array [
  • textstring

    歌词内容

    titlestring

    歌词标题

    statusstring

    生成状态

    Possible values: [complete, failed]

    errorMessagestring

    错误信息,仅当状态为 failed 时有值

  • ]

Callbacks Responses

回调接收成功

Authorization: http

name: BearerAuthtype: httpscheme: bearerbearerFormat: API Keydescription: # 🔑 API 认证说明

所有接口都需要通过 Bearer Token 方式进行认证。

## 获取 API Key

1. 访问 [API Key 管理页面](https://sunoapi.org/api-key) 获取您的 API Key

## 使用方式

在请求头中添加:

```
Authorization: Bearer YOUR_API_KEY
```

> **⚠️ 注意:**
> - 请妥善保管您的 API Key,不要泄露给他人
> - 如果怀疑 API Key 泄露,请立即在管理页面重置
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://apibox.erweima.ai/api/v1/lyrics");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"prompt\": \"A song about peaceful night in the city\",\n \"callBackUrl\": \"https://api.example.com/callback\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://apibox.erweima.ai
Auth
Body required
{
  "prompt": "A song about peaceful night in the city",
  "callBackUrl": "https://api.example.com/callback"
}
ResponseClear

Click the Send API Request button above and see the response here!