- Third-party
- Zero data retention
AssemblyAI 的 Universal 3 Pro 语音识别模型,可实现高准确度转录。
| 模型信息 | |
|---|---|
| 条款和许可证 | 链接 ↗ |
| 更多信息 | 链接 ↗ |
| 零数据保留 | 是 |
| 定价 | 在 Cloudflare 仪表板中查看定价 ↗ |
用法
const response = await env.AI.run(
'assemblyai/universal-3-pro',
{ audio_url: 'https://cdn.openai.com/API/docs/audio/alloy.wav' },
)
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": "assemblyai/universal-3-pro",
"input": {
"audio_url": "https://cdn.openai.com/API/docs/audio/alloy.wav"
}
}'The sun rises in the east and sets in the west. This simple fact has been observed by humans for thousands of years.
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"confidence": 0.99276465,
"language_code": "en",
"language_confidence": 0.9998,
"text": "The sun rises in the east and sets in the west. This simple fact has been observed by humans for thousands of years.",
"utterances": null,
"words": [
{
"confidence": 0.9713957,
"end": 129,
"speaker": null,
"start": 32,
"text": "The"
},
{
"confidence": 0.97053415,
"end": 404,
"speaker": null,
"start": 129,
"text": "sun"
},
{
"confidence": 0.9998932,
"end": 809,
"speaker": null,
"start": 420,
"text": "rises"
},
{
"confidence": 0.999092,
"end": 922,
"speaker": null,
"start": 841,
"text": "in"
},
{
"confidence": 0.9997658,
"end": 1068,
"speaker": null,
"start": 922,
"text": "the"
},
{
"confidence": 0.9684294,
"end": 1456,
"speaker": null,
"start": 1149,
"text": "east"
},
{
"confidence": 0.9894344,
"end": 1634,
"speaker": null,
"start": 1570,
"text": "and"
},
{
"confidence": 0.9999058,
"end": 2055,
"speaker": null,
"start": 1715,
"text": "sets"
},
{
"confidence": 0.9997663,
"end": 2104,
"speaker": null,
"start": 2055,
"text": "in"
},
{
"confidence": 0.9999552,
"end": 2217,
"speaker": null,
"start": 2120,
"text": "the"
},
{
"confidence": 0.9913442,
"end": 2638,
"speaker": null,
"start": 2217,
"text": "west."
},
{
"confidence": 0.9974367,
"end": 3221,
"speaker": null,
"start": 3107,
"text": "This"
},
{
"confidence": 0.99965656,
"end": 3560,
"speaker": null,
"start": 3269,
"text": "simple"
},
{
"confidence": 0.999713,
"end": 3997,
"speaker": null,
"start": 3593,
"text": "fact"
},
{
"confidence": 0.99924207,
"end": 4175,
"speaker": null,
"start": 3997,
"text": "has"
},
{
"confidence": 0.9995851,
"end": 4289,
"speaker": null,
"start": 4224,
"text": "been"
},
{
"confidence": 0.9984724,
"end": 4807,
"speaker": null,
"start": 4337,
"text": "observed"
},
{
"confidence": 0.9997143,
"end": 4952,
"speaker": null,
"start": 4807,
"text": "by"
},
{
"confidence": 0.9997894,
"end": 5422,
"speaker": null,
"start": 4969,
"text": "humans"
},
{
"confidence": 0.99947494,
"end": 5519,
"speaker": null,
"start": 5422,
"text": "for"
},
{
"confidence": 0.99950385,
"end": 6118,
"speaker": null,
"start": 5616,
"text": "thousands"
},
{
"confidence": 0.9995235,
"end": 6231,
"speaker": null,
"start": 6118,
"text": "of"
},
{
"confidence": 0.9519594,
"end": 6636,
"speaker": null,
"start": 6328,
"text": "years."
}
]
},
"state": "Completed"
}示例
指定语言代码 — 使用显式指定的语言代码进行转录
const response = await env.AI.run(
'assemblyai/universal-3-pro',
{ audio_url: 'https://cdn.openai.com/API/docs/audio/echo.wav', language_code: 'en' },
)
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": "assemblyai/universal-3-pro",
"input": {
"audio_url": "https://cdn.openai.com/API/docs/audio/echo.wav",
"language_code": "en"
}
}'In the heart of the city, there is a large park where people go to relax and enjoy nature. The park has a beautiful pond with ducks and swans.
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"confidence": 0.9927905,
"language_code": "en_us",
"language_confidence": null,
"text": "In the heart of the city, there is a large park where people go to relax and enjoy nature. The park has a beautiful pond with ducks and swans.",
"utterances": null,
"words": [
{
"confidence": 0.88134426,
"end": 80,
"speaker": null,
"start": 32,
"text": "In"
},
{
"confidence": 0.9984907,
"end": 241,
"speaker": null,
"start": 177,
"text": "the"
},
{
"confidence": 0.99956447,
"end": 500,
"speaker": null,
"start": 258,
"text": "heart"
},
{
"confidence": 0.9995684,
"end": 548,
"speaker": null,
"start": 500,
"text": "of"
},
{
"confidence": 0.99977916,
"end": 677,
"speaker": null,
"start": 596,
"text": "the"
},
{
"confidence": 0.9956655,
"end": 967,
"speaker": null,
"start": 677,
"text": "city,"
},
{
"confidence": 0.9987048,
"end": 1435,
"speaker": null,
"start": 1322,
"text": "there"
},
{
"confidence": 0.99971443,
"end": 1516,
"speaker": null,
"start": 1467,
"text": "is"
},
{
"confidence": 0.99948585,
"end": 1596,
"speaker": null,
"start": 1564,
"text": "a"
},
{
"confidence": 0.9987669,
"end": 2016,
"speaker": null,
"start": 1709,
"text": "large"
},
{
"confidence": 0.9981509,
"end": 2467,
"speaker": null,
"start": 2129,
"text": "park"
},
{
"confidence": 0.9559358,
"end": 2838,
"speaker": null,
"start": 2693,
"text": "where"
},
{
"confidence": 0.99979085,
"end": 3145,
"speaker": null,
"start": 2854,
"text": "people"
},
{
"confidence": 0.9993555,
"end": 3338,
"speaker": null,
"start": 3177,
"text": "go"
},
{
"confidence": 0.9998317,
"end": 3467,
"speaker": null,
"start": 3338,
"text": "to"
},
{
"confidence": 0.99991953,
"end": 4064,
"speaker": null,
"start": 3500,
"text": "relax"
},
{
"confidence": 0.9988979,
"end": 4161,
"speaker": null,
"start": 4064,
"text": "and"
},
{
"confidence": 0.9999237,
"end": 4484,
"speaker": null,
"start": 4161,
"text": "enjoy"
},
{
"confidence": 0.998528,
"end": 4887,
"speaker": null,
"start": 4484,
"text": "nature."
},
{
"confidence": 0.990198,
"end": 5758,
"speaker": null,
"start": 5597,
"text": "The"
},
{
"confidence": 0.99979144,
"end": 6016,
"speaker": null,
"start": 5758,
"text": "park"
},
{
"confidence": 0.99926263,
"end": 6177,
"speaker": null,
"start": 6064,
"text": "has"
},
{
"confidence": 0.9992211,
"end": 6242,
"speaker": null,
"start": 6177,
"text": "a"
},
{
"confidence": 0.99989605,
"end": 6774,
"speaker": null,
"start": 6322,
"text": "beautiful"
},
{
"confidence": 0.9998628,
"end": 7193,
"speaker": null,
"start": 6790,
"text": "pond"
},
{
"confidence": 0.99960047,
"end": 7355,
"speaker": null,
"start": 7193,
"text": "with"
},
{
"confidence": 0.99963534,
"end": 7806,
"speaker": null,
"start": 7371,
"text": "ducks"
},
{
"confidence": 0.99866796,
"end": 7919,
"speaker": null,
"start": 7855,
"text": "and"
},
{
"confidence": 0.9833702,
"end": 8629,
"speaker": null,
"start": 7935,
"text": "swans."
}
]
},
"state": "Completed"
}使用关键术语 — 提高领域专用词汇的识别准确度
const response = await env.AI.run(
'assemblyai/universal-3-pro',
{
audio_url: 'https://cdn.openai.com/API/docs/audio/nova.wav',
keyterms_prompt: ['Kubernetes', 'microservices', 'containerization', 'load balancer'],
},
)
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": "assemblyai/universal-3-pro",
"input": {
"audio_url": "https://cdn.openai.com/API/docs/audio/nova.wav",
"keyterms_prompt": [
"Kubernetes",
"microservices",
"containerization",
"load balancer"
]
}
}'In the kitchen, the aroma of freshly baked bread filled the air. The loaves were golden brown and crusty on the outside and soft and warm on the inside.
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"confidence": 0.9901139,
"language_code": "en",
"language_confidence": 0.9969,
"text": "In the kitchen, the aroma of freshly baked bread filled the air. The loaves were golden brown and crusty on the outside and soft and warm on the inside.",
"utterances": null,
"words": [
{
"confidence": 0.9785539,
"end": 80,
"speaker": null,
"start": 32,
"text": "In"
},
{
"confidence": 0.99962807,
"end": 242,
"speaker": null,
"start": 177,
"text": "the"
},
{
"confidence": 0.99617165,
"end": 565,
"speaker": null,
"start": 258,
"text": "kitchen,"
},
{
"confidence": 0.9991928,
"end": 839,
"speaker": null,
"start": 743,
"text": "the"
},
{
"confidence": 0.99992657,
"end": 1292,
"speaker": null,
"start": 839,
"text": "aroma"
},
{
"confidence": 0.99955577,
"end": 1405,
"speaker": null,
"start": 1308,
"text": "of"
},
{
"confidence": 0.9996594,
"end": 1889,
"speaker": null,
"start": 1405,
"text": "freshly"
},
{
"confidence": 0.99850214,
"end": 2261,
"speaker": null,
"start": 1970,
"text": "baked"
},
{
"confidence": 0.9999217,
"end": 2584,
"speaker": null,
"start": 2293,
"text": "bread"
},
{
"confidence": 0.9999,
"end": 2859,
"speaker": null,
"start": 2600,
"text": "filled"
},
{
"confidence": 0.99993885,
"end": 3004,
"speaker": null,
"start": 2859,
"text": "the"
},
{
"confidence": 0.9961201,
"end": 3262,
"speaker": null,
"start": 3020,
"text": "air."
},
{
"confidence": 0.99501073,
"end": 4119,
"speaker": null,
"start": 4054,
"text": "The"
},
{
"confidence": 0.9997483,
"end": 4522,
"speaker": null,
"start": 4215,
"text": "loaves"
},
{
"confidence": 0.9998282,
"end": 4781,
"speaker": null,
"start": 4619,
"text": "were"
},
{
"confidence": 0.99248224,
"end": 5249,
"speaker": null,
"start": 4878,
"text": "golden"
},
{
"confidence": 0.9700398,
"end": 5718,
"speaker": null,
"start": 5362,
"text": "brown"
},
{
"confidence": 0.9419883,
"end": 5992,
"speaker": null,
"start": 5928,
"text": "and"
},
{
"confidence": 0.9994146,
"end": 6541,
"speaker": null,
"start": 6089,
"text": "crusty"
},
{
"confidence": 0.9997141,
"end": 6703,
"speaker": null,
"start": 6574,
"text": "on"
},
{
"confidence": 0.9999218,
"end": 6784,
"speaker": null,
"start": 6719,
"text": "the"
},
{
"confidence": 0.9993179,
"end": 7365,
"speaker": null,
"start": 6881,
"text": "outside"
},
{
"confidence": 0.8661144,
"end": 7462,
"speaker": null,
"start": 7365,
"text": "and"
},
{
"confidence": 0.9996922,
"end": 7882,
"speaker": null,
"start": 7462,
"text": "soft"
},
{
"confidence": 0.9998481,
"end": 7995,
"speaker": null,
"start": 7882,
"text": "and"
},
{
"confidence": 0.99996424,
"end": 8270,
"speaker": null,
"start": 8028,
"text": "warm"
},
{
"confidence": 0.9998791,
"end": 8399,
"speaker": null,
"start": 8270,
"text": "on"
},
{
"confidence": 0.99982506,
"end": 8512,
"speaker": null,
"start": 8415,
"text": "the"
},
{
"confidence": 0.9834439,
"end": 8964,
"speaker": null,
"start": 8512,
"text": "inside."
}
]
},
"state": "Completed"
}说话人分离 — 识别音频中的不同说话人
const response = await env.AI.run(
'assemblyai/universal-3-pro',
{ audio_url: 'https://cdn.openai.com/API/docs/audio/onyx.wav', speaker_labels: true },
)
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": "assemblyai/universal-3-pro",
"input": {
"audio_url": "https://cdn.openai.com/API/docs/audio/onyx.wav",
"speaker_labels": true
}
}'The train chugged along the tracks, carrying passengers to their destinations. The rhythmic sound of the wheels on the rails was soothing.
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"confidence": 0.99781793,
"language_code": "en",
"language_confidence": 0.9906,
"text": "The train chugged along the tracks, carrying passengers to their destinations. The rhythmic sound of the wheels on the rails was soothing.",
"utterances": [
{
"confidence": 0.99781793,
"end": 7719,
"speaker": "A",
"start": 32,
"text": "The train chugged along the tracks, carrying passengers to their destinations. The rhythmic sound of the wheels on the rails was soothing."
}
],
"words": [
{
"confidence": 0.9742124,
"end": 113,
"speaker": "A",
"start": 32,
"text": "The"
},
{
"confidence": 0.99997795,
"end": 403,
"speaker": "A",
"start": 177,
"text": "train"
},
{
"confidence": 0.99713653,
"end": 904,
"speaker": "A",
"start": 516,
"text": "chugged"
},
{
"confidence": 0.9999881,
"end": 1130,
"speaker": "A",
"start": 904,
"text": "along"
},
{
"confidence": 0.9999676,
"end": 1308,
"speaker": "A",
"start": 1227,
"text": "the"
},
{
"confidence": 0.9995983,
"end": 1808,
"speaker": "A",
"start": 1308,
"text": "tracks,"
},
{
"confidence": 0.9998933,
"end": 2341,
"speaker": "A",
"start": 2131,
"text": "carrying"
},
{
"confidence": 0.999992,
"end": 3068,
"speaker": "A",
"start": 2454,
"text": "passengers"
},
{
"confidence": 0.99999034,
"end": 3229,
"speaker": "A",
"start": 3100,
"text": "to"
},
{
"confidence": 0.9999908,
"end": 3423,
"speaker": "A",
"start": 3262,
"text": "their"
},
{
"confidence": 0.9992286,
"end": 4198,
"speaker": "A",
"start": 3423,
"text": "destinations."
},
{
"confidence": 0.99871373,
"end": 5119,
"speaker": "A",
"start": 5038,
"text": "The"
},
{
"confidence": 0.9999517,
"end": 5523,
"speaker": "A",
"start": 5184,
"text": "rhythmic"
},
{
"confidence": 0.99993813,
"end": 5926,
"speaker": "A",
"start": 5523,
"text": "sound"
},
{
"confidence": 0.99991894,
"end": 6007,
"speaker": "A",
"start": 5926,
"text": "of"
},
{
"confidence": 0.99993825,
"end": 6088,
"speaker": "A",
"start": 6007,
"text": "the"
},
{
"confidence": 0.99995935,
"end": 6459,
"speaker": "A",
"start": 6169,
"text": "wheels"
},
{
"confidence": 0.99997675,
"end": 6605,
"speaker": "A",
"start": 6556,
"text": "on"
},
{
"confidence": 0.99999475,
"end": 6718,
"speaker": "A",
"start": 6637,
"text": "the"
},
{
"confidence": 0.9999932,
"end": 7105,
"speaker": "A",
"start": 6718,
"text": "rails"
},
{
"confidence": 0.999851,
"end": 7299,
"speaker": "A",
"start": 7138,
"text": "was"
},
{
"confidence": 0.98378325,
"end": 7719,
"speaker": "A",
"start": 7299,
"text": "soothing."
}
]
},
"state": "Completed"
}参数
audio_url
string要转录的音频文件的 URL。可以是可公开访问的 URL,也可以是 data URI(data:audio/...;base64,...)。对于 data URI,音频将自动上传到 AssemblyAI。对预录音频进行转录时(stream 为 false 或未设置时)必填。websocket
boolean启用实时 WebSocket 流式传输以转录实时音频。为 true 时,将建立 WebSocket 连接,而不是提交预录音频转录任务。不能与 audio_url 同时使用。language_code
string音频文件的语言代码(例如 "en"、"es"、"fr")。默认为自动语言检测。language_detection
boolean启用自动语言检测。与 speech_models 一同启用时,系统将根据检测到的语言自动选择最佳模型。prompt
string用于引导转录风格、格式和输出特征的自定义提示词。最多 1,500 个单词。▶keyterms_prompt[]
array最多包含 1,000 个单词或短语(每个短语最多 6 个单词)的数组,用于提高转录准确度。不能与 prompt 参数同时使用。temperature
numberminimum: 0maximum: 1控制模型输出的随机性(0.0-1.0)。值越低,输出越确定。默认为 0.0。speaker_labels
boolean启用说话人分离,以识别音频中的不同说话人。speakers_expected
integerminimum: 1maximum: 9007199254740991说话人分离的预期说话人数。auto_chapters
boolean启用自动章节检测。entity_detection
boolean启用对人名、组织和地点等实体的检测。sentiment_analysis
boolean为每个句子启用情感分析。auto_highlights
boolean启用关键短语和要点的自动提取。content_safety
boolean启用针对敏感内容的内容安全检测。iab_categories
boolean启用 IAB(Interactive Advertising Bureau,互动广告局)内容分类体系分类。▶custom_spelling[]
array自定义拼写规则,用于替换转录输出中的特定单词或短语。disfluencies
boolean在转录文本中包含 "um"、"uh" 等填充词。multichannel
boolean对于多声道音频文件,分别处理每个声道。dual_channel
boolean将音频作为双声道(立体声)处理,以提高准确度。webhook_url
stringformat: uri转录完成时接收 webhook 通知的 URL。audio_start_from
integerminimum: 0maximum: 9007199254740991开始转录的时间戳(以毫秒为单位)。audio_end_at
integerminimum: 0maximum: 9007199254740991结束转录的时间戳(以毫秒为单位)。▶word_boost[]
array用于提升识别准确度的单词数组(旧版——请改用 keyterms_prompt)。boost_param
stringenum: low, default, high对 word_boost 中单词的提升程度。filter_profanity
boolean过滤转录内容中的脏话。redact_pii
boolean对个人身份信息进行脱敏处理。redact_pii_audio
boolean生成已移除 PII 的脱敏音频文件。▶redact_pii_policies[]
array用于脱敏处理的特定 PII 策略。redact_pii_sub
stringenum: entity_name, hash替换已脱敏 PII 的策略。speech_threshold
numberminimum: 0maximum: 1语音检测的置信度阈值。domain
stringenum: medical-v1领域专用转录模式。"medical-v1" 可启用医学术语优化。text
string转录文本。words
array | null单词级时间戳和置信度分数。utterances
array | null按说话人分隔的话语(启用 speaker_labels 时)。confidence
number | null转录的总体置信度分数。language_code
string | null检测到或指定的语言代码。language_confidence
number | null语言检测的置信度分数。