Skip to main content
Modelos especializados

Compreensão de áudio (Qwen3-Omni-Captioner)

O Qwen3-Omni-Captioner é um modelo de código aberto baseado no Qwen3-Omni. Ele gera automaticamente descrições precisas e abrangentes para áudios complexos — fala, sons ambientes, música e efeitos sonoros — sem necessidade de prompts. O modelo identifica emoções do falante, elementos musicais (estilo, instrumentos) e informações sensíveis. É ideal para análise de conteúdo de áudio, auditorias de segurança, reconhecimento de intenção e edição de vídeo.

Modelos compatíveis

  • Singapore
  • China (Beijing)

Modelo

Janela de contexto

Entrada máx.

Saída máx.

Custo de entrada

Custo de saída

Cota gratuita

(Nota)

(tokens)

(por 1M tokens)

qwen3-omni-30b-a3b-captioner

65.536

32.768

32.768

$3,81

$3,06

1 milhão de tokens

Válido por 90 dias após a ativação do Model Studio

Regra de conversão de tokens para áudio: Total de tokens = Duração do áudio (em segundos) × 12,5 . Se a duração do áudio for inferior a um segundo, o sistema a contabilizará como um segundo.

Primeiros passos

Pré-requisitos O Qwen3-Omni-Captioner aceita apenas chamadas de API. Não há suporte para testes online no console do Model Studio. Estes exemplos de código analisam áudio online via URL, e não arquivos locais. Saiba como passar arquivos locais e consulte os limites de arquivos de áudio.
  • OpenAI compatible
  • DashScope
  • Python
  • Node.js
  • curl
import os
from openai import OpenAI

client = OpenAI(
    # API keys differ by region. To get an API key, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. For Beijing, use the URL shown in the China (Beijing) tab.
    base_url="https://{WorkspaceId}.ap-southeast-1.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.

Como funciona

  • Interação de turno único: Cada solicitação constitui uma tarefa de análise independente. Não há suporte para conversas com múltiplos turnos.
  • Tarefa fixa: O modelo gera descrições de áudio apenas em inglês. Não é possível usar instruções (como mensagens de sistema) para alterar o comportamento, o formato de saída ou o foco do conteúdo.
  • Apenas entrada de áudio: O modelo aceita somente áudio. Prompts de texto são desnecessários. O formato do parâmetro message é fixo.
    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"
                        }
                    }
                ]
            }
        ]
    

Saída em streaming

A saída em streaming gera resultados intermediários passo a passo e os retorna simultaneamente, permitindo a leitura das respostas durante a geração. Isso reduz o tempo de espera.
  • OpenAI compatible
  • DashScope
Defina stream como true para ativar a saída em streaming.
Python
import os
from openai import OpenAI

