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

# Eleven v4 单段语音合成

> - 单段文本与指定已有音色合成语音
- text 与 voice_id 必填，文本最多10000字符
- 可选嵌套音色设置、前后文与音效
- 异步处理模式，使用返回的任务ID [进行查询](/pages/zh/api-manual/task-management/get-task-detail)
- 完成后从 `results[0].url` 下载音频；timestamps 请求仅在完整功能可用时受理，结果保留实际返回的对齐和说话人区间，不补造缺失字段。请及时下载，链接保留时间取决于文件存储服务。


`eleven-v4-text-to-speech` 与 `eleven-v4-text-to-speech-custom-voice` 均要求 `text` 和 `voice_id`，无默认音色。文本支持 1–10000 个 Unicode 字符，包含空格、标点、emoji 和音频标签。Speech 不接受 `inputs`；分段多音色使用 [Dialogue](https://docs.aihubmax.com/pages/zh/api-manual/audio-series/elevenlabs/eleven-v4-text-to-dialogue.md)。

直接传已有音色的原始 ID。custom 支持私有音色，也允许公共音色；普通入口也可使用可访问的私有音色。音色必须仍有效并允许访问，ID 不代表永久可用或本系统用户独享；其他取得有效 ID 且有模型权限的调用者也可能使用。不可用时任务失败，按实际退款结果提示。[音色目录](https://docs.aihubmax.com/pages/zh/api-manual/audio-series/elevenlabs/preset-voice-id.md)仅用于发现和试听。

可选 `voice_settings` 内的 `stability` 默认 0.5、`similarity_boost` 默认 0.75，`clone_strength` 可选，均为 0–1。整个对象省略/null 时不强制覆盖已保存的音色设置；传对象时使用其字段默认值。`clone_strength` 仅适用于对应 v4 专业克隆音色，不创建声音。v4 不承诺 style、speed 或 SSML。

`previous_text` / `next_text` 提供前后文，不朗读、不计费。`seed` 为 0–4294967295，`language_code` 可选，`apply_text_normalization` 为 auto/on/off，默认 auto。`audio_effects` 可包含滤镜、混响、背景音目录 ID；distance 为 0–1（默认0）、send\_level 为 0–1（默认1）、pan 为 -1–1（默认0）。混响或非零声像不能与裸 PCM、μ-law、A-law 组合，无音效附加费。

输出格式默认 `mp3_44100_128`，共28种 MP3、PCM、WAV、μ-law、A-law、Opus 值，完整列表见参数。裸 PCM 为16位小端；按结果的采样率、声道和 Content-Type 解码。时间戳、固定版本发音词典及安全控制是显式功能要求；无法执行完整请求时明确报错，不删除选项。

两模型基准价均为 \*\*$0.00008/Unicode字符**（$0.08/1000字符），按实际字符收费，不补齐千字符。仅累计 `text`，不计音色ID、设置和前后文；采用提交时价格与分组倍率，完成后多退少补，失败按任务规则退款。

提交后[查询任务](https://docs.aihubmax.com/pages/zh/api-manual/task-management/get-task-detail.md)，完成后下载 `results[0].url`。文件元数据与实际返回的对齐字段保留；普通音频结果可能没有 alignment、voice\_segments，不能据缺失字段推导时间戳。请及时保存音频。

迁移旧请求：`voice` → `voice_id`，平铺设置 → `voice_settings`，Speech `future_text` → `next_text`。旧字段与未知嵌套字段明确拒绝；已受理任务及历史账单保持原合同。旧 Turbo 名称无兼容别名。


## OpenAPI

````yaml openapi/zh/eleven-v4-text-to-speech.json POST /v1/audios/generations
openapi: 3.1.0
info:
  title: Eleven v4 Speech / Custom Voice
  version: '1.0'
servers:
  - url: https://api.aihubmax.com/e
security:
  - BearerAuth: []
paths:
  /v1/audios/generations:
    post:
      tags:
        - Audio > 语音合成
      summary: Eleven v4 Speech / Custom Voice
      description: >
        - 单段文本与指定已有音色合成语音

        - text 与 voice_id 必填，文本最多10000字符

        - 可选嵌套音色设置、前后文与音效

        - 异步处理模式，使用返回的任务ID
        [进行查询](/pages/zh/api-manual/task-management/get-task-detail)

        - 完成后从 `results[0].url` 下载音频；timestamps
        请求仅在完整功能可用时受理，结果保留实际返回的对齐和说话人区间，不补造缺失字段。请及时下载，链接保留时间取决于文件存储服务。
      operationId: eleven-v4-text-to-speech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ElevenV4SpeechRequest'
            examples:
              指定音色的单段语音:
                summary: 指定音色的单段语音
                value:
                  model: eleven-v4-text-to-speech
                  text: 欢迎收听。
                  voice_id: existing-voice-id
      responses:
        '200':
          $ref: '#/components/responses/TaskCreated'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    ElevenV4SpeechRequest:
      type: object
      required:
        - model
        - text
        - voice_id
      properties:
        seed:
          anyOf:
            - maximum: 4294967295
              minimum: 0
              type: integer
            - type: 'null'
          default: null
          description: 随机种子。
          example: 0
        language_code:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: ISO 639-1 语言代码。
          example: zh
        apply_text_normalization:
          default: auto
          description: 文本规范化。
          enum:
            - auto
            - 'on'
            - 'off'
          type: string
          example: auto
        output_format:
          default: mp3_44100_128
          description: 音频编码、采样率及码率；共 28 种格式。
          enum:
            - mp3_22050_32
            - mp3_24000_48
            - mp3_44100_32
            - mp3_44100_64
            - mp3_44100_96
            - mp3_44100_128
            - mp3_44100_192
            - pcm_8000
            - pcm_16000
            - pcm_22050
            - pcm_24000
            - pcm_32000
            - pcm_44100
            - pcm_48000
            - wav_8000
            - wav_16000
            - wav_22050
            - wav_24000
            - wav_32000
            - wav_44100
            - wav_48000
            - ulaw_8000
            - alaw_8000
            - opus_48000_32
            - opus_48000_64
            - opus_48000_96
            - opus_48000_128
            - opus_48000_192
          type: string
          example: mp3_44100_128
        timestamps:
          default: false
          description: 请求语音时间戳；仅在当前可用来源支持时受理。
          type: boolean
          example: false
        pronunciation_dictionary_locators:
          anyOf:
            - items:
                additionalProperties: false
                properties:
                  pronunciation_dictionary_id:
                    description: 发音词典 ID。
                    minLength: 1
                    type: string
                  version_id:
                    description: 发音词典版本 ID。
                    minLength: 1
                    type: string
                required:
                  - pronunciation_dictionary_id
                  - version_id
                type: object
              maxItems: 3
              type: array
            - type: 'null'
          default: null
          description: |-
            最多三个发音词典和版本；要求完整能力支持。

            > 非必须不要传这个参数。
          x-advanced: true
          example:
            - pronunciation_dictionary_id: dictionary-id
              version_id: version-id
        model:
          description: >-
            `eleven-v4-text-to-speech`：指定已有音色的单段语音；`eleven-v4-text-to-speech-custom-voice`：支持已有私有音色。两者均必传
            voice_id，$0.00008/Unicode字符，不补齐千字符。
          examples:
            - eleven-v4-text-to-speech
            - eleven-v4-text-to-speech-custom-voice
          type: string
          default: eleven-v4-text-to-speech
        text:
          description: 1–10000 个 Unicode 字符，含空格、标点和音频标签。
          maxLength: 10000
          minLength: 1
          type: string
          example: 欢迎收听。
        voice_id:
          description: 已有音色的原始 ID，必填；音色必须仍有效且允许访问。
          minLength: 1
          type: string
          example: existing-voice-id
        voice_settings:
          anyOf:
            - additionalProperties: false
              properties:
                stability:
                  anyOf:
                    - maximum: 1
                      minimum: 0
                      type: number
                    - type: 'null'
                  default: 0.5
                  description: 稳定性，0–1；null 不覆盖已保存设置。
                  example: 0.5
                similarity_boost:
                  anyOf:
                    - maximum: 1
                      minimum: 0
                      type: number
                    - type: 'null'
                  default: 0.75
                  description: 音色相似度，0–1；null 不覆盖已保存设置。
                  example: 0.75
                clone_strength:
                  anyOf:
                    - maximum: 1
                      minimum: 0
                      type: number
                    - type: 'null'
                  default: null
                  description: 仅适用于 v4 专业克隆音色的强度。
                  example: 0.5
              type: object
            - type: 'null'
          default: null
          description: 省略或 null 保留音色已保存设置；传对象时采用对象内默认值。
          example:
            similarity_boost: 0.75
            stability: 0.5
        previous_text:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: |-
            前文，不计入字符费用。

            > 非必须不要传这个参数。
          x-advanced: true
          example: 节目开始了。
        next_text:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: |-
            后文，不计入字符费用。

            > 非必须不要传这个参数。
          x-advanced: true
          example: 下面开始正文。
        audio_effects:
          anyOf:
            - additionalProperties: false
              properties:
                filter_preset_id:
                  anyOf:
                    - minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  description: 滤镜目录 ID。
                  example: filter-id
                environment_id:
                  anyOf:
                    - minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  description: 环境混响目录 ID。
                  example: environment-id
                background_noise_id:
                  anyOf:
                    - minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  description: 背景声音目录 ID。
                  example: background-id
                distance:
                  default: 0
                  description: 距离，0–1。
                  maximum: 1
                  minimum: 0
                  type: number
                  example: 0
                send_level:
                  default: 1
                  description: 效果发送量，0–1。
                  maximum: 1
                  minimum: 0
                  type: number
                  example: 1
                pan:
                  default: 0
                  description: 声像，-1–1。
                  maximum: 1
                  minimum: -1
                  type: number
                  example: 0
              type: object
            - type: 'null'
          default: null
          description: |-
            音效控制，无客户附加费；混响或非零声像需要支持立体声的格式。

            > 非必须不要传这个参数。
          x-advanced: true
          example:
            pan: 0
        enable_safety_checker:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: 显式安全控制；要求当前来源支持，不会忽略 false。
          example: true
      additionalProperties: false
    TaskResponse:
      type: object
      properties:
        created:
          type: integer
          description: 任务创建时间戳
          example: 1757165031
        id:
          type: string
          description: 任务ID
          example: task-unified-1757165031-uyujaw3d
        model:
          type: string
          description: 实际使用的模型名称
        object:
          type: string
          description: 任务的具体类型
          enum:
            - audio.generation.task
        progress:
          type: integer
          description: 任务进度百分比 (0-100)
          minimum: 0
          maximum: 100
          example: 0
        status:
          type: string
          description: 任务状态
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        task_info:
          type: object
          description: 异步任务信息
          properties:
            can_cancel:
              type: boolean
              description: 任务是否可以取消
              example: true
            estimated_time:
              type: integer
              description: 预计完成时间（秒）
              example: 45
        type:
          type: string
          description: 任务的输出类型
          enum:
            - audio
          example: audio
    ErrorResponse400:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: 请求格式错误
            type:
              type: string
              example: invalid_request_error
    ErrorResponse401:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: API密钥无效
            type:
              type: string
              example: authentication_error
    ErrorResponse402:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: 账户余额不足
            type:
              type: string
              example: insufficient_quota
    ErrorResponse422:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: 参数校验失败
            type:
              type: string
              example: validation_error
    ErrorResponse429:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: 请求频率超限
            type:
              type: string
              example: rate_limit_error
    ErrorResponse500:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: 服务器内部错误
            type:
              type: string
              example: server_error
    ErrorResponse503:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: 服务暂不可用，请稍后重试
            type:
              type: string
              example: service_unavailable
  responses:
    TaskCreated:
      description: 任务创建成功
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TaskResponse'
    BadRequest:
      description: 请求格式错误
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Unauthorized:
      description: 未授权
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse401'
    PaymentRequired:
      description: 余额不足
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse402'
    UnprocessableEntity:
      description: 参数校验失败
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse422'
    TooManyRequests:
      description: 请求频率超限
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse429'
    InternalServerError:
      description: 服务器内部错误
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse500'
    ServiceUnavailable:
      description: 服务暂不可用
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse503'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        ## 所有接口均需要使用Bearer Token进行认证 ##

        使用时在请求头中添加：

        `Authorization: Bearer YOUR_API_KEY`

````

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