# 生成音效

**这是什么**：生成一段音效（不是歌曲），比如雷声、脚步声。

**什么时候用**：做视频/游戏需要环境音、特效音时用。

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

## 请求参数
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| task | string | 是 | 固定填 sound |
| model | string | 是 | 模型版本（推荐 v6） |
| sound | object | 是 | 音效对象，含子字段 description / type / key / bpm（见下） |
| sound.description | string | 是 | 音效核心描述（也作标题） |
| sound.type | enum | — | one_shot（默认）/ loop |
| sound.key | enum | — | 调性（C / C maj / C min ...） |
| sound.bpm | number(1~300) | — | 节拍，省略=Auto |

## 请求示例
```bash
curl -X POST https://api.novapi.ai/api/cqt/generator/suno \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{ "task":"sound", "model":"v6", "sound":{ "description":"thunder rumbling in the distance" } }'
# -> { "code":200, "data":"<taskId>" }
```

## 响应示例
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "id": "044b298a1d1b45ccb9c51f0533b5dfcc",
    "taskType": "sound",
    "status": "succeeded",
    "errorMsg": "",
    "param": {
      "task": "sound",
      "model": "chirp-v55",
      "sound": { "description": "thunder rumbling in the distance" }
    },
    "result": [
      {
        "id": "955ebf61-7d6a-408f-b517-b8ebda50766f",
        "title": "thunder rumbling in the distance",
        "handle": "martibradyiymy6",
        "status": "complete",
        "user_id": "fc1ee2f4-5c7a-450d-aeb8-df8c5217c09d",
        "metadata": {
          "tags": "thunder rumbling in the distance",
          "task": "sound",
          "type": "gen",
          "prompt": "",
          "avg_bpm": 176.88,
          "max_bpm": 187.5,
          "min_bpm": 166.67,
          "duration": 7.24,
          "is_remix": false,
          "make_instrumental": true,
          "uses_latest_model": false
        },
        "audio_url": "https://cdn1.suno.ai/955ebf61-7d6a-408f-b517-b8ebda50766f.mp3",
        "image_url": "https://cdn2.suno.ai/image_955ebf61-7d6a-408f-b517-b8ebda50766f.jpeg",
        "image_large_url": "https://cdn2.suno.ai/image_large_955ebf61-7d6a-408f-b517-b8ebda50766f.jpeg",
        "video_url": "",
        "media_urls": [
          { "url": "https://d2lwuy8qc234o3.cloudfront.net/1/clip/955ebf61-7d6a-408f-b517-b8ebda50766f.m4a", "delivery": "progressive", "content_type": "m4a-opus" },
          { "url": "https://cdn1.suno.ai/955ebf61-7d6a-408f-b517-b8ebda50766f.mp3", "delivery": "progressive", "content_type": "mp3" }
        ],
        "model_name": "chirp-sfx",
        "batch_index": 0,
        "created_at": "2026-07-09T01:42:16.057Z",
        "major_model_version": ""
      },
      {
        "id": "9ddec625-86a3-4833-bb32-3d1723980375",
        "title": "thunder rumbling in the distance",
        "status": "complete",
        "metadata": {
          "tags": "thunder rumbling in the distance",
          "task": "sound",
          "type": "gen",
          "avg_bpm": 179.1,
          "duration": 9.16,
          "is_remix": false,
          "make_instrumental": true
        },
        "audio_url": "https://cdn1.suno.ai/9ddec625-86a3-4833-bb32-3d1723980375.mp3",
        "image_url": "https://cdn2.suno.ai/image_9ddec625-86a3-4833-bb32-3d1723980375.jpeg",
        "model_name": "chirp-sfx",
        "batch_index": 1,
        "major_model_version": ""
      }
    ],
    "createTime": "2026-07-09 09:42:11",
    "completeTime": "2026-07-09 09:42:47"
  }
}
```

## 响应字段说明
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| code | number | 状态码，200 表示成功 |
| msg | string | 提示信息 |
| data.id | string | 任务 ID（= 提交时拿到的 taskId） |
| data.taskType | string | 任务类型，恒为 sound |
| data.status | string | 任务状态：pending 处理中 / succeeded 成功 / failed 失败 |
| data.param | object | 原样回显你提交的请求参数 |
| data.result | array | 生成结果，一次返回 2 条候选音效 |
| data.result[].id | string | 音效片段的 clipId |
| data.result[].title | string | 标题（= 你的 sound.description） |
| data.result[].audio_url | string | 音效音频地址（mp3） |
| data.result[].image_url | string | 封面图地址（image_large_url 为大图） |
| data.result[].status | string | 片段状态，complete 表示可下载 |
| data.result[].metadata.task | string | 底层任务，恒为 sound |
| data.result[].metadata.tags | string | = 你的音效描述（回显） |
| data.result[].metadata.duration | number | 音效时长（秒，通常很短） |
| data.result[].metadata.make_instrumental | bool | 音效无人声，恒为 true |
| data.result[].metadata.is_remix | bool | 从零生成，恒为 false |
| data.result[].model_name | string | 音效专用引擎，恒为 chirp-sfx |
| data.result[].media_urls | array | 多格式音频地址（m4a-opus / mp3） |
| data.result[].batch_index | number | 候选序号（0、1） |
| data.createTime / completeTime | string | 任务提交时间 / 完成时间 |
| 其它字段 | — | 音效无 clip_roots（非二次创作）；major_model_version 为空；action_config / secondary_badges 等为 UI 展示，可忽略 |

## OpenAI 协议写法
同一个 task 也可用 `POST /v1/audio/generations` 调用（body 加 `task: "sound"`，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-v6",
  "task": "sound",
  "sound": {
    "description": "thunder rumbling in the distance"
  }
}'
# -> { "id":"audio_<taskId>", "object":"audio.generation", "status":"queued", ... }
# poll: GET https://api.novapi.ai/v1/audio/generations/audio_<taskId>
```
