> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 生成音效：创建任务

> 创建 Suno 任务：`model` 选择接口，参数放在 `input` 中，可选 `callBackUrl` 接收完成回调。成功后返回 `data.taskId`，任务在后台异步执行，用查询任务接口轮询结果。所有响应的 HTTP 状态码都是 200，以 `code` 判断结果。



## OpenAPI

````yaml /openapi/zh/suno-sounds.json post /api/v1/jobs/createTask
openapi: 3.1.0
info:
  description: 根据一句描述生成音效、环境声或循环素材，可设置无缝循环、速度（BPM）和调式；每次生成两段。
  title: Suno 生成音效
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Suno 生成音效
paths:
  /api/v1/jobs/createTask:
    post:
      tags:
        - Suno 生成音效
      summary: 创建任务
      description: >-
        创建 Suno 任务：`model` 选择接口，参数放在 `input` 中，可选 `callBackUrl` 接收完成回调。成功后返回
        `data.taskId`，任务在后台异步执行，用查询任务接口轮询结果。所有响应的 HTTP 状态码都是 200，以 `code` 判断结果。
      operationId: sunoCreateTask
      requestBody:
        content:
          application/json:
            examples:
              环境音效:
                description: 只传必填字段，一句描述生成音效。
                summary: 环境音效
                value:
                  model: ai-music-api/sounds
                  input:
                    prompt: 雨点落在铁皮屋顶上，远处传来雷声
                    model: V6
              循环鼓点:
                description: '`sound_loop: true` 生成无缝循环，指定 120 BPM 和 A 小调，完成后回调。'
                summary: 循环鼓点
                value:
                  model: ai-music-api/sounds
                  callBackUrl: https://your-domain.com/api/callback
                  input:
                    prompt: 带有轻柔军鼓和闭镲的 lo-fi 鼓点循环
                    model: V6
                    sound_loop: true
                    sound_tempo: 120
                    sound_key: Am
                    grab_lyrics: false
              快速音效:
                description: '`V6_MINI` 速度更快，适合短促的界面或游戏音效。'
                summary: 快速音效
                value:
                  model: ai-music-api/sounds
                  input:
                    prompt: 科幻风格的自动门开启声
                    model: V6_MINI
            schema:
              $ref: '#/components/schemas/SunoCreateTaskRequestSunoSoundsInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                创建成功:
                  description: '`data.taskId` 为任务 ID。'
                  summary: 创建成功
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                参数错误（422）:
                  description: 参数不合法，不建任务、不扣费。
                  summary: 参数错误（422）
                  value:
                    code: 422
                    msg: input.sound_tempo must be between 1 and 300.
                    data: null
                未授权（401）:
                  description: API Key 缺失或无效。
                  summary: 未授权（401）
                  value:
                    code: 401
                    msg: >-
                      Unauthorized - Authentication credentials are missing or
                      invalid
                    data: null
                余额不足（402）:
                  description: 余额不足以支付本次任务。
                  summary: 余额不足（402）
                  value:
                    code: 402
                    msg: >-
                      Insufficient Credits - Account does not have enough
                      credits to perform the operation
                    data: null
                请求过于频繁（429）:
                  description: 超过频率限制，请稍后重试。
                  summary: 请求过于频繁（429）
                  value:
                    code: 429
                    msg: >-
                      Rate Limited - Request limit has been exceeded for this
                      resource
                    data: null
                服务器错误（500）:
                  description: 服务暂时不可用，可稍后重试，不扣费。
                  summary: 服务器错误（500）
                  value:
                    code: 500
                    msg: >-
                      Server Error - An unexpected error occurred while
                      processing the request
                    data: null
              schema:
                $ref: '#/components/schemas/SunoCreateTaskResponse'
          description: >-
            HTTP 状态码始终为 200。`code` 为 `200` 时创建成功，`data.taskId` 为任务 ID；其他 `code`
            为错误，`msg` 为原因，`data` 为 `null`。
          headers:
            X-Request-Id:
              description: 本次请求的 ID，排查问题时请提供。
              schema:
                type: string
