Skip to main content
专项模型

音频理解(Qwen3-Omni-Captioner)

Qwen3-Omni-Captioner是以千问3-Omni为基座的开源模型,无需任何提示,自动为复杂语音、环境声、音乐、影视声效等生成精准、全面的描述,能识别说话人的情绪、音乐元素(如风格、乐器)、敏感信息等,适用于音频内容分析、安全审核、意图识别、音频剪辑等多个领域。当前模型不支持音色、音调、语气语调等细粒度声学特征分析。

支持的模型

  • 华北2(北京)
  • 新加坡

模型名称

上下文长度

最大输入

最大输出

输入成本

输出成本

免费额度

(注)

(Token数)

(每百万Token)

qwen3-omni-30b-a3b-captioner

65,536

32,768

32,768

15.8元

12.7元

100万Token

有效期:阿里云百炼开通后90天内

音频转换为Token的规则:总 Tokens 数 = 音频时长(单位:秒)* 12.5,若音频时长不足1秒,则按 1 秒计算。

快速开始

前提条件 Qwen3-Omni-Captioner模型仅支持通过API调用,暂不支持在阿里云百炼的控制台在线体验。 以下是理解在线音频(通过URL指定,非本地音频)的示例代码。了解如何传入本地文件音频文件的限制
  • OpenAI兼容
  • DashScope
  • Python
  • Node.js
  • curl
import os
from openai import OpenAI

client = OpenAI(
    # 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:api_key="sk-xxx",
    # 新加坡和北京地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下为华北2(北京)地域的URL,调用时请将WorkspaceId替换为真实的业务空间ID,各地域的URL不同。
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-30b-a3b-captioner",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240916/xvappi/%E8%A3%85%E4%BF%AE%E5%99%AA%E9%9F%B3.wav"
                    }
                }
            ]
        }
    ]
)
print(completion.choices[0].message.content)
The audio clip begins with a sudden, loud, metallic clanking that dominates the soundstage, immediately indicating an industrial or workshop environment. The clanking is rhythmic, consistent, and has a sharp, resonant quality, suggestive of metal tools striking metal surfaces—likely a hammer, wrench, or similar instrument being used on a hard metal object. The sound is harsh and slightly distorted, with audible clipping on each impact, likely due to the microphone’s proximity and the high volume of the sound.
As the initial clanking fades, a male voice enters, speaking in Mandarin Chinese with a tone of exasperation and complaint. His voice is clear, close-mic’d, and free from distortion. He says: “哎呀,这样我还怎么安静工作啊?” (“Oh my, how can I possibly work quietly like this?”). His intonation is conversational, informal, and marked by a rising, questioning inflection, typical of everyday speech rather than performance or formal address. The accent is standard Putonghua, with no strong regional markers, suggesting he is a native Mandarin speaker from the northern or central regions of China.
During the speaker’s utterance, the metallic clanking resumes, overlapping with his voice. The timing and nature of these sounds indicate the speaker is directly reacting to the ongoing noise—likely caused by another person in the same space. The environment is acoustically “dry” with minimal echo, implying a small or medium-sized room with sound-absorbing materials, further supporting the workshop or industrial setting. There are no other background noises, music, or ambient sounds, and no evidence of a public or commercial space.
The recording quality is moderate: the microphone captures both the low-end thuds and the sharp metallic transients, but the loud clanking causes digital clipping, resulting in a harsh, “crunchy” distortion during the impacts. The speaker’s voice, however, remains clear and intelligible. The overall impression is of a candid, real-world interaction—possibly a worker or office employee complaining about an interruption in a noisy environment.
In summary, the audio depicts a Mandarin-speaking man in a workshop or industrial setting, reacting with frustration to ongoing metallic clanking that disrupts his work. The recording is informal, clear, and grounded in a context of manual labor or technical work, with no evidence of scripted performance, music, or extraneous activity.

工作方式

  • 单轮交互:模型不支持多轮对话。每次请求都是一次独立的分析任务。
  • 固定任务:模型的核心任务是生成音频描述(仅为英文描述),无法通过指令(如 System Message)改变其行为,例如控制输出格式或内容重点。
  • 仅支持音频输入:模型仅接收音频作为输入,无需传入文本提示,message参数格式固定。
    messages=[
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_audio",
                        "input_audio": {
                            "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240916/xvappi/%E8%A3%85%E4%BF%AE%E5%99%AA%E9%9F%B3.wav"
                        }
                    }
                ]
            }
        ]
    

流式输出

大模型接收到输入后,会逐步生成中间结果,最终结果由这些中间结果拼接而成。这种一边生成一边输出中间结果的方式称为流式输出。采用流式输出时,您可以在模型进行输出的同时阅读,减少等待模型回复的时间。
  • OpenAI兼容
  • DashScope
通过 OpenAI 兼容方式开启流式输出十分方便,只需在请求参数中设置stream参数为true即可。
Python
import os
from openai import OpenAI

