# MIDI 下载

**这是什么**：下载乐器的 MIDI 文件（需先用「获取乐器音轨」gen_stem_all 拿到对应 clipId）。

**什么时候用**：想把 AI 编曲拿进 DAW 里编辑旋律 / 重新编曲时用。⚠ clipId 必须是「本账号」gen_stem_all 的结果，否则报 same_account_required。

## 接口地址
- POST `/api/cqt/generator/suno` (task: `mdi`)
- GET `/api/cqt/info/suno?id={taskId}`

## 请求参数
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| task | string | 是 | 固定填 mdi |
| clipId | string | 是 | 必须是本账号 gen_stem_all 返回的 clipId |

## 请求示例
```bash
curl -X POST https://api.novapi.ai/api/cqt/generator/suno \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{ "task":"mdi", "clipId":"clip_stem_xyz" }'
# -> { "code":200, "data":"<taskId>" }
```

## 响应示例
```json
{
  "code": 500,
  "msg": "same_account_required",
  "data": {
    "id": "f28f534a07994c199e5b0cee8e74dcbe",
    "taskType": "mdi",
    "status": "failed",
    "errorMsg": "same_account_required",
    "param": {
      "task": "mdi",
      "clipId": "217c547a-3aee-48db-9490-e4182566fe91"
    },
    "result": "任务失败",
    "createTime": "2026-07-09 14:13:36",
    "completeTime": "2026-07-09 14:13:45"
  }
}
```

## 响应字段说明
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| code | number | 状态码，200 成功；失败为非 200（如 500） |
| msg | string | 顶层消息；失败时通常等于 errorMsg |
| data.id | string | 任务 ID |
| data.taskType | string | 任务类型，恒为 mdi |
| data.status | string | 任务状态：succeeded 成功 / failed 失败 |
| data.errorMsg | string | 失败原因。same_account_required = clipId 不是本账号的 gen_stem_all 结果 |
| data.param | object | 原样回显你提交的请求参数 |
| data.result | string \| object | 失败时为字符串 "任务失败"；成功时为 MIDI 结果（成功样例待补） |
| data.createTime / completeTime | string | 任务提交时间 / 完成时间 |

## OpenAI 协议写法
同一个 task 也可用 `POST /v1/audio/generations` 调用（body 加 `task: "mdi"`，model 写成 suno-v6 形式），用 `GET /v1/audio/generations/{id}` 轮询，非音频类结果在 `result` 字段。

```bash
curl -X POST https://api.novapi.ai/v1/audio/generations \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "suno",
  "task": "mdi",
  "clipId": "clip_stem_xyz"
}'
# -> { "id":"audio_<taskId>", "object":"audio.generation", "status":"queued", ... }
# poll: GET https://api.novapi.ai/v1/audio/generations/audio_<taskId>
```
