创建音频歌词生成任务
POSThttps://apibox.erweima.ai/api/v1/lyrics
创建一个新的音频歌词生成任务,可以根据提示词生成歌词内容。### 注意事项
- 生成的歌词将保留15天
- 回调只有一个阶段:complete(生成完成)
- 每次生成会返回多个歌词版本供选择
Request
- application/json
Bodyrequired
promptstringrequired
歌词生成提示词,描述想要生成的歌词内容
Example:
A song about peaceful night in the city
Responses
- 200
- 500
请求成功
- application/json
- Schema
- Example (auto)
Schema
- ✅ 200 - 请求成功
- ⚠️ 400 - 参数错误
- ⚠️ 401 - 没有访问权限
- ⚠️ 404 - 请求方式或者路径错误
- ⚠️ 405 - 调用超过限制
- ⚠️ 413 - 主题或者prompt过长
- ⚠️ 429 - 积分不足
- ⚠️ 455 - 网站维护
- ❌ 500 - 服务器异常
codeinteger
状态码说明
Possible values: [200
, 400
, 401
, 404
, 405
, 413
, 429
, 455
, 500
]
Example:
200
msgstring
当 code != 200 时,展示错误信息
Example:
success
data object
{
"code": 200,
"msg": "success",
"data": {
"taskId": "5c79****be8e"
}
}
服务器异常
Callbacks
- POST audioLyricsGenerated
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": ""
}
]
}
}
- application/json
Body
codeinteger
状态码
Example:
200
msgstring
返回消息
Example:
All generated successfully
data object
Callbacks Responses
- 200
回调接收成功
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 泄露,请立即在管理页面重置
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
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());
ResponseClear