跳转到主要内容
POST
/
text-to-audio
文字转语音
curl --request POST \
  --url http://{api_base_url}/text-to-audio \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
  "text": "你好Dify",
  "user": "abc-123",
  "streaming": false
}
'
This response does not have an example.

Authorizations

Authorization
string
header
required

API-Key 鉴权。所有 API 请求都应在 Authorization HTTP Header 中包含你的 API-Key,格式为 Bearer {API_KEY}强烈建议开发者把 API-Key 放在后端存储,而非分享或者放在客户端存储,以免 API-Key 泄露,导致财产损失。

Body

application/json

文字转语音请求体。

user
string
required

用户标识,应用内唯一。

message_id
string<uuid>

Dify 生成的消息 ID(优先使用)。

text
string

语音生成内容(若无 message_id)。

streaming
boolean
default:false

是否流式返回音频。

Response

语音文件生成成功。

生成的 WAV 格式音频文件。