Text to Audio
Generate an audio clip (supports sound effects & BGM) by inputting a text prompt.
POST https://api.vidu.com/ent/v2/text2audio
Request Headers
Field | Value | Description |
---|---|---|
Content-Type | application/json | Data format |
Authorization | Token {your api key} | Replace {your_api_key} with your actual API Key |
Request Body
Field | Type | Required | Description |
---|---|---|---|
model | String | Required | Model Available value: audio1.0 |
prompt | String | Required | Text prompt describing the audio. Maximum length: 1500 characters. |
duration | Float | Optional | Audio duration. Default: 10 seconds. Range: 2–10 seconds. |
seed | Int | Optional | Random seed. If not provided or set to 0, a random value will be used. Fixed value ensures reproducibility. |
callback_url | String | Optional | Callback When creating a task, you need to actively set the callback_url with a POST request. When the video generation task changes its status, Vidu will send a callback request to this URL, containing the latest status of the task. The structure of the callback request content will be the same as the return body of the GET Generation API. The “status” in the callback response includes the following states: - processing: Task is being processed. - success: Task is completed (if sending fails, it will retry the callback three times). - failed: Task failed (if sending fails, it will retry the callback |
curl -X POST -H "Authorization: Token {your_api_key}" -H "Content-Type: application/json" -d '{"model": "audio1.0""prompt": "Birds chirping in the morning","duration": "10","seed": "0"}' https://api.vidu.com/ent/v2/text2audio
Response Body
Field | Type | Description |
---|---|---|
task_id | String | Vidu generated Task ID |
state | String | Task state:: -created -queueing -processing -success -failed |
model | String | Model parameter used |
prompt | String | Prompt text used |
duration | Int | Audio duration |
seed | Int | Random seed used |
created_at | String | Task creation timestamp (ISO8601 format) |
{"task_id": "your_task_id_here","state": "created","model": "audio1.0","prompt": "Birds chirping in the morning","duration": 10,"seed": random_number,"created_at": "2025-01-01T15:41:31.968916Z"}