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

# 创建任务

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



## OpenAPI

````yaml /openapi/zh/gemini-3-8-flash-tts.json post /api/v1/jobs/createTask
openapi: 3.1.0
info:
  description: Google 旗舰语音合成模型：单人或双人对白，逐句风格指导、语气标签与一次性声音克隆，输出 WAV。
  title: Gemini 3.8 Flash TTS
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Gemini 3.8 Flash TTS
paths:
  /api/v1/jobs/createTask:
    post:
      tags:
        - Gemini 3.8 Flash TTS
      summary: 创建任务
      description: >-
        创建语音合成任务：`model` 选择模型，说话人和台词放在 `input` 中，可选 `callBackUrl` 接收完成回调。成功后返回
        `data.taskId`，任务在后台异步执行，用查询任务接口轮询结果。所有响应的 HTTP 状态码都是 200，以 `code` 判断结果。
      operationId: geminiTTSCreateTask
      requestBody:
        content:
          application/json:
            examples:
              双人对白:
                description: 两个预置音色，逐句风格指导并插入语气标签，任务结束后回调。
                summary: 双人对白
                value:
                  model: gemini-3.8-flash-tts
                  callBackUrl: https://your-domain.com/api/callback
                  input:
                    temperature: 1
                    speakers:
                      - speaker_id: Speaker 1
                        voice_name: Fola
                      - speaker_id: Speaker 2
                        voice_name: Zephyr
                    dialogue_turns:
                      - speaker_id: Speaker 1
                        text: 大家好。<laugh> 这样就可以了。
                        style: 像疲惫的夜班电台主持人，语速慢、语气干。
                      - speaker_id: Speaker 2
                        text: 等等，你听到了吗？<gasp> 我觉得真的成功了。
                        style: 明亮又好奇，语速稍快。
              单人旁白:
                description: 一位说话人、一个预置音色朗读一段旁白。
                summary: 单人旁白
                value:
                  model: gemini-3.8-flash-tts
                  input:
                    speakers:
                      - speaker_id: Speaker 1
                        voice_name: Achird
                    dialogue_turns:
                      - speaker_id: Speaker 1
                        text: 很久很久以前，海边住着一位守灯塔的老人。<short pause> 每天傍晚，他都会点亮那盏灯。
                        style: 温暖、从容的有声书旁白。
              声音克隆:
                description: 说话人 1 用参考录音和同意录音临时克隆声音，说话人 2 用预置音色，并插入语气词。
                summary: 声音克隆
                value:
                  model: gemini-3.8-flash-tts
                  input:
                    speakers:
                      - speaker_id: Speaker 1
                        replica:
                          source_audio_url: https://your-cdn.example.com/voice/reference.wav
                          consent_audio_url: https://your-cdn.example.com/voice/consent.wav
                      - speaker_id: Speaker 2
                        voice_name: Puck
                    filler_words: true
                    dialogue_turns:
                      - speaker_id: Speaker 1
                        text: 欢迎回到我们的播客。今天聊点轻松的。
                      - speaker_id: Speaker 2
                        text: 好啊，我准备了几个有趣的问题。
            schema:
              $ref: '#/components/schemas/GeminiTTSCreateTaskRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                创建成功:
                  description: '`data.taskId` 为任务 ID。'
                  summary: 创建成功
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 5e2a9c7f13b84d06a8f1c3e5b7d9a2c4
                参数错误（422）:
                  description: 参数不合法，不建任务、不扣费。
                  summary: 参数错误（422）
                  value:
                    code: 422
                    msg: >-
                      input.dialogue_turns[0].speaker_id "Speaker 2" is not
                      declared in input.speakers.
                    data: null
                API Key 无效（401）:
                  description: API Key 缺失或无效。
                  summary: API Key 无效（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/GeminiTTSCreateTaskResponse'
          description: >-
            HTTP 状态码始终为 200。`code` 为 `200` 时创建成功，`data.taskId` 为任务 ID；其他 `code`
            为错误，`msg` 为原因，`data` 为 `null`。
          headers:
            X-Request-Id:
              description: 本次请求的 ID，排查问题时请提供。
              schema:
                type: string
