> ## 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-upload-extend.json post /api/v1/jobs/createTask
openapi: 3.1.0
info:
  description: 上传一段自己的音频，保持原有风格从指定时间点继续往下写，生成更长、衔接自然的完整歌曲；每次生成两首。
  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: 从原曲第 20 秒开始续写，指定续写歌词、风格和歌名。
                summary: 续写上传的音频
                value:
                  model: ai-music-api/upload-and-extend-audio
                  input:
                    upload_url: https://your-domain.com/audio/morning-coffee.mp3
                    instrumental: false
                    lyrics: |-
                      [Verse]
                      杯中热气缓缓升起
                      [Chorus]
                      早安咖啡，唤醒我
                    style: 轻快原声民谣流行
                    title: 早安咖啡（续）
                    continue_at: 20
                    model: V6
              只传音频:
                description: 只给 `upload_url` 和 `model`，其余由模型沿用原曲风格自动续写。
                summary: 只传音频
                value:
                  model: ai-music-api/upload-and-extend-audio
                  input:
                    upload_url: https://your-domain.com/audio/demo.mp3
                    model: V6_MINI
              纯音乐续写:
                description: '`instrumental: true` 续写为无人声的纯音乐，指定排除风格与创意程度，完成后回调。'
                summary: 纯音乐续写
                value:
                  model: ai-music-api/upload-and-extend-audio
                  callBackUrl: https://your-domain.com/api/callback
                  input:
                    upload_url: https://your-domain.com/audio/piano.mp3
                    instrumental: true
                    style: Classical, solo piano
                    title: 宁静钢琴（续）
                    continue_at: 60
                    model: V6
                    negative_tags: drums
                    style_weight: 0.65
                    weirdness_constraint: 0.3
                    variety: 1
            schema:
              $ref: '#/components/schemas/SunoCreateTaskRequestSunoUploadExtendInput'
        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.lyrics is not supported when input.instrumental is
                      true.
                    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:
    SunoCreateTaskRequestSunoUploadExtendInput:
      additionalProperties: false
      description: 创建任务的请求体。
      properties:
        model:
          default: ai-music-api/upload-and-extend-audio
          description: |-
            接口名称，决定 `input` 的字段。

            **可选值：**
            - `ai-music-api/upload-and-extend-audio`：Suno 上传并续写音乐
          enum:
            - ai-music-api/upload-and-extend-audio
          type: string
        callBackUrl:
          description: >-
            可选，任务完成（成功或失败）后接收回调的地址，须为公网可访问的 `http` / `https`
            地址；推荐生产环境使用，也可以只轮询查询任务接口。回调格式和签名见“任务完成回调”。
          type: string
        input:
          $ref: '#/components/schemas/SunoUploadExtendInput'
          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
    SunoUploadExtendInput:
      additionalProperties: false
      description: >-
        `ai-music-api/upload-and-extend-audio` 的参数。`upload_url`、`model`
        必填，其他字段可选。
      properties:
        upload_url:
          description: 必填，待续写音频的地址，须为公网可直接下载的 `http` / `https` 地址，音频时长不超过 8 分钟。仅凭这段音频即可生成。
          type: string
        instrumental:
          default: false
          description: >-
            可选，默认 `false`，是否续写为纯音乐（无人声）。`true` 时不能传
            `lyrics`、`prompt`、`vocal_gender`；`false` 时以 `lyrics` 作为歌词（未传时使用
            `prompt`）。
          type: boolean
        prompt:
          description: >-
            可选，续写部分的歌词，仅在未传 `lyrics` 时使用，最多 5000 个字符。纯音乐（`instrumental:
            true`）时不能传。
          maxLength: 5000
          type: string
        lyrics:
          description: >-
            可选，续写部分的歌词，最多 5000 个字符，优先于 `prompt`。可用 `[Verse]`、`[Chorus]`
            等标记段落。纯音乐（`instrumental: true`）时不能传。
          maxLength: 5000
          type: string
        style:
          description: 可选，音乐风格，最多 1000 个字符，如 `Jazz`、`Classical`、`Electronic`。
          maxLength: 1000
          type: string
        title:
          description: 可选，歌名，最多 100 个字符，显示在播放器和文件名中。
          maxLength: 100
          type: string
        continue_at:
          description: 可选，从原曲第几秒开始续写，须大于 `0` 且小于上传音频的总时长。
          format: double
          type: number
        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
        negative_tags:
          description: 可选，要排除的音乐风格或特征，如 `Relaxing Piano`。
          type: string
        vocal_gender:
          description: |-
            可选，人声性别偏好。只提高对应性别出现的概率，不保证一定生效。纯音乐（`instrumental: true`）时不能传。

            **可选值：**
            - `m`：男声
            - `f`：女声
          enum:
            - m
            - f
          type: string
        style_weight:
          description: 可选，对 `style` 的遵循强度，`0` ~ `1`，最多 2 位小数。
          format: double
          maximum: 1
          minimum: 0
          multipleOf: 0.01
          type: number
        weirdness_constraint:
          description: 可选，创意 / 实验性偏离程度，`0` ~ `1`，最多 2 位小数；越大越大胆。
          format: double
          maximum: 1
          minimum: 0
          multipleOf: 0.01
          type: number
        audio_weight:
          description: 可选，音频特征的相对权重，`0` ~ `1`，最多 2 位小数。
          format: double
          maximum: 1
          minimum: 0
          multipleOf: 0.01
          type: number
        variety:
          default: 1
          description: >-
            可选，结果的多样性，`0` ~ `4` 的整数，默认 `1`：`0` 关闭（严格保持风格）、`1` 正常（兼顾稳定与多样）、`2`
            高（风格明显不同）、`3` 更高（大胆探索）、`4` 最大（差异可能非常大）。
          format: double
          maximum: 4
          minimum: 0
          multipleOf: 1
          type: number
        persona_id:
          description: >-
            可选，Persona ID 或 Voice ID，让生成的音乐沿用该 Persona 的风格或该自定义音色。Persona 由“生成
            Persona”接口创建，Voice 由“自定义音色”接口创建。`persona_model` 为 `voice_persona`
            时，须为本账户已就绪的音色（成功的“生成验证短语”任务的 `taskId`）。
          type: string
        persona_model:
          description: |-
            可选，`persona_id` 的类型。

            **可选值：**
            - `style_persona`：风格 Persona：沿用 Persona 的整体音乐风格
            - `voice_persona`：音色 Persona：沿用 Persona 或自定义音色的声音
          enum:
            - style_persona
            - voice_persona
          type: string
      required:
        - upload_url
        - 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.