生成歌词
- Suno 的歌词生成接口,异步任务
- 可选两种歌词模型:classic 与 remi
- 结果可直接回填给「生成音乐」
认证
All endpoints authenticate with a Bearer token.
Get an API key: open the console and create one.
Add it to the request header:
Authorization: Bearer YOUR_OAIRoute_KEY请求参数
音频模型,默认 suno。当前只有这一个取值。
描述想生成什么样的歌词。去掉首尾空白后不能为空。
歌词模型,取值 classic 或 remi。不传则使用服务端默认设置。
本端点没有版本维度。传 version 会被丢弃,也不影响计费。
The audio model; defaults to suno. It's currently the only value.
Describes what kind of lyrics to generate. Can't be empty after trimming.
The lyrics model: classic or remi. When omitted, the server default applies.
This endpoint has no version dimension. Passing version is discarded and doesn't affect billing.
提交响应
响应状态码,成功为 200。
提交成功时固定为 submitted。
任务唯一标识,用于轮询 GET /v1/music/tasks/{task_id}。
The response status code; 200 on success.
Fixed at submitted on successful submission.
The unique task identifier, used to poll GET /v1/music/tasks/{task_id}.
查询结果
歌词数组,首选的读取结构。
歌词正文。
歌词标题。
歌词标签。
兼容字段。result.lyrics 缺失时读这里。
返回结构有历史版本差异。稳妥的读法是:先看 result.lyrics 是否为数组,不是再看 result.text,都没有才判定为失败。直接把 result.lyrics 当字符串用,在老数据上会拿到空值。
The lyrics array; the preferred structure to read.
The lyrics body.
The lyrics title.
The lyrics tags.
A compatibility field. Read this when result.lyrics is missing.
The response structure has changed across versions. The safe read is: first check whether result.lyrics is an array; if not, check result.text; if neither exists, treat it as a failure. Treating result.lyrics directly as a string yields empty values on older data.
两个歌词模型的差别
| 模型 | 倾向 |
|---|---|
classic | 结构工整,主歌副歌分段清晰 |
remi | 用词更新颖,适合流行与说唱 |
不确定时先用 classic,它的产出更容易直接用于演唱。
| Model | Tendency |
|---|---|
classic | Tidy structure, clearly separated verses and choruses |
remi | Fresher wording; suits pop and rap |
When unsure, start with classic; its output is easier to sing as-is.
错误
| HTTP | type | 说明 |
|---|---|---|
| 400 | invalid_request_error | 请求参数无效,如 prompt 为空 |
| 401 | authentication_error | 身份验证失败,需检查 API 密钥 |
| 402 | payment_required | 账户余额不足 |
| 429 | rate_limit_error | 请求过于频繁 |
| HTTP | type | Notes |
|---|---|---|
| 400 | invalid_request_error | Invalid request parameters, e.g. empty prompt |
| 401 | authentication_error | Authentication failed; check the API key |
| 402 | payment_required | Insufficient account balance |
| 429 | rate_limit_error | Too many requests |
For more status codes and retry guidance see Error codes and rate limits; for troubleshooting steps on common errors see the FAQ.
使用示例
提交一个任务并拿到 task_id:
提交成功只表示任务已受理。真正的产物要拿返回的 task_id 去任务查询接口轮询,status 变成 completed 之后才有结果。
Submit a task and get a task_id:
A successful submission only means the task was accepted. To get the actual output, poll the task query endpoint with the returned task_id; results appear only after status becomes completed.