# Lyria 3.5 Cover 改编
> 用 Lyria 3.5 做 Cover 改编，异步任务
> 与普通 Cover 共用端点，靠 `version` 区分
> 产出新的 clip_id
`POST /v1/music/generations/coverFlowMusic`
## 认证
- `Authorization` (string / 必填) — 所有接口均使用 Bearer Token 进行认证。 获取 API Key：[访问控制台](https://api.oairoute.com/keys) 创建。 请求时在请求头中添加： ```http Authorization: Bearer YOUR_OAIRoute_KEY ```
## 请求参数
- `model` (string / 必填) — 固定传 `flowmusic`，大小写不敏感。 **不要写成 `lyria-3.5` 或 `flowmusic-lyria-3.5`**——模型名只有一个，版本走 `version` 字段。
- `version` (string / 必填) — 固定传 `lyria-3.5`。这是本接口与普通 Cover 的唯一区别。
- `clip_id` (string / 必填) — 源音乐唯一标识，取自已成功任务的 `result.music[].clip_id`。
- `instruction` (string / 必填) — Cover 编辑指令，例如「将这首歌曲改为爵士风格」。
- `strength` (number / 必填) — 编辑强度，取值 0 到 1。越大改动越大。
- `title` (string / 可选) — Cover 后的音乐标题。
- `seed` (string / 可选) — 随机种子，用于结果复现。
## 最容易踩的一个坑
`model` 与 `version` 是两个字段，职责不同：
| 字段 | 传什么 | 传错的后果 |
|---|---|---|
| `model` | `flowmusic` | 写成 `lyria-3.5` 会找不到模型 |
| `version` | `lyria-3.5` | 不传就走普通模型，不报错但结果不同 |
第二行是隐性的：漏传 `version` 不会报错，只是走的不是 Lyria。产出结果对不对，只有对比才知道。
## 提交响应
- `code` (integer) — 状态码，成功为 200。
- `data[].status` (string) — 任务状态，提交时为 `submitted`。
- `data[].task_id` (string) — 任务唯一标识，用于查询状态与结果。
## 查询结果
用 `GET /v1/music/tasks/{task_id}` 查询。
- `data.id` (string) — 任务 ID。
- `data.status` (string) — 如 `completed`。
- `data.progress` (integer) — 进度百分比。
- `data.created` (integer) — 创建时间，Unix 时间戳。
- `data.completed` (integer) — 完成时间，Unix 时间戳。
- `data.actual_time` (integer) — 耗时，单位秒。
- `data.cost` (number) — 费用。
- `data.credits_cost` (number) — 积分消耗。
- `result.music[].clip_id` (string) — Cover 产物对应的**新** clip_id。后续操作请使用新值。
- `result.music[].title` (string) — 标题。
- `result.music[].duration_seconds` (string) — 时长，字符串形式。
- `result.music[].audio_url` (string) — 音频地址，m4a。
- `result.music[].wav_url` (string) — WAV 格式地址。
- `result.music[].image_url` (string) — 封面图地址。
## 错误
| HTTP | code | 说明 |
|---|---|---|
| 400 | `invalid_request` | strength 越界，如 `strength must be between 0 and 1` |
| 429 | `rate_limit_error` | 当前分组容量饱和，请稍后重试 |
更多状态码与重试建议见[错误码与限流](../../../support/errors.html)，常见报错的排查步骤见[常见问题](../../../support/faq.html)。
## 使用示例
提交一个任务并拿到 `task_id`：
> **Note:** 
> 提交成功只表示任务已受理。真正的产物要拿返回的 `task_id` 去任务查询接口轮询，`status` 变成 `completed` 之后才有结果。
**Lyria 3.5 Cover 改编{Lyria 3.5 cover remix}::cURL**
```
curl -X POST https://api.oairoute.com/v1/music/generations/coverFlowMusic \
  -H 'Authorization: Bearer YOUR_OAIRoute_KEY' \
  -H 'Content-Type: application/json' \
  --data '{
    "model": "flowmusic",
    "version": "lyria-3.5",
    "clip_id": "c_01KA",
    "instruction": "改为爵士风格，钢琴贝斯鼓",
    "strength": 0.55
  }'
```
**Lyria 3.5 Cover 改编{Lyria 3.5 cover remix}::Python**
```
import requests
res = requests.post(
    "https://api.oairoute.com/v1/music/generations/coverFlowMusic",
    headers={
        "Authorization": "Bearer YOUR_OAIRoute_KEY",
        "Content-Type": "application/json",
    },
    json={
        "model": "flowmusic",
        "version": "lyria-3.5",
        "clip_id": "c_01KA",
        "instruction": "改为爵士风格，钢琴贝斯鼓",
        "strength": 0.55,
    },
)
print(res.json()["data"][0]["task_id"])
```
**Lyria 3.5 Cover 改编{Lyria 3.5 cover remix}::JavaScript**
```
const url = "https://api.oairoute.com/v1/music/generations/coverFlowMusic";
const options = {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_OAIRoute_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "flowmusic",
    "version": "lyria-3.5",
    "clip_id": "c_01KA",
    "instruction": "改为爵士风格，钢琴贝斯鼓",
    "strength": 0.55
  }),
};
fetch(url, options)
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch((err) => console.error(err));
```
**200 Lyria 3.5 Cover 改编{Lyria 3.5 cover remix}**
```
{
  "code": 200,
  "data": [
    { "status": "submitted", "task_id": "task_01K8F44M0HP1GJWBJYZMKX1XS1" }
  ]
}
```
