> ## 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 文生音频

> 适用于通过输入提示词，生成一段音频（支持生成音效和背景音乐 BGM）。提交任务后，请通过 `GET /vidu/ent/v2/tasks/{task_id}/creations` 查询状态。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelAudio/vidu/vidu-text-to-audio.json POST /vidu/ent/v2/text2audio
openapi: 3.0.1
info:
  title: 文生音频
  version: 1.0.0
servers:
  - url: https://api.powertokens.ai
security: []
paths:
  /vidu/ent/v2/text2audio:
    post:
      summary: 文生音频
      description: >-
        适用于通过输入提示词，生成一段音频（支持生成音效和背景音乐 BGM）。提交任务后，请通过 `GET
        /vidu/ent/v2/tasks/{task_id}/creations` 查询状态。
      operationId: viduTextToAudio
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextToAudioRequest'
            examples:
              basic_audio_generation:
                summary: 基础文生音频
                value:
                  model: audio1.0
                  prompt: 清晨的鸟叫声
                  duration: 10
                  seed: 0
      responses:
        '200':
          description: 提交成功，返回音频任务对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextToAudioResponse'
              examples:
                success:
                  value:
                    task_id: your_task_id_here
                    state: created
                    model: audio1.0
                    prompt: 清晨的鸟叫声
                    duration: 10
                    seed: 123456789
                    credits: 10
                    created_at: '2025-01-01T15:41:31.968916Z'
      security:
        - BearerAuth: []
components:
  schemas:
    TextToAudioRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          enum:
            - audio1.0
          description: 模型名称可选值：audio1.0
        prompt:
          type: string
          maxLength: 1500
          description: 文本提示词用于生成音频的描述。字符长度不能超过 1500 个字符
        duration:
          type: number
          format: float
          default: 10
          minimum: 2
          maximum: 10
          description: 音频时长默认 10，可选范围：2～10 秒内
        seed:
          type: integer
          description: 随机种子随机种子，若不传或传0则自动生成随机数，传固定值生成确定性结果
        callback_url:
          type: string
          description: >-
            Callback 协议需要您在创建任务时主动设置 callback_url，请求方法为 POST，当视频生成任务有状态变化时，Vidu
            将向此地址发送包含任务最新状态的回调请求。回调请求内容结构与查询任务API的返回体一致回调返回的"status"包括以下状态：-
            processing 任务处理中- success 任务完成（如发送失败，回调三次）- failed
            任务失败（如发送失败，回调三次）Vidu采用回调签名算法进行认证，详情见：回调签名算法
    TextToAudioResponse:
      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: 本次调用的模型名称
        prompt:
          type: string
          description: 本次调用的提示词参数
        duration:
          type: integer
          description: 本次调用的音频时长参数
        seed:
          type: integer
          description: 本次调用的随机种子参数
        credits:
          type: integer
          description: 本次调用使用的积分数
        created_at:
          type: string
          description: 任务创建时间
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````