> ## 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.

# 生成 Persona：创建任务

> 同步接口：`model` 选择接口，参数放在 `input` 中，结果直接在响应的 `data` 中返回，无需轮询。所有响应的 HTTP 状态码都是 200，以 `code` 判断结果。



## OpenAPI

````yaml /openapi/zh/suno-persona.json post /api/v1/jobs/createTask
openapi: 3.1.0
info:
  description: 基于已生成歌曲中的一首音频创建 Persona（音乐角色），之后生成音乐时传入 `persona_id` 即可沿用它的风格。
  title: Suno 生成 Persona
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Suno 生成 Persona
paths:
  /api/v1/jobs/createTask:
    post:
      tags:
        - Suno 生成 Persona
      summary: 创建任务
      description: >-
        同步接口：`model` 选择接口，参数放在 `input` 中，结果直接在响应的 `data` 中返回，无需轮询。所有响应的 HTTP
        状态码都是 200，以 `code` 判断结果。
      operationId: sunoCreateTask
      requestBody:
        content:
          application/json:
            examples:
              指定分析片段:
                description: 取音频前 30 秒分析，并补充风格标签。
                summary: 指定分析片段
                value:
                  model: ai-music-api/generate-persona
                  input:
                    task_id: c2a81e5f09d34b7e8f61a2d4c9b03e75
                    audio_id: f924248f-e765-48fd-9ea9-c64290225e4e
                    name: Electronic Pop Singer
                    description: >-
                      A modern electronic music style pop singer, skilled in
                      dynamic rhythms and synthesizer tones
                    vocal_start: 0
                    vocal_end: 30
                    style: Electronic Pop
              仅必填参数:
                description: 使用默认分析片段（0 ~ 30 秒）。
                summary: 仅必填参数
                value:
                  model: ai-music-api/generate-persona
                  input:
                    task_id: c2a81e5f09d34b7e8f61a2d4c9b03e75
                    audio_id: f924248f-e765-48fd-9ea9-c64290225e4e
                    name: Electronic Pop Singer
                    description: >-
                      A modern electronic music style pop singer, skilled in
                      dynamic rhythms and synthesizer tones
            schema:
              $ref: '#/components/schemas/SunoCreateTaskRequestSunoPersonaInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                创建成功:
                  description: 同步返回结果，`data` 即本次结果。
                  summary: 创建成功
                  value:
                    code: 200
                    data:
                      description: >-
                        A modern electronic music style pop singer, skilled in
                        dynamic rhythms and synthesizer tones
                      name: Electronic Pop Singer
                      persona_id: 6096c3d052013da4a31071479000ff16
                    msg: success
                参数错误（422）:
                  description: 参数不合法，不建任务、不扣费。
                  summary: 参数错误（422）
                  value:
                    code: 422
                    msg: >-
                      input.vocal_end - input.vocal_start must be between 10 and
                      30 seconds.
                    data: null
                源任务不可用（422）:
                  description: '`task_id` 不存在、不属于当前账号或不满足 `msg` 中的条件；不建任务、不扣费。'
                  summary: 源任务不可用（422）
                  value:
                    code: 422
                    msg: >-
                      input.task_id must be a succeeded task of this account
                      created in the last 14 days.
                    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/SunoSyncCreateResponse'
          description: >-
            HTTP 状态码始终为 200。`code` 为 `200` 时创建成功，`data.taskId` 为任务 ID；其他 `code`
            为错误，`msg` 为原因，`data` 为 `null`。
          headers:
            X-Request-Id:
              description: 本次请求的 ID，排查问题时请提供。
              schema:
                type: string
components:
  schemas:
    SunoCreateTaskRequestSunoPersonaInput:
      additionalProperties: false
      description: 创建任务的请求体。
      properties:
        model:
          default: ai-music-api/generate-persona
          description: |-
            接口名称，决定 `input` 的字段。

            **可选值：**
            - `ai-music-api/generate-persona`：Suno 生成 Persona
          enum:
            - ai-music-api/generate-persona
          type: string
        callBackUrl:
          description: >-
            可选，任务完成（成功或失败）后接收回调的地址，须为公网可访问的 `http` / `https`
            地址；推荐生产环境使用，也可以只轮询查询任务接口。回调格式和签名见“任务完成回调”。
          type: string
        input:
          $ref: '#/components/schemas/SunoPersonaInput'
          description: 任务参数，字段由 `model` 决定。
      required:
        - model
        - input
      type: object
    SunoSyncCreateResponse:
      additionalProperties: false
      description: 同步接口创建任务的响应，`data` 即为结果。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/SunoPersonaResponseData'
          description: 成功时为本次结果；错误时为 `null`。
      required:
        - code
        - msg
        - data
      type: object
    SunoPersonaInput:
      additionalProperties: false
      description: '`ai-music-api/generate-persona` 的参数。'
      properties:
        task_id:
          description: >-
            必填，源任务 ID：本账号在 DreamTo 上 14 天内成功的 Suno 任务（createTask 返回的
            `data.taskId`）。任务不存在、不属于当前账号、未成功、超过 14 天或不是可用的源任务类型时返回 `code:
            422`，不建任务、不扣费。须为已完成的生成音乐类任务（生成、续写、上传翻唱 / 续写、加人声、加伴奏、替换片段、混搭）。
          type: string
        audio_id:
          description: >-
            必填，源任务中一首音频的 ID，即查询结果 `response.data[].id`。每个音频只能生成一个
            Persona，重复调用返回同一个 `persona_id`。
          type: string
        name:
          description: 必填，Persona 名称，一个能概括其音乐风格或角色特点、便于识别的名字。
          type: string
        description:
          description: 必填，Persona 的音乐特点、风格与个性描述，建议具体写出流派、情绪、配器和人声特点。
          type: string
        vocal_start:
          default: 0
          description: >-
            可选，用于 Persona 分析的音频片段起点（秒），不小于 `0`，默认 `0`。须小于 `vocal_end`，且
            `vocal_end - vocal_start` 在 `10` ~ `30` 秒之间（未传的一端按默认值计算）。
          format: double
          minimum: 0
          type: number
        vocal_end:
          default: 30
          description: >-
            可选，用于 Persona 分析的音频片段终点（秒），不小于 `0`，最多 2 位小数，默认 `30`。与 `vocal_start`
            一起确定分析范围，`vocal_end - vocal_start` 须在 `10` ~ `30` 秒之间。
          format: double
          minimum: 0
          multipleOf: 0.01
          type: number
        style:
          description: 可选，补充 Persona 对应的音乐风格标签，如 `Electronic Pop`、`Jazz Trio`。
          type: string
      required:
        - task_id
        - audio_id
        - name
        - description
      type: object
    SunoPersonaResponseData:
      additionalProperties: false
      description: 生成的 Persona。
      properties:
        persona_id:
          description: >-
            Persona ID。在生成音乐、续写音乐、上传并翻唱、上传并续写的 `input.persona_id`
            中原样传入（`persona_model` 为 `style_persona`），即可生成风格特征相近的音乐。
          type: string
        name:
          description: Persona 名称，即请求中的 `name`。
          type: string
        description:
          description: Persona 描述，即请求中的 `description`。
          type: string
      required:
        - persona_id
        - name
        - description
      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.