components:
  schemas:
    SunoCreateTaskRequestSunoSoundsInput:
      additionalProperties: false
      description: 创建任务的请求体。
      properties:
        model:
          default: ai-music-api/sounds
          description: |-
            接口名称，决定 `input` 的字段。

            **可选值：**
            - `ai-music-api/sounds`：Suno 生成音效
          enum:
            - ai-music-api/sounds
          type: string
        callBackUrl:
          description: >-
            可选，任务完成（成功或失败）后接收回调的地址，须为公网可访问的 `http` / `https`
            地址；推荐生产环境使用，也可以只轮询查询任务接口。回调格式和签名见“任务完成回调”。
          type: string
        input:
          $ref: '#/components/schemas/SunoSoundsInput'
          description: 任务参数，字段由 `model` 决定。
      required:
        - model
        - input
      type: object
    SunoCreateTaskResponse:
      additionalProperties: false
      description: 创建任务的响应。HTTP 状态码始终为 200。
      properties:
        code:
          description: |-
            结果代码：
            - `200`：成功
            - `401`：API Key 缺失或无效
            - `402`：余额不足
            - `404`：模型不存在或未开通
            - `405`：请求方法错误
            - `422`：参数错误，`msg` 为原因，不建任务、不扣费
            - `429`：请求过于频繁，请稍后重试
            - `455`：服务维护中
            - `500`：服务器错误，可稍后重试
            - `501`：生成失败
            - `505`：功能已停用
          format: int64
          type: integer
        msg:
          description: 结果说明：成功时为 `success`，错误时为英文原因。
          type: string
        data:
          $ref: '#/components/schemas/SunoCreateTaskData'
          description: 成功时为任务信息；错误时为 `null`。
      required:
        - code
        - msg
        - data
      type: object
    SunoSoundsInput:
      additionalProperties: false
      description: '`ai-music-api/sounds` 的参数。`prompt`、`model` 必填。'
      properties:
        prompt:
          description: 必填，想要的声音描述，最多 500 个字符，如 `Gentle rain on a tin roof`。
          maxLength: 500
          type: string
        model:
          description: |-
            必填，Suno 模型版本：`V6`、`V6_MINI` 或 `V6_WILD`。已下线的 V4 ~ V5_5 不再支持。

            **可选值：**
            - `V6`：Suno V6：音乐表现力更强，人声更自然，细节更丰富
            - `V6_MINI`：Suno V6 Mini：轻量快速，兼顾质量与速度
            - `V6_WILD`：Suno V6 Wild：突破创作边界，表达更大胆、更有个性
          enum:
            - V6
            - V6_MINI
            - V6_WILD
          type: string
        sound_loop:
          default: false
          description: 可选，是否生成首尾无缝衔接的循环音频，默认 `false`。
          type: boolean
        sound_tempo:
          description: 可选，速度（BPM，每分钟拍数），`1` ~ `300` 的整数；不传时由模型自动决定。
          format: int64
          maximum: 300
          minimum: 1
          type: integer
        sound_key:
          default: Any
          description: |-
            可选，调式，默认 `Any`（自动）。小调以 `m` 结尾，升号写作 `#`。

            **可选值：**
            - `Any`：不指定调式，由模型自动决定（默认）。
            - `Cm`：C 小调。
            - `C#m`：C# 小调。
            - `Dm`：D 小调。
            - `D#m`：D# 小调。
            - `Em`：E 小调。
            - `Fm`：F 小调。
            - `F#m`：F# 小调。
            - `Gm`：G 小调。
            - `G#m`：G# 小调。
            - `Am`：A 小调。
            - `A#m`：A# 小调。
            - `Bm`：B 小调。
            - `C`：C 大调。
            - `C#`：C# 大调。
            - `D`：D 大调。
            - `D#`：D# 大调。
            - `E`：E 大调。
            - `F`：F 大调。
            - `F#`：F# 大调。
            - `G`：G 大调。
            - `G#`：G# 大调。
            - `A`：A 大调。
            - `A#`：A# 大调。
            - `B`：B 大调。
          enum:
            - Any
            - Cm
            - C#m
            - Dm
            - D#m
            - Em
            - Fm
            - F#m
            - Gm
            - G#m
            - Am
            - A#m
            - Bm
            - C
            - C#
            - D
            - D#
            - E
            - F
            - F#
            - G
            - G#
            - A
            - A#
            - B
          type: string
        grab_lyrics:
          default: false
          description: 可选，是否在完成后获取歌词字幕，默认 `false`。
          type: boolean
      required:
        - prompt
        - model
      type: object
    SunoCreateTaskData:
      additionalProperties: false
      description: 新建的任务。
      properties:
        taskId:
          description: 任务 ID（32 位十六进制），用于查询任务，也作为后续接口的 `task_id`。
          type: string
      required:
        - taskId
      type: object
  securitySchemes:
    bearerAuth:
      description: 'DreamTo 控制台创建的 API Key，格式 `Authorization: Bearer <API Key>`。'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.