- Third-party
- Zero data retention
超快速、高性价比的文本转语音,延迟约为 120ms,支持 15 种语言。
| 模型信息 | |
|---|---|
| 条款和许可证 | 链接 ↗ |
| 更多信息 | 链接 ↗ |
| 零数据保留 | 是 |
| 定价 | 在 Cloudflare 仪表板中查看定价 ↗ |
用法
const response = await env.AI.run(
'inworld/tts-1.5-mini',
{
output_format: 'mp3',
temperature: 1,
text: 'Hello! Welcome to Cloudflare AI Gateway. Let me show you what we can do.',
timestamp_type: 'none',
voice_id: 'Dennis',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "inworld/tts-1.5-mini",
"input": {
"output_format": "mp3",
"temperature": 1,
"text": "Hello! Welcome to Cloudflare AI Gateway. Let me show you what we can do.",
"timestamp_type": "none",
"voice_id": "Dennis"
}
}'{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/inworld__tts-1.5-mini/simple-speech.mp3"
},
"state": "Completed"
}示例
快速语音 — 加快语速以便快速播放
const response = await env.AI.run(
'inworld/tts-1.5-mini',
{
output_format: 'mp3',
speaking_rate: 1.4,
temperature: 1,
text: 'This is a fast-paced summary of the key findings from the quarterly report. Revenue is up fifteen percent and user growth exceeded expectations.',
timestamp_type: 'none',
voice_id: 'Dennis',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "inworld/tts-1.5-mini",
"input": {
"output_format": "mp3",
"speaking_rate": 1.4,
"temperature": 1,
"text": "This is a fast-paced summary of the key findings from the quarterly report. Revenue is up fifteen percent and user growth exceeded expectations.",
"timestamp_type": "none",
"voice_id": "Dennis"
}
}'{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/inworld__tts-1.5-mini/fast-speech.mp3"
},
"state": "Completed"
}低延迟 — 通过禁用文本规范化将延迟降到最低
const response = await env.AI.run(
'inworld/tts-1.5-mini',
{
apply_text_normalization: false,
output_format: 'mp3',
temperature: 1,
text: 'Quick response needed. The server is ready.',
timestamp_type: 'none',
voice_id: 'Dennis',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "inworld/tts-1.5-mini",
"input": {
"apply_text_normalization": false,
"output_format": "mp3",
"temperature": 1,
"text": "Quick response needed. The server is ready.",
"timestamp_type": "none",
"voice_id": "Dennis"
}
}'{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/inworld__tts-1.5-mini/low-latency.mp3"
},
"state": "Completed"
}参数
text
stringrequiredmaxLength: 2000要合成为语音的文本。最多输入 2,000 个字符。voice_id
stringrequireddefault: Dennisenum: Loretta, Darlene, Marlene, Hank, Evelyn, Celeste, Pippa, Tessa, Liam, Callum, Hamish, Abby, Graham, Rupert, Mortimer, Snik, Anjali, Saanvi, Arjun, Claire, Oliver, Simon, Elliot, James, Serena, Gareth, Vinny, Lauren, Jessica, Ethan, Tyler, Jason, Chloe, Veronica, Victoria, Miranda, Sebastian, Victor, Malcolm, Nate, Brian, Amina, Kelsey, Derek, Evan, Kayla, Jake, Grant, Tristan, Nadia, Selene, Marcus, Riley, Damon, Cedric, Mia, Naomi, Jonah, Levi, Avery, Brandon, Conrad, Bianca, Lucian, Trevor, Alex, Ashley, Craig, Deborah, Dennis, Edward, Elizabeth, Hades, Julia, Pixie, Mark, Olivia, Priya, Ronald, Sarah, Shaun, Theodore, Timothy, Wendy, Dominus, Hana, Clive, Carter, Blake, Luna, Reed, Duncan, Felix, Eleanor, Sophie用于合成语音的语音 ID。默认为 Dennis。output_format
stringrequireddefault: mp3enum: mp3, opus, wav, flac音频的输出格式。支持的格式为 mp3、opus、wav 和 flac。默认为 mp3。bit_rate
integerminimum: -9007199254740991maximum: 9007199254740991音频的比特率(每秒比特数)。仅适用于压缩音频格式(mp3、opus)。默认为 128,000。sample_rate
integerminimum: -9007199254740991maximum: 9007199254740991合成采样率(赫兹)。可选值:8000、16000、22050、24000、32000、44100、48000。默认为 48,000。speaking_rate
numberminimum: 0.5maximum: 1.5语速,范围为 [0.5, 1.5]。默认为 1.0。建议使用高于 0.8 的值以确保高质量。temperature
numberrequireddefault: 1minimum: 0.01maximum: 2决定采样音频 token 时的随机程度。默认为 1.0。接受 0(不含)到 2(含)之间的值。值越高表现力越强,值越低越确定。timestamp_type
stringrequireddefault: noneenum: none, word, character控制随音频返回的时间戳元数据。"word" 返回单词级时间信息,"character" 返回字符级时间信息。注意:会增加延迟。默认为 none。apply_text_normalization
boolean启用后,文本规范化会在转换为语音之前展开数字、日期、时间和缩写。关闭此功能可能会降低延迟。audio
string生成音频文件的 URL