创建文生音频任务

POST /ent/v2/text2audio

MethodPOST
Path/ent/v2/text2audio
Typehttp
Status1
Module2102810
Folder76611123

说明

概览

MethodPOST
Path/ent/v2/text2audio
Typehttp
Status1
Module2102810
Folder76611123

参数

{
  "query": [],
  "path": [],
  "cookie": [],
  "header": [
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "Jsj23RwEo1",
      "enable": true,
      "name": "Authorization",
      "sampleValue": "Bearer {{YOUR_API_KEY}}"
    },
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "jjYSOg2NrR",
      "enable": true,
      "name": "Content-Type",
      "sampleValue": "application/json"
    }
  ]
}

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "type": "object",
    "properties": {
      "prompt": {
        "type": "string",
        "description": "文本提示词用于生成音频的描述。字符长度不能超过 1500 个字符"
      },
      "model": {
        "type": "string",
        "description": "模型名称可选值:audio1.0"
      },
      "callback_url": {
        "type": "string",
        "description": "Callback 协议\n需要您在创建任务时主动设置 callback_url,请求方法为 POST,当视频生成任务有状态变化时,Vidu 将向此地址发送包含任务最新状态的回调请求。回调请求内容结构与查询任务API的返回体一致\n回调返回的“status”包括以下状态:\n- processing 任务处理中\n- success 任务完成(如发送失败,回调三次)\n- failed 任务失败(如发送失败,回调三次)\nVidu采用回调签名算法进行认证,详情见:回调签名算法"
      },
      "duration": {
        "type": "string",
        "description": "音频时长默认 10,可选范围:2~10 秒内"
      },
      "seed": {
        "type": "string",
        "description": "\t随机种子随机种子,若不传或传0则自动生成随机数,传固定值生成确定性结果"
      }
    },
    "required": [
      "model",
      "prompt"
    ],
    "x-apifox-orders": [
      "model",
      "prompt",
      "duration",
      "seed",
      "callback_url"
    ]
  },
  "required": false,
  "mediaType": "",
  "examples": [
    {
      "mediaType": "application/json",
      "value": "{\r\n    \"model\": \"audio1.0\",\r\n    \"prompt\": \"雨滴落在窗户上的声音,伴随着轻柔的雷声\",\r\n    \"duration\": 5\r\n}"
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 755089939,
    "name": "成功",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {
        "task_id": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "model": {
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "duration": {
          "type": "integer"
        },
        "seed": {
          "type": "integer"
        },
        "created_at": {
          "type": "string"
        },
        "credits": {
          "type": "integer"
        }
      },
      "required": [
        "task_id",
        "state",
        "model",
        "prompt",
        "duration",
        "seed",
        "created_at",
        "credits"
      ],
      "x-apifox-orders": [
        "task_id",
        "state",
        "model",
        "prompt",
        "duration",
        "seed",
        "created_at",
        "credits"
      ]
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": [],
    "oasExtensions": ""
  }
]

响应示例

[
  {
    "name": "成功示例",
    "responseId": 755089939,
    "data": "{\r\n    \"task_id\": \"911094612548939776\",\r\n    \"state\": \"created\",\r\n    \"model\": \"audio1.0\",\r\n    \"prompt\": \"雨滴落在窗户上的声音,伴随着轻柔的雷声\",\r\n    \"duration\": 5,\r\n    \"seed\": 0,\r\n    \"created_at\": \"2026-01-20T07:16:38.094635957Z\",\r\n    \"credits\": 10\r\n}",
    "description": "",
    "oasKey": "",
    "oasExtensions": "",
    "id": 671652211
  }
]