# 混音生成

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/v1/generate/mashup:
    post:
      summary: 混音生成
      deprecated: false
      description: >
        使用AI模型将两个音频文件混合生成新的混音作品。


        ### 模型版本


        - **当前模型**：`V6`（默认）、`V6_WILD`、`V6_MINI`

        - **已废弃模型**：`V5_5`、`V5`、`V4_5PLUS`、`V4_5ALL`、`V4_5`、`V4`

        - 废弃值仅为向后兼容保留，新接入请使用 V6 系列模型。


        ### 使用指南

        - 本接口固定为自定义模式，简单模式不可用。

        - 此接口从 2 个上传的音频文件创建混音音乐（上游只取前 2 个）

        - 将多个轨道的元素组合成一个连贯的新作品


        ### 参数详情

        - **必填**：`uploadUrlList`、`model`、`callBackUrl`

        - `uploadUrlList` 必须包含 2 个音频文件 URL

        -
        **model**（string，必填）：`V6`、`V6_WILD`、`V6_MINI`。已废弃：`V4`、`V4_5`、`V4_5PLUS`、`V4_5ALL`、`V5`、`V5_5`。

        - `prompt` 按歌词语义使用。可选。若同时传入 `lyrics`，优先使用 `lyrics`，`prompt` 不再作为歌词。

        - 字符限制：
          - **V4、V4_5、V4_5PLUS、V4_5ALL、V5 和 V5_5（已废弃）**：`prompt` 3000–5000字符、`style` 200–1000字符，按旧模型规则执行。
          - **V6、V6_WILD 和 V6_MINI**：`lyrics`/`prompt` 5000字符，`style` 1000字符，`title` 80字符

        ### 可选参数


        :::note[]

        以下字段为可选控制项：


        - <b>lyrics</b>（string）：歌词内容。可选。V6 系列最多 5000 字符。优先于 `prompt` 作为歌词。

        - <b>prompt</b>（string）：歌词内容。可选。未传入 `lyrics` 时作为歌词使用。V6 系列最多 5000 字符。

        - <b>style</b>（string）：音乐风格。可选。V6 系列最多 1000 字符。

        - <b>title</b>（string）：曲目标题。可选。最多 80 字符。

        - <b>vocalGender</b>（string）：偏好人声性别。允许值：`m`（男）、`f`（女）

        - <b>styleWeight</b>（number）：风格贴合权重，范围 0–1（建议保留两位小数）

        - <b>weirdnessConstraint</b>（number）：创造性/新颖度约束，范围 0–1（建议保留两位小数）

        - <b>audioWeight</b>（number）：音频一致性相对权重，范围 0–1（建议保留两位小数）

        - <b>variety</b>（number）：生成结果的多样性。范围 0–4 的整数，默认 1。`0` 关闭，`1` 普通（默认），`2`
        高，`3` 额外，`4` 最大。

        - <b>duration</b>（number）：音频时长（秒）。范围 10–360。对
        `V5_5`、`V6`、`V6_WILD`、`V6_MINI` 有效。

        - <b>personaId</b>（string）：Persona ID 或 Suno Voice 生成的 `voiceId`。如果使用
        Voice 生成的 ID，`personaModel` 必须设置为 `voice_persona`。

        - <b>personaModel</b>（string）：Persona 类型。生成 Persona 接口返回的 ID 使用
        `style_persona`，Suno Voice 生成的 ID 使用 `voice_persona`。默认 `style_persona`。

        :::


        **请求示例**


        **请求示例**


        ```json

        {
          "uploadUrlList": [
            "https://example.com/audio1.mp3",
            "https://example.com/audio2.mp3"
          ],
          "lyrics": "[Verse] 夜晚城市 灯火辉煌",
          "style": "电子舞曲",
          "title": "混音作品",
          "variety": 1,
          "model": "V6",
          "callBackUrl": "https://example.com/callback",
          "vocalGender": "m",
          "styleWeight": 0.65,
          "weirdnessConstraint": 0.72,
          "audioWeight": 0.65
        }

        ```


        ### 开发者注意事项

        - 生成的文件将保留14天

        - 回调过程分三个阶段：`text`（文本生成）、`first`（第一首完成）、`complete`（全部完成）

        - `uploadUrlList` 中的两个音频文件必须是有效且可访问的URL

        - 音频文件应为支持的格式（MP3、WAV等）
      operationId: generate-mashup
      tags:
        - docs/zh-CN/Suno API/Generate Music
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - uploadUrlList
                - callBackUrl
                - model
              properties:
                uploadUrlList:
                  type: array
                  description: 用于混音的音频文件 URL 数组。必填。传入 2 个音频 URL（上游只取前 2 个）。每个 URL 必须公网可访问。
                  items:
                    type: string
                    format: uri
                  minItems: 2
                  maxItems: 2
                  examples:
                    - - https://example.com/audio1.mp3
                      - https://example.com/audio2.mp3
                prompt:
                  type: string
                  description: >-
                    歌词内容。可选。未传入 `lyrics` 时作为歌词使用；若同时传入 `lyrics`，优先使用
                    `lyrics`，本字段不再作为歌词。

                    - **V4（已废弃）**：最多 3000 字符

                    - **V4_5、V4_5PLUS、V4_5ALL、V5、V5_5（已废弃）**：最多 5000 字符

                    - **V6、V6_WILD、V6_MINI**：最多 5000 字符
                  examples:
                    - '[Verse] 夜晚城市 灯火辉煌'
                lyrics:
                  type: string
                  description: >-
                    歌词内容。可选。V6、V6_MINI、V6_WILD 最多 5000 字符。优先于 `prompt`
                    作为歌词；未传入时使用 `prompt` 作为歌词。
                  examples:
                    - '[Verse] 夜晚城市 灯火辉煌'
                style:
                  type: string
                  description: |-
                    音乐风格，例如爵士、古典、电子等。可选。V6、V6_WILD、V6_MINI 最多 1000 字符。
                    - **V4（已废弃）**：最多 200 字符
                    - **V4_5、V4_5PLUS、V4_5ALL、V5、V5_5（已废弃）**：最多 1000 字符
                  examples:
                    - 爵士
                title:
                  type: string
                  description: 音乐标题。可选。最多 80 字符。
                  maxLength: 80
                  examples:
                    - 宁静钢琴
                model:
                  type: string
                  description: >-
                    AI 模型版本。默认值：`V6`。

                    - **`V6`**：当前标准模型，推荐默认使用。

                    - **`V6_WILD`**：当前实验性、创造性更强的模型。

                    - **`V6_MINI`**：当前轻量模型。

                    -
                    **已废弃**：`V5_5`、`V5`、`V4_5PLUS`、`V4_5ALL`、`V4_5`、`V4`。这些值仅为向后兼容保留，新接入请使用
                    V6 系列模型。
                  enum:
                    - V6
                    - V6_WILD
                    - V6_MINI
                    - V5_5
                    - V5
                    - V4_5PLUS
                    - V4_5ALL
                    - V4_5
                    - V4
                  default: V6
                  examples:
                    - V6
                callBackUrl:
                  type: string
                  format: uri
                  description: >-
                    接收音乐生成任务完成更新的URL。所有音乐生成请求都需要。


                    - 系统将在生成完成时向此URL发送POST任务状态和结果

                    - 回调过程有三个阶段：`text`（文本生成）、`first`（第一首完成）、`complete`（全部完成）

                    - 注意：某些情况可能会跳过 `text` 和 `first` 阶段，直接返回 `complete`

                    - 您的回调端点应接受包含任务结果和音频URL的JSON负载的POST请求

                    - 详细的回调格式和实现指南，请参见
                    [音乐生成回调](https://docs.kie.ai/suno-api/generate-music-callbacks)

                    - 或者，使用获取音乐详情接口来轮询任务状态
                  examples:
                    - https://example.com/callback
                vocalGender:
                  type: string
                  description: >-
                    演唱声音的人声性别偏好。可选。`m` 表示男声，`f`
                    表示女声。根据实践，此参数只能增加概率，但不能保证遵循男/女声指令。
                  enum:
                    - m
                    - f
                  examples:
                    - m
                styleWeight:
                  type: number
                  description: 风格贴合权重。可选。范围 0–1，建议保留两位小数。
                  minimum: 0
                  maximum: 1
                  multipleOf: 0.01
                  examples:
                    - 0.65
                weirdnessConstraint:
                  type: number
                  description: 创造性/新颖度约束。可选。范围 0–1，建议保留两位小数。
                  minimum: 0
                  maximum: 1
                  multipleOf: 0.01
                  examples:
                    - 0.65
                audioWeight:
                  type: number
                  description: 音频一致性与其他控制项的相对权重。可选。范围 0–1，建议保留两位小数。
                  minimum: 0
                  maximum: 1
                  multipleOf: 0.01
                  examples:
                    - 0.65
                variety:
                  type: number
                  description: >-
                    控制生成结果的多样性和风格差异程度。可选。范围 0–4 的整数，默认值为 1。


                    - **`0`**：off（exact style），完全关闭，严格用同一风格

                    - **`1`**：normal（balanced variety），默认值，在稳定性和多样性之间保持平衡

                    - **`2`**：high（distinct styles），生成风格差异明显的结果

                    - **`3`**：extra（bold exploration），提供更高程度的变化，鼓励大胆探索不同风格

                    - **`4`**：max（unreasonably
                    varied），最大程度增加多样性，生成结果可能具有非常明显的风格差异
                  minimum: 0
                  maximum: 4
                  multipleOf: 1
                  default: 1
                  examples:
                    - 1
                personaId:
                  type: string
                  description: >-
                    应用到生成音乐的 Persona ID 或 Voice ID。可选。若使用 Voice 生成的 ID，需将
                    `personaModel` 设为 `voice_persona`。
                  examples:
                    - persona_123
                personaModel:
                  type: string
                  description: >-
                    Persona 模型类型。可选。`style_persona`（默认）用于生成 Persona 接口返回的
                    ID；`voice_persona` 用于 Suno Voice 生成的 `voiceId`。默认
                    `style_persona`。
                  enum:
                    - style_persona
                    - voice_persona
                  default: style_persona
                  examples:
                    - style_persona
                duration:
                  type: integer
                  description: >-
                    时长（秒）。可选。范围 10–360。仅当 `model` 为 `V5_5`（已废弃）、`V6`、`V6_WILD` 或
                    `V6_MINI` 时有效。
                  minimum: 10
                  maximum: 360
                  examples:
                    - 20
              x-apidog-orders:
                - uploadUrlList
                - prompt
                - lyrics
                - style
                - title
                - model
                - callBackUrl
                - vocalGender
                - styleWeight
                - weirdnessConstraint
                - audioWeight
                - variety
                - personaId
                - personaModel
                - duration
      responses:
        '200':
          description: 请求成功
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      code:
                        type: integer
                        enum:
                          - 200
                          - 401
                          - 402
                          - 404
                          - 409
                          - 422
                          - 429
                          - 451
                          - 455
                          - 500
                        description: |-
                          响应状态码

                          - **200**: 成功 - 请求已成功处理
                          - **401**: 未授权 - 身份验证凭据缺失或无效
                          - **402**: 积分不足 - 账户没有足够的积分执行此操作
                          - **404**: 未找到 - 请求的资源或端点不存在
                          - **409**: 冲突 - WAV 记录已存在
                          - **422**: 验证错误 - 请求参数未通过验证检查
                          - **429**: 超出限制 - 已超过对此资源的请求限制
                          - **451**: 未授权 - 获取图像失败。请验证您或您的服务提供商设置的任何访问限制。
                          - **455**: 服务不可用 - 系统当前正在进行维护
                          - **500**: 服务器错误 - 处理请求时发生意外错误
                      msg:
                        type: string
                        description: 当 code != 200 时的错误信息
                        examples:
                          - success
                    x-apidog-orders:
                      - code
                      - msg
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          taskId:
                            type: string
                            description: 任务ID，用于跟踪任务状态。使用此ID与"获取音乐详情"接口查询任务详情和结果。
                            examples:
                              - 5c79****be8e
                        x-apidog-orders:
                          - taskId
                    x-apidog-orders:
                      - data
          headers: {}
          x-apidog-name: 成功
        '500':
          description: 服务器异常
          headers: {}
          x-apidog-name: 服务器错误
      security: []
      callbacks:
        audioGenerated:
          '{request.body#/callBackUrl}':
            post:
              description: |-
                当音频生成完成时，系统会调用此回调通知结果。

                ### 回调示例
                ```json
                {
                  "code": 200,
                  "msg": "All generated successfully.",
                  "data": {
                    "callbackType": "complete",
                    "task_id": "2fac****9f72",
                    "data": [
                      {
                        "id": "e231****-****-****-****-****8cadc7dc",
                        "audio_url": "https://example.cn/****.mp3",
                        "stream_audio_url": "https://example.cn/****",
                        "image_url": "https://example.cn/****.jpeg",
                        "prompt": "[Verse] 夜晚城市 灯火辉煌",
                        "model_name": "chirp-v3-5",
                        "title": "钢铁侠",
                        "tags": "electrifying, rock",
                        "createTime": "2025-01-01 00:00:00",
                        "duration": 198.44
                      },
                      {
                        "id": "bd15****1873",
                        "audio_url": "https://example.cn/****.mp3",
                        "stream_audio_url": "https://example.cn/****",
                        "image_url": "https://example.cn/****.jpeg",
                        "prompt": "[Verse] 夜晚城市 灯火辉煌",
                        "model_name": "chirp-v3-5",
                        "title": "钢铁侠",
                        "tags": "electrifying, rock",
                        "createTime": "2025-01-01 00:00:00",
                        "duration": 228.28
                      }
                    ]
                  }
                }
                ```
              requestBody:
                content:
                  application/json:
                    schema:
                      type: object
                      properties:
                        code:
                          type: integer
                          description: 状态码
                          example: 200
                        msg:
                          type: string
                          description: 返回消息
                          example: All generated successfully
                        data:
                          type: object
                          properties:
                            callbackType:
                              type: string
                              description: >-
                                回调类型：text（文本生成完成）、first（第一首生成完成）、complete（全部生成完成）
                              enum:
                                - text
                                - first
                                - complete
                            task_id:
                              type: string
                              description: 任务ID
                            data:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    description: 音频唯一标识
                                  audio_url:
                                    type: string
                                    description: 音频文件URL
                                  stream_audio_url:
                                    type: string
                                    description: 流式音频URL
                                  image_url:
                                    type: string
                                    description: 封面图片URL
                                  prompt:
                                    type: string
                                    description: 生成提示词/歌词
                                  model_name:
                                    type: string
                                    description: 使用的模型名称
                                  title:
                                    type: string
                                    description: 音乐标题
                                  tags:
                                    type: string
                                    description: 音乐标签
                                  createTime:
                                    type: string
                                    description: 创建时间
                                    format: date-time
                                  duration:
                                    type: number
                                    description: 音频时长（秒）
              responses:
                '200':
                  description: 回调接收成功
                  content:
                    application/json:
                      schema:
                        allOf:
                          - type: object
                            properties:
                              code:
                                type: integer
                                enum:
                                  - 200
                                  - 400
                                  - 408
                                  - 413
                                  - 500
                                  - 501
                                  - 531
                                description: |-
                                  响应状态码

                                  - **200**: 成功 - 请求已成功处理
                                  - **400**: 验证错误 - 歌词包含受版权保护的内容。
                                  - **408**: 超出限制 - 超时。
                                  - **413**: 冲突 - 上传的音频与现有艺术作品匹配。
                                  - **500**: 服务器错误 - 处理请求时发生意外错误
                                  - **501**: 音频生成失败。
                                  - **531**: 服务器错误 - 抱歉，由于问题导致生成失败。您的积分已退还。请重试。
                              msg:
                                type: string
                                description: 当 code != 200 时的错误信息
                                example: success
                      example:
                        code: 200
                        msg: success
      x-apidog-folder: docs/zh-CN/Suno API/Generate Music
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1412907/apis/api-46842375-run
components:
  schemas: {}
  securitySchemes:
    BearerAuth:
      type: bearer
      scheme: bearer
      bearerFormat: API Key
      description: >-
        # 🔑 API Authentication


        All endpoints require authentication using Bearer Token.


        ## Get API Key


        1. Visit the [API Key Management Page](https://sunoapi.org/api-key) to
        obtain your API Key


        ## Usage


        Add to request headers:


        ```

        Authorization: Bearer YOUR_API_KEY

        ```


        > **⚠️ Note:**

        > - Keep your API Key secure and do not share it with others

        > - If you suspect your API Key has been compromised, reset it
        immediately from the management page
servers:
  - url: https://apibox.erweima.ai
    description: 正式环境
security: []

```