client = OpenAI(
    # API keys for the Singapore and Beijing regions are different. To obtain an API key, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. For Beijing, use the URL shown in the China (Beijing) tab.
    base_url="https://{WorkspaceId}.ap-southeast-1.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:
    # If stream_options.include_usage is True, the choices field of the last chunk is an empty list and should be skipped. You can get the token usage from chunk.usage.
    if chunk.choices and chunk.choices[0].delta.content != "":
        print(chunk.choices[0].delta.content,end="")

Passar arquivo local (codificação Base64 ou caminho do arquivo)

Há dois métodos disponíveis para enviar arquivos locais:
  • Usar codificação Base64
  • Caminho direto do arquivo (Recomendado para maior estabilidade na transmissão)
Métodos de envio:
  • Pass by file path
  • Pass by Base64 encoding
Passe o caminho do arquivo diretamente para o modelo. Este recurso tem suporte apenas nos SDKs Python e Java do DashScope, sem compatibilidade com HTTP. Consulte a tabela abaixo para verificar o formato do caminho conforme a linguagem e o sistema operacional.

Sistema

SDK

Caminho do arquivo de entrada

Exemplo

Linux ou macOS

SDK Python

file://{absolute_path_of_the_file}

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

SDK Java

Sistema operacional Windows

SDK Python

file://{absolute_path_of_the_file}

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

SDK Java

file:///{absolute_path_of_the_file}

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

Limites:
  • Recomenda-se passar o caminho do arquivo diretamente para garantir maior estabilidade na transmissão. Para arquivos menores que 1 MB, a codificação Base64 também funciona adequadamente.
  • Ao utilizar o caminho do arquivo, o áudio deve ter menos de 10 MB.
  • No uso de Base64, a string codificada não pode exceder 10 MB. Atenção: a codificação Base64 aumenta o tamanho do arquivo.
  • Pass by file path
  • Pass by Base64 encoding
O envio por caminho de arquivo tem suporte apenas nos SDKs Python e Java do DashScope, sem compatibilidade com HTTP.
Python
import dashscope
import os

# The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. For Beijing, use the URL shown in the China (Beijing) tab.
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

# Replace ABSOLUTE_PATH/welcome.mp3 with the absolute path of your local audio file.
# The full path of the local file must be prefixed with file:// to ensure a valid path, for example: file:///home/images/test.mp3
audio_file_path = "file://ABSOLUTE_PATH/welcome.mp3"
messages = [
    {
        "role": "user",
        # Pass the file path prefixed with file:// in the audio parameter.
        "content": [{"audio": audio_file_path}],
    }
]

response = dashscope.MultiModalConversation.call(
    # API keys differ by region. To get an API key, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    # If you have not configured the environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
    api_key=os.getenv('DASHSCOPE_API_KEY'),
    model="qwen3-omni-30b-a3b-captioner",
    messages=messages)

print("Output:")
print(response["output"]["choices"][0]["message"].content[0]["text"])

Referência da API

Para consultar os parâmetros do Qwen3-Omni-Captioner, veja Geração de texto.

Códigos de erro

Se a chamada do modelo falhar e retornar uma mensagem de erro, consulte Códigos de erro para resolver o problema.

Perguntas frequentes

  • Ferramentas online: Utilize ferramentas como o Compresss para compactar o áudio.
  • Implementação via código: Use o FFmpeg. Para detalhes de uso, consulte o site oficial do FFmpeg.
# Basic conversion command (universal template)
# -i: Specifies the input file path. Example: input.mp3

# -b:a: Sets the audio bitrate.
  # Common values: 64 kbps (low quality, for voice and low-bandwidth streaming), 128k (medium quality, for general audio and podcasts), 192 kbps (high quality, for music and broadcasting).
  # A higher bitrate results in better audio quality and a larger file size.

# -ar: Sets the audio sample rate, which is the number of samples per second.
 # Common values: 8000 Hz, 22050 Hz, 44100 Hz (standard sample rate).
 # A higher sample rate results in a larger file size.

# -ac: Sets the number of audio channels. Common values: 1 (mono), 2 (stereo). Mono files are smaller.

# -y: Overwrites the output file if it exists (no value needed). # output.mp3: Specifies the output file path.

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

Limitações

Limites para arquivos de áudio:
  • Duração: Até 40 minutos.
  • Quantidade de arquivos: Apenas um arquivo de áudio por solicitação.
  • Formatos de arquivo: AMR, WAV (CodecID: GSM_MS), WAV (PCM), 3GP, 3GPP, AAC e MP3.
  • Métodos de entrada de arquivo: URL pública, codificação Base64 ou caminho de arquivo local.
  • Tamanho do arquivo:
    • URL pública: No máximo 1 GB.
    • Caminho do arquivo: O áudio deve ser menor que 10 MB.
    • Codificação Base64: A string Base64 codificada deve ser menor que 10 MB. Para mais informações, consulte Passar arquivo local.
    Para compactar um arquivo, consulte Como comprimir um arquivo de áudio para o tamanho exigido?
Plano de Tokens
Inferência do Modelo
Avaliação
Compressão de Modelos
Estatísticas e Monitoramento
Suporte