components:
  schemas:
    GeminiTTSCreateTaskRequest:
      additionalProperties: false
      description: 创建任务的请求体。
      properties:
        model:
          default: gemini-3.8-flash-tts
          description: |-
            模型名称。

            **可选值：**
            - `gemini-3.8-flash-tts`：Gemini 3.8 Flash TTS：旗舰语音合成，表现力与保真度最高
          enum:
            - gemini-3.8-flash-tts
          type: string
        callBackUrl:
          description: >-
            可选，任务完成（成功或失败）后接收回调的地址，须为公网可访问的 `http` / `https`
            地址；推荐生产环境使用，也可以只轮询查询任务接口。回调格式和签名见“任务完成回调”。
          format: uri
          type: string
        input:
          $ref: '#/components/schemas/GeminiTTSInput'
          description: 生成参数。
      required:
        - model
        - input
      type: object
    GeminiTTSCreateTaskResponse:
      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/GeminiTTSCreateTaskData'
          description: 成功时为任务信息；错误时为 `null`。
      required:
        - code
        - msg
        - data
      type: object
    GeminiTTSInput:
      additionalProperties: false
      description: 语音合成参数。
      properties:
        temperature:
          default: 1
          description: 采样温度，`0` ~ `2`，默认 `1`。数值越高，演绎越多变；越低越稳定。
          format: double
          maximum: 2
          minimum: 0
          type: number
        speakers:
          description: >-
            必填，说话人列表，1 ~ 2 位。每位说话人用 `voice_name`（预置音色）或
            `replica`（声音克隆）二选一；都不传时使用 `Fola`。
          items:
            $ref: '#/components/schemas/GeminiTTSSpeaker'
          maxItems: 2
          minItems: 1
          type: array
        filler_words:
          default: false
          description: 是否在双人对白中插入语气词（如嗯、啊），默认 `false`。仅当 `speakers` 有两位说话人时生效。
          type: boolean
        dialogue_turns:
          description: 必填，台词列表，按顺序朗读，至少 1 句。
          items:
            $ref: '#/components/schemas/GeminiTTSDialogueTurn'
          minItems: 1
          type: array
      required:
        - speakers
        - dialogue_turns
      type: object
    GeminiTTSCreateTaskData:
      additionalProperties: false
      description: 新建的任务。
      properties:
        taskId:
          description: 任务 ID（32 位十六进制），用于查询任务。
          type: string
      required:
        - taskId
      type: object
    GeminiTTSSpeaker:
      additionalProperties: false
      description: 一位说话人。
      properties:
        speaker_id:
          description: >-
            必填，说话人标识，格式为 `Speaker N`（N 为正整数，如 `Speaker 1`、`Speaker
            2`），同一请求中不能重复；`dialogue_turns` 用它指定说话人。
          pattern: ^Speaker [1-9][0-9]*$
          type: string
        voice_name:
          default: Fola
          description: >-
            预置音色，区分大小写，默认 `Fola`。与 `replica` 互斥：同一说话人只能传其一；使用声音克隆时不要传本字段。70
            个音色按适用场景分组如下。


            **可选值（按适用场景）：**

            - 教学辅导：`Bodi`、`Lumi`、`Sadaltager`、`Sola`、`Sulafat`、`Varo`、`Zephyr`

            - 广告配音：`Koda`、`Kore`、`Nika`、`Tavi`、`Zeno`

            -
            讲解说明：`Algenib`、`Despina`、`Erinome`、`Kira`、`Ludo`、`Mako`、`Rasalgethi`、`Rina`

            - 播客：`Alnilam`、`Brio`、`Jori`、`Laomedeia`、`Rami`、`Veda`

            - 故事讲述：`Achird`、`Enzo`、`Riko`、`Sami`、`Zali`、`Zubenelgenubi`

            -
            数字助理：`Algieba`、`Aoede`、`Autonoe`、`Callirrhoe`、`Enceladus`、`Gero`、`Iapetus`、`Neno`、`Olin`、`Tari`、`Umbriel`

            - 呼叫中心：`Achernar`、`Charon`、`Daro`、`Fola`（默认）、`Hali`、`Milo`、`Puck`

            - 礼宾接待：`Arlo`、`Cleo`、`Fenrir`、`Finn`、`Leda`、`Lora`、`Orus`

            - 技术支持：`Enya`、`Jett`、`Knox`、`Nyla`、`Sadachbia`、`Vindemiatrix`

            - 专业商务：`Cruz`、`Elio`、`Gacrux`、`Pulcherrima`、`Schedar`、`Tova`、`Zuri`
          enum:
            - Bodi
            - Lumi
            - Sadaltager
            - Sola
            - Sulafat
            - Varo
            - Zephyr
            - Koda
            - Kore
            - Nika
            - Tavi
            - Zeno
            - Algenib
            - Despina
            - Erinome
            - Kira
            - Ludo
            - Mako
            - Rasalgethi
            - Rina
            - Alnilam
            - Brio
            - Jori
            - Laomedeia
            - Rami
            - Veda
            - Achird
            - Enzo
            - Riko
            - Sami
            - Zali
            - Zubenelgenubi
            - Algieba
            - Aoede
            - Autonoe
            - Callirrhoe
            - Enceladus
            - Gero
            - Iapetus
            - Neno
            - Olin
            - Tari
            - Umbriel
            - Achernar
            - Charon
            - Daro
            - Fola
            - Hali
            - Milo
            - Puck
            - Arlo
            - Cleo
            - Fenrir
            - Finn
            - Leda
            - Lora
            - Orus
            - Enya
            - Jett
            - Knox
            - Nyla
            - Sadachbia
            - Vindemiatrix
            - Cruz
            - Elio
            - Gacrux
            - Pulcherrima
            - Schedar
            - Tova
            - Zuri
          type: string
        replica:
          $ref: '#/components/schemas/GeminiTTSReplica'
          description: >-
            可选，声音克隆设置，与 `voice_name`
            互斥。设置后本次任务用两段录音临时克隆该说话人的声音，不会保存为可复用音色；单人和双人请求都可以使用。
      required:
        - speaker_id
      type: object
    GeminiTTSDialogueTurn:
      additionalProperties: false
      description: 一句台词。
      properties:
        speaker_id:
          description: 必填，说这句话的说话人，必须是 `speakers` 中声明的 `speaker_id`。
          pattern: ^Speaker [1-9][0-9]*$
          type: string
        text:
          description: >-
            必填，台词内容，不超过 10000 个字符，按逐字稿朗读。可以插入英文尖括号语气标签，如 `Hello there. <laugh>
            That
            works.`。官方标签：`<argh>`、`<breath>`、`<cackle>`、`<cheer>`、`<chuckle>`、`<chuckles>`、`<cough>`、`<cry>`、`<exhales>`、`<gasp>`、`<giggle>`、`<groan>`、`<growl>`、`<grr>`、`<grunt>`、`<heavy
            breath>`、`<hiss>`、`<laugh>`、`<laughter>`、`<long
            pause>`、`<moan>`、`<pant>`、`<pff>`、`<phew>`、`<scream>`、`<short
            pause>`、`<shout>`、`<shriek>`、`<sigh>`、`<sighs>`、`<sneeze>`、`<snicker>`、`<snort>`、`<sob>`、`<throat-clearing>`、`<tsk>`、`<whimper>`、`<whispering>`、`<whispers>`、`<yawn>`。
          maxLength: 10000
          minLength: 1
          type: string
        style:
          description: 可选，这一句的说话风格，自由描述语气、情绪和语速；同一说话人的不同台词可以不同。例如：像疲惫的夜班电台主持人，语速慢、语气干。
          type: string
      required:
        - speaker_id
        - text
      type: object
    GeminiTTSReplica:
      additionalProperties: false
      description: >-
        声音克隆录音。两段录音须为同一成年人，用同一麦克风在同一房间录制，AI 生成的音频会被拒绝。仅支持 WAV（推荐 24 kHz、单声道、16 位
        PCM），单个文件不超过 10 MB，格式按文件内容识别。
      properties:
        source_audio_url:
          description: >-
            必填，参考录音地址（公网可直接下载的 `http` / `https` 链接）。在安静环境录制 10 ~ 30
            秒自然说话：无回声、无背景音乐、只有一个人声，使用将要生成的语言。
          format: uri
          type: string
        consent_audio_url:
          description: >-
            必填，同意录音地址（公网可直接下载的 `http` / `https` 链接）。须由参考录音中的同一人逐字朗读：I am the
            owner of this voice and I consent to Google using this voice to
            create a synthetic voice model.（也接受其他支持语言的版本），并剪掉首尾静音与噪声。
          format: uri
          type: string
      required:
        - source_audio_url
        - consent_audio_url
      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.