# 初始化OpenAI客户端
client = OpenAI(
    # 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:api_key="sk-xxx",
    # 新加坡和北京地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下为华北2(北京)地域的URL,调用时请将WorkspaceId替换为真实的业务空间ID,各地域的URL不同。
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-30b-a3b-captioner",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240916/xvappi/%E8%A3%85%E4%BF%AE%E5%99%AA%E9%9F%B3.wav"
                    }
                }
            ]
        }
    ],
    stream=True,
    stream_options={"include_usage": True},

)
for chunk in completion:
    # 如果stream_options.include_usage为True,则最后一个chunk的choices字段为空列表,需要跳过(可以通过chunk.usage获取 Token 使用量)
    if chunk.choices and chunk.choices[0].delta.content != "":
        print(chunk.choices[0].delta.content,end="")

传入本地文件(Base64 编码或文件路径)

模型提供两种本地文件上传方式:
  • Base64 编码上传
  • 文件路径直接上传(传输更稳定,推荐方式
上传方式:
  • 文件路径传入
  • Base64 编码传入
直接向模型传入文件路径。仅 DashScope Python 和 Java SDK 支持,不支持 HTTP 方式。请您参考下表,结合您的编程语言与操作系统指定文件的路径。

指定文件的路径

系统

SDK

传入的文件路径

示例

Linux或macOS系统

Python SDK

file://{文件的绝对路径}

file:///home/images/test.mp3

Java SDK

Windows系统

Python SDK

file://{文件的绝对路径}

file://D:/images/test.mp3

Java SDK

file:///{文件的绝对路径}

file:///D:/images/test.mp3

使用限制:
  • 建议优先选择文件路径上传(传输更稳定),1MB以下的文件也可使用 Base64 编码;
  • 直接传入文件路径时,音频本身需小于 10MB;
  • Base64编码方式传入时,由于 Base64 编码会增加数据体积,需保证编码后的 Base64 字符串需小于 10MB。
  • 文件路径传入
  • Base64 编码传入
传入文件路径仅支持 DashScope Python 和 Java SDK方式调用,不支持 HTTP 方式。
Python
import os
import dashscope

# 以下为华北2(北京)地域的URL,调用时请将WorkspaceId替换为真实的业务空间ID,各地域的URL不同。
dashscope.base_http_api_url = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1"

# 将 ABSOLUTE_PATH/welcome.mp3 替换为本地音频的绝对路径,
# 本地文件的完整路径必须以 file:// 为前缀,以保证路径的合法性,例如:file:///home/images/test.mp3
audio_file_path = "file://ABSOLUTE_PATH/welcome.mp3"
messages = [
    {
        "role": "user",
        # 在 audio 参数中传入以 file:// 为前缀的文件路径
        "content": [{"audio": audio_file_path}],
    }
]

response = dashscope.MultiModalConversation.call(
            # 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
            # 新加坡和北京地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
            api_key=os.getenv('DASHSCOPE_API_KEY'),
            model="qwen3-omni-30b-a3b-captioner",
            messages=messages)
print("输出结果为:")
print(response["output"]["choices"][0]["message"].content[0]["text"])

API参考

关于千问3-Omni-Captioner的输入输出参数,请参见文本生成

错误码

如果模型调用失败并返回报错信息,请参见错误码进行解决。

常见问题

如何压缩音频文件到满足要求的大小?

  • 在线工具:使用 Compresss 等在线工具压缩音频文件。
  • 代码实现:使用FFmpeg工具,更多用法请参见FFmpeg官网
# 基础转换命令(万能模板)
# -i,作用:输入文件路径,常用值示例:input.mp3

# -b:a,作用: 设置音频比特率 ,
  # 一般取值有64kbps(低质量,适合语音、低带宽流媒体)、128k(中等质量,适合日常音频、播客)、192kbps(高质量,适合音乐、广播)
  # 比特率越高,音质越好,文件体积越大

# -ar,作用:设置音频采样率,表示每秒采样的次数,
 # 一般取值为8000Hz、22050Hz、44100 Hz(标准采样率)
 # 采样率越高,文件体积越大

# -ac,作用:设置音频通道数。一般取值有 1(单声道),2(立体声),单声道文件体积更小

# -y,作用:覆盖已存在文件(无需值)# output.mp3,作用:输出文件路径

ffmpeg -i input.mp3 -b:a 128k -ar 44100 -ac 1 output.mp3 -y

限制

模型对音频文件的限制如下:
  • 时长限制:时长需小于或等于 40 分钟
  • 文件数量:每次请求仅支持1个音频文件
  • 文件格式:支持AMR、 WAV(CodecID: GSM_MS)、 WAV(PCM)、 3GP、 3GPP、 AAC、 MP3等主流格式
  • 文件输入方式:公网可访问的音频URL、 Base64 编码、本地文件路径
  • 文件大小:
    • 公网URL传入:不超过 1GB
    • 传入文件路径:音频本身需小于 10MB
    • Base64编码传入:需确保编码后 Base64 字符串小于 10MB,详情请参见如何传入本地文件
    如需压缩文件请参见如何压缩音频文件到满足要求的大小?
Token Plan
模型调优
模型压缩目录节点
用量统计与性能监控
资产中心
服务支持