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

# Vidu 可控文生音效

> 使用 Vidu 模型基于时间轴生成可控音效片段。创作者可以通过时间轴自由控制音频中多个声音事件的时机。（不支持背景音乐）提交任务后，请通过 `GET /vidu/ent/v2/tasks/{task_id}/creations` 查询状态。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelAudio/vidu/vidu-timing-to-audio.json POST /vidu/ent/v2/timing2audio
openapi: 3.0.1
info:
  title: 可控文生音效
  version: 1.0.0
servers:
  - url: https://api.powertokens.ai
security: []
paths:
  /vidu/ent/v2/timing2audio:
    post:
      summary: 可控文生音效
      description: >-
        使用 Vidu 模型基于时间轴生成可控音效片段。创作者可以通过时间轴自由控制音频中多个声音事件的时机。（不支持背景音乐）提交任务后，请通过
        `GET /vidu/ent/v2/tasks/{task_id}/creations` 查询状态。
      operationId: viduTimingToAudio
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TimingToAudioRequest'
            examples:
              basic_timing_audio:
                summary: 基础时间轴音效
                value:
                  model: audio1.0
                  duration: 10
                  timing_prompts:
                    - from: 0
                      to: 3
                      prompt: 清晨的鸟叫声
                    - from: 3
                      to: 6
                      prompt: 远处传来火车驶过的声音
                    - from: 5
                      to: 9.5
                      prompt: 海浪轻轻拍打沙滩
                  seed: 0
      responses:
        '200':
          description: 提交成功，返回音频任务对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimingToAudioResponse'
              examples:
                success:
                  value:
                    task_id: your_task_id_here
                    state: created
                    model: audio1.0
                    duration: 10
                    timing_prompts:
                      - from: 0
                        to: 3
                        prompt: 清晨的鸟叫声
                      - from: 3
                        to: 6
                        prompt: 远处传来火车驶过的声音
                      - from: 5
                        to: 9.5
                        prompt: 海浪轻轻拍打沙滩
                    seed: 123456789
                    credits: 10
                    created_at: '2025-01-01T10:00:00.000Z'
      security:
        - BearerAuth: []
components:
  schemas:
    TimingToAudioRequest:
      type: object
      required:
        - model
        - timing_prompts
      properties:
        model:
          type: string
          enum:
            - audio1.0
          description: 模型名称可选值：audio1.0
        duration:
          type: number
          format: float
          default: 10
          minimum: 2
          maximum: 10
          description: 音频时长默认 10，可选范围：2～10 秒内
        timing_prompts:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/TimingPrompt'
          description: >-
            可控音效参数。描述多个音效事件及各自时间区间，支持多个事件重叠。- 单个事件最大提示词字符数：1500 字符- from、to 必须在
            [0, duration] 区间内
        seed:
          type: integer
          description: 随机种子随机种子，若不传或传0则自动生成随机数，传固定值生成确定性结果
        callback_url:
          type: string
          description: >-
            Callback 协议需要您在创建任务时主动设置 callback_url，请求方法为 POST，当视频生成任务有状态变化时，Vidu
            将向此地址发送包含任务最新状态的回调请求。回调请求内容结构与查询任务API的返回体一致回调返回的"status"包括以下状态：-
            processing 任务处理中- success 任务完成（如发送失败，回调三次）- failed
            任务失败（如发送失败，回调三次）Vidu采用回调签名算法进行认证，详情见：回调签名算法
    TimingToAudioResponse:
      type: object
      properties:
        task_id:
          type: string
          description: Vidu 生成的任务ID
        state:
          type: string
          enum:
            - created
            - queueing
            - processing
            - success
            - failed
          description: |-
            处理状态 可选值：
            - created 创建成功
            - queueing 任务排队中
            - processing 任务处理中
            - success 任务成功
            - failed 任务失败
        model:
          type: string
          description: 本次调用的模型名称
        duration:
          type: integer
          description: 本次调用的音频时长参数
        timing_prompts:
          type: array
          items:
            $ref: '#/components/schemas/TimingPrompt'
          description: 本次调用中定义的多个音频事件参数
        seed:
          type: integer
          description: 本次调用的随机种子参数
        credits:
          type: integer
          description: 本次调用使用的积分数
        created_at:
          type: string
          description: 任务创建时间
    TimingPrompt:
      type: object
      required:
        - from
        - to
        - prompt
      properties:
        from:
          type: number
          format: float
          minimum: 0
          description: |-
            声音事件开始时间（秒）。
            必须在 [0, duration] 范围内。
        to:
          type: number
          format: float
          description: |-
            声音事件结束时间（秒）。
            必须在 [0, duration] 范围内，且大于 from。
        prompt:
          type: string
          maxLength: 1500
          description: 声音事件的文本描述，最大长度 1500 字符。
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````