语音转文字(豆包语音 ASR)算子基于豆包语音识别能力,可将语音内容自动转写为文本,帮助用户快速完成音频内容的结构化处理。该算子适用于录音转写、语音内容检索、会议/课堂内容整理等场景,可降低人工听写与整理成本,提升语音数据的分析与利用效率。
算子 ID : las_asr
返回结果说明:以返回结果1为例
标点补齐、智能断句
{ …… "text": "它现在能帮我实时监测发出视频的评论情况。帮我盯着全球资本市场的波动,经济数据的波动。……" …… }
说话人分离
{…… "utterances": [ { "additions": { "speaker": "1" }, …… ] …… }
细分项 | 性能影响说明 |
|---|---|
最大 RPM | 600 |
耗时 |
|
细分 | 详细说明 |
|---|---|
支持的输入数据模态 |
|
输入格式:音频 |
|
输入路径要求 | 通过请求参数
|
细分 | 详细说明 |
|---|---|
输出数据模态 |
|
输出路径:API 返回 | 算子处理完成输入的音频文件后,会将转换好的文字直接通过算子 Poll 接口的返回参数将结果返回。 |
计费标准
细分项 | 计费标准说明 |
|---|---|
计费项 | 基于输入音频的时长统计用量进行计费。 |
计费类型 | 按量计费,单位: |
单价 | 与选择使用的模型有关。 |
计费详情
计费公式:总费用 = 单价 * 用量
细分场景 | 单价 |
|---|---|
| 0.8 元/小时 |
| 2.3 元/小时 |
细分项 | 注意与前提 |
|---|---|
开通 LAS |
|
费用 | 调用算子前,您需先了解使用算子时的模型调用费用,详情请参见大模型调用计费。 |
鉴权(API Key) | 调用算子前,您需要先生成算子调用的API Key,并建议将API Key配置为环境变量,便于更安全地调用算子,详情请参见获取 API Key 并配置。 |
BaseURL | 调用算子前,您需要先根据您当前使用的LAS服务所在地域,了解算子调用的BaseURL,用于配置算子调用路径参数取值。 |
LAS 为您提供了“在线体验”的能力,并为您提供了一定的免费体验额度,您无需任何配置,即可在在线体验 LAS 算子的数据处理效果。
注意
当前算子在线体验可免费解析 5 分钟的音频文件,超出部分会依据算子的计费项进行计费,各算子的计费项及计费逻辑请参见大模型调用计费。
Submit 接口提交任务获得任务的 task_id,再通过 Poll 接口获取对应任务(task_id)运行状态,并获取算子处理结果。task_id 有效期为 1 天,超过 1 天后即无法通过此 task_id 来获取算子处理结果。提交豆包语音 ASR 异步识别任务。单次任务仅支持传入 1 个音频文件;如需处理多个文件,请并发提交多个任务。
参数 | 类型 | 是否必填 | 示例值 | 描述 |
|---|---|---|---|---|
operator_id | string | 是 | las_asr | 算子 ID。 |
operator_version | string | 是 | v2 | 算子版本。 |
data | SpeechRecognition | 是 | 语音识别请求。 |
参数 | 类型 | 示例值 | 描述 |
|---|---|---|---|
metadata | Metadata | 任务元信息。 |
curl --location "https://operator.las.cn-beijing.volces.com/api/v1/submit" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer ${LAS_API_KEY}" \ --data @- <<EOF { "operator_id": "las_asr", "operator_version": "v2", "data": { "resource": "bigasr", "audio": { "url": "https://${LAS_TOS_BUCKET}.tos-${LAS_REGION}.volces.com/operator_cards_serving/public/${LAS_ENVIRONMENT}/las_asr/badaling.wav", "format": "wav" }, "request": { "model_name": "bigmodel", "model_version": "310", "show_utterances": true, "enable_channel_split": true } } } EOF
{ "metadata": { "task_id": "xxxxx123ef24ea40546c-las-asr", "task_status": "ACCEPTED", "business_code": "0", "error_msg": "", "request_id": "494022a8a0fc3eadb758cf8b0e8b20ef" } }
HttpStatusCode | 错误码 | 错误信息 | 描述 |
|---|---|---|---|
400 | Parameter.Invalid | The parameter is invalid. | 参数不合法,包括枚举值不支持或存在互斥参数。 |
401 | Authorization.Missing | Missing Authorization. | 缺少鉴权信息。 |
401 | ApiKey.Invalid | The api key is invalid. | API Key 不合法。 |
429 | Server.Busy | Server is Busy, please try again later. | 服务繁忙或触发限流,请稍后重试。 |
500 | Server.InternalError | 根据具体异常而定 | 服务内部异常。 |
通过 Submit 返回的任务 ID 查询任务状态和识别结果。
参数 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|
operator_id | string | 是 | las_asr | 算子Id |
operator_version | string | 是 | v2 | 算子版本 |
task_id | string | 是 | 异步任务Id |
参数 | 类型 | 示例值 | 描述 |
|---|---|---|---|
metadata | Metadata | 任务元信息。 | |
data | AudioResponse | 音频识别结果。仅当 task_status=COMPLETED 且 business_code=0 时返回完整数据;ACCEPTED、RUNNING、FAILED、TIMEOUT 状态下不返回或为空。 |
curl --location "https://operator.las.cn-beijing.volces.com/api/v1/poll" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer ${LAS_API_KEY}" \ --data @- <<EOF { "operator_id": "las_asr", "operator_version": "v2", "task_id": "xxxxx123ef24ea40546c-las-asr" } EOF
{ "metadata": { "task_id": "xxxxx123ef24ea40546c-las-asr", "task_status": "COMPLETED", "submit_time": "2026-07-21T16:04:06+08:00", "end_time": "2026-07-21T16:04:10+08:00", "business_code": "0", "error_msg": "", "request_id": "d204c21f5c7c8f8cfeb85d211b9c20ac" }, "data": { "audio_info": { "duration": 3575 }, "result": { "additions": { "duration": "3575" }, "text": "参观八达岭长城。", "utterances": [ { "additions": { "channel_id": "1" }, "confidence": 0, "end_time": 2320, "start_time": 640, "text": "参观八达岭长城。", "words": [ {"confidence": 0, "end_time": 920, "start_time": 640, "text": "参"}, {"confidence": 0, "end_time": 1120, "start_time": 920, "text": "观"}, {"confidence": 0, "end_time": 1440, "start_time": 1120, "text": "八"}, {"confidence": 0, "end_time": 1680, "start_time": 1440, "text": "达"}, {"confidence": 0, "end_time": 1880, "start_time": 1680, "text": "岭"}, {"confidence": 0, "end_time": 2080, "start_time": 1880, "text": "长"}, {"confidence": 0, "end_time": 2320, "start_time": 2080, "text": "城"} ] } ] } } }
HttpCode | 错误码 | 错误信息 | 说明 |
|---|---|---|---|
400 | Parameter.Invalid | The parameter is invalid. | 参数不合法 |
401 | Authorization.Missing | Missing Authorization. | 缺少鉴权 |
401 | ApiKey.Invalid | The api key is invalid. | API不合法 |
429 | Server.Busy | Server is Busy, please try again later. | 服务端繁忙限流 |
500 | Server.InternalError | 根据具体异常而定 | 业务异常 |
sensitive_words_filter 的值必须先序列化为 JSON 字符串,支持的敏感词过滤方式如下。
名称 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
system_reserved_filter | boolean | 否 | 是否使用系统敏感词库;匹配内容替换为 |
filter_with_empty | list of string | 否 | 需要替换为空字符串的自定义敏感词。 |
filter_with_signed | list of string | 否 | 需要替换为 |
配置示例如下。
{ "sensitive_words_filter": "{\"system_reserved_filter\":true,\"filter_with_empty\":[\"删除词\"],\"filter_with_signed\":[\"替换词\"]}" }
热词模式示例:
{ "corpus": { "context": "{\"hotwords\":[{\"word\":\"火山引擎\"},{\"word\":\"豆包语音\"}]}" } }
对话上下文模式示例:
{ "corpus": { "context": "{\"context_type\":\"dialog_ctx\",\"context_data\":[{\"text\":\"最新一轮对话\"},{\"text\":\"上一轮对话\"}]}" } }
输入列名 | 说明 |
|---|---|
audio_urls | 存放音频路径的列 |
audio_metas | 存放音频的元数据,Dict形式,支持language,codec,rate,bits,channel,format,corpus等参数 |
如参数没有默认值,则为必填参数
参数名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
api_key | str | LAS服务 API Key。 | |
endpoint | str or None | LAS服务 API Endpoint。 | |
version | str | v1 | LAS服务 API Version,默认值: "v1"。 |
operator_id | str | las_asr | LAS ASR服务ID,默认值: "las_asr"。 |
resource | str | bigasr | 进行ASR的资源类型,默认值: "bigasr"。可选值: "bigasr","seedasr"。 |
operator_version | str | v1 | LAS ASR服务版本,默认值: "v1"。 |
num_coroutines | int | 20 | 单个实例并发处理音频的最大数量,默认值: 20。 |
max_retries | int | 3 | 单次API请求最大重试次数,默认值:3。 |
enable_idempotent | bool | False | 用于判断是否重试处理数据,为True时,每次都会重新处理,默认值:False。 |
enable_punc | bool | False | 文本标点,将原始语音输出转换为带标点的形式,以提高文本的可读性,默认值:False。 |
enable_ddc | bool | False | 语义顺滑,旨在提高自动语音识别(ASR)结果的文本可读性和流畅性。这项技术通过删除或修改ASR结果中的不流畅部分,如停顿词、语气词、语义重复词等,使得文本更加易于阅读和理解,默认值:False。 |
enable_speaker_info | bool | False | 语音角色信息,开启后可返回说话人的信息,10人以内,效果较好,默认值:False。 |
enable_itn | bool | True | 文本规范化,将原始语音输出转换为书面形式,以提高文本的可读性,默认值:True。 |
enable_channel_split | bool | False | 语音分轨,开启后会在返回结果中使用channel_id标记,1为左声道,2为右声道,默认值:False。 |
enable_lid | bool | False | 语言识别,目前支持语种:中英文、上海话、闽南语,四川、陕西、粤语,开启后会在additions信息中使用lid_lang标记, 返回对应的语种标签,默认值:False。 |
show_speech_rate | bool | False | 语速信息,开启后会在分句additions信息中使用speech_rate标记,单位为 token/s,默认值:False。 |
show_volume | bool | False | 音量信息,开启后可在分句additions信息中使用volume标记,单位为 分贝,默认值:False。 |
下面的代码展示了如何使用 daft 运行算子将语音转换为文字。
from __future__ import annotations import logging import os import daft from daft import col from daft.las.functions.audio.audio_asr_las import LasAsrPoller, LasAsrSubmitter from daft.las.functions.udf import las_udf def configure_logging(): logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S.%s".format(), ) logging.getLogger("tracing.span").setLevel(logging.WARNING) logging.getLogger("daft_io.stats").setLevel(logging.WARNING) logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING) logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING) logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING) configure_logging() if __name__ == "__main__": # 需配置环境变量 LAS_API_KEY : LAS_API_KEY 通过在 LAS 服务页面上创建获取 las_api_key = os.getenv("LAS_API_KEY") endpoint = os.getenv("LAS_SERVICE_ENDPOINT", "https://operator.las.cn-beijing.volces.com") TOS_INPUT_DIR_URL = os.getenv("TOS_INPUT_DIR_URL", "las-cn-beijing-public-online.tos-cn-beijing.volces.com") samples = {"audio_path": [os.path.join(f"https://{TOS_INPUT_DIR_URL}", "public/shared_audio_dataset/参观八达岭长城。.wav")]} df = daft.from_pydict(samples) df = df.with_column( "task_id", las_udf( LasAsrSubmitter, construct_args={ "api_key": las_api_key, "max_retries": 10, "endpoint": endpoint, }, num_cpus=1, concurrency=1, batch_size=2, )(col("audio_path")), ) df = df.with_column( "asr_result", las_udf( LasAsrPoller, construct_args={ "api_key": las_api_key, "endpoint": endpoint, }, num_cpus=1, concurrency=1, batch_size=2, )(col("audio_path"), col("task_id")), ).exclude("task_id") df = df.with_columns( { "asr_result_raw": col("asr_result")["asr_result_raw"], "asr_result_text": col("asr_result")["asr_result_text"], "failed_reason": col("asr_result")["failed_reason"], } ).exclude("asr_result") df.show() # ╭────────────────────────────────┬────────────────────────────────┬──────────────────┬───────────────╮ # │ audio_path ┆ asr_result_raw ┆ asr_result_text ┆ failed_reason │ # │ --- ┆ --- ┆ --- ┆ --- │ # │ String ┆ String ┆ String ┆ String │ # ╞════════════════════════════════╪════════════════════════════════╪══════════════════╪═══════════════╡ # │ https://las-cn-beijing-public… ┆ {"additions": {"duration": "3… ┆ 参观八达岭长城。 ┆ None │ # ╰────────────────────────────────┴────────────────────────────────┴──────────────────┴───────────────╯