全部產品
Search
文件中心

Alibaba Cloud Model Studio:全模態(Qwen-Omni)

更新時間:Dec 05, 2025

Qwen-Omni 模型能夠接收文本與單一其他模態(圖片、音頻、視頻)的組合輸入,並產生文本或語音形式的回複, 提供多種擬人音色,支援多語言和方言的語音輸出,可應用於文本創作、視覺識別、語音助手等情境。

快速開始

前提條件

調用方式:Qwen-Omni 目前僅支援以流式輸出的方式進行調用,stream參數必須設定為True,否則會報錯。

以下樣本將一段文本發送至 Qwen-Omni的API介面,併流式返迴文本和音訊回複。

import os
import base64
import soundfile as sf
import numpy as np
from openai import OpenAI

# 1. 初始化用戶端
client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),  # 確認已配置環境變數
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

# 2. 發起請求
try:
    completion = client.chat.completions.create(
        model="qwen3-omni-flash",
        messages=[{"role": "user", "content": "你是誰"}],
        modalities=["text", "audio"],  # 指定輸出文本和音頻
        audio={"voice": "Cherry", "format": "wav"},
        stream=True,  # 必須設定為 True
        stream_options={"include_usage": True},
    )

    # 3. 處理流式響應並解碼音頻
    print("模型回複:")
    audio_base64_string = ""
    for chunk in completion:
        # 處理文本部分
        if chunk.choices and chunk.choices[0].delta.content:
            print(chunk.choices[0].delta.content, end="")

        # 收集音頻部分
        if chunk.choices and hasattr(chunk.choices[0].delta, "audio") and chunk.choices[0].delta.audio:
            audio_base64_string += chunk.choices[0].delta.audio.get("data", "")

    # 4. 儲存音頻檔案
    if audio_base64_string:
        wav_bytes = base64.b64decode(audio_base64_string)
        audio_np = np.frombuffer(wav_bytes, dtype=np.int16)
        sf.write("audio_assistant.wav", audio_np, samplerate=24000)
        print("\n音頻檔案已儲存至:audio_assistant.wav")

except Exception as e:
    print(f"請求失敗: {e}")
// 運行前的準備工作:
// Windows/Mac/Linux 通用:
// 1. 確保已安裝 Node.js (建議版本 >= 14)
// 2. 運行以下命令安裝必要的依賴:
//    npm install openai wav

import OpenAI from "openai";
import { createWriteStream } from 'node:fs';
import { Writer } from 'wav';

// 定義音頻轉換函式:將Base64字串轉換並儲存為標準的 WAV 音頻檔案
async function convertAudio(audioString, audioPath) {
    try {
        // 解碼Base64字串為Buffer
        const wavBuffer = Buffer.from(audioString, 'base64');
        // 建立WAV檔案寫入流
        const writer = new Writer({
            sampleRate: 24000,  // 採樣率
            channels: 1,        // 單聲道
            bitDepth: 16        // 16位元深度
        });
        // 建立輸出檔案流並建立管道串連
        const outputStream = createWriteStream(audioPath);
        writer.pipe(outputStream);

        // 寫入PCM資料並結束寫入
        writer.write(wavBuffer);
        writer.end();

        // 使用Promise等待檔案寫入完成
        await new Promise((resolve, reject) => {
            outputStream.on('finish', resolve);
            outputStream.on('error', reject);
        });

        // 添加額外等待時間確保音頻完整
        await new Promise(resolve => setTimeout(resolve, 800));

        console.log(`\n音頻檔案已成功儲存為 ${audioPath}`);
    } catch (error) {
        console.error('處理過程中發生錯誤:', error);
    }
}

//  1. 初始化用戶端
const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
// 2. 發起請求
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash",  
    messages: [
        {
            "role": "user",
            "content": "你是誰?"
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

let audioString = "";
console.log("大模型的回複:")

// 3. 處理流式響應並解碼音頻
for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        // 處理常值內容
        if (chunk.choices[0].delta.content) {
            process.stdout.write(chunk.choices[0].delta.content);
        }
        // 處理音頻內容
        if (chunk.choices[0].delta.audio) {
            if (chunk.choices[0].delta.audio["data"]) {
                audioString += chunk.choices[0].delta.audio["data"];
            }
        }
    }
}
// 4. 儲存音頻檔案
convertAudio(audioString, "audio_assistant.wav");
# ======= 重要提示 =======
# 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
# === 執行時請刪除該注釋 ===

curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen3-omni-flash",
    "messages": [
        {
            "role": "user", 
            "content": "你是誰?"
        }
    ],
    "stream":true,
    "stream_options":{
        "include_usage":true
    },
    "modalities":["text","audio"],
    "audio":{"voice":"Cherry","format":"wav"}
}'

返回結果

運行PythonNode.js代碼後,將在控制台看到模型的文本回複,並在代碼檔案目錄下找到一個名為audio_assistant.wav 的音頻檔案。

大模型的回複:
我是阿里雲研發的大規模語言模型,我叫通義千問。有什麼我可以協助你的嗎?

運行HTTP代碼將直接返迴文本和Base64編碼(audio欄位)的音頻資料。

data: {"choices":[{"delta":{"content":"我"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1757647879,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-a68eca3b-c67e-4666-a72f-73c0b4919860"}
data: {"choices":[{"delta":{"content":"是"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1757647879,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-a68eca3b-c67e-4666-a72f-73c0b4919860"}
......
data: {"choices":[{"delta":{"audio":{"data":"/v8AAAAAAAAAAAAAAA...","expires_at":1757647879,"id":"audio_a68eca3b-c67e-4666-a72f-73c0b4919860"}},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1757647879,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-a68eca3b-c67e-4666-a72f-73c0b4919860"}
data: {"choices":[{"finish_reason":"stop","delta":{"content":""},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1764763585,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-e8c82e9e-073e-4289-a786-a20eb444ac9c"}
data: {"choices":[],"object":"chat.completion.chunk","usage":{"prompt_tokens":207,"completion_tokens":103,"total_tokens":310,"completion_tokens_details":{"audio_tokens":83,"text_tokens":20},"prompt_tokens_details":{"text_tokens":207}},"created":1757940330,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-9cdd5a26-f9e9-4eff-9dcc-93a878165afc"}

模型列表

相比於 Qwen-VL 模型,Qwen-Omni 模型可以:

  • 理解視頻檔案中的視覺與音頻資訊;

  • 理解多種模態的資料;

  • 輸出音頻;

在視覺理解、音頻理解等能力上也表現出色。

建議優先使用Qwen3-Omni-Flash相較於Qwen-Omni-Turbo(後續不再更新),模型的能力得到大幅提升:

  • 支援思考模式和非思考模式,可通過 enable_thinking 參數實現兩種模式的切換,預設不開啟思考模式。

  • 在非思考模式下,對於模型輸出的音頻:

    • qwen3-omni-flash-2025-12-01支援的音色增加至49種,qwen3-omni-flash-2025-09-15、qwen3-omni-flash支援的音色種類增加至 17 種,Qwen-Omni-Turbo 僅支援 4 種;

    • 支援語言種類增加至 10 種,Qwen-Omni-Turbo 僅支援 2 種。

國際(新加坡)

商業版模型

相較於開源版,商業版模型具有最新的能力和改進。

模型名稱

版本

模式

上下文長度

最大輸入

最長思維鏈

最大輸出

免費額度

(注)

(Token數)

qwen3-omni-flash

當前與qwen3-omni-flash-2025-09-15能力相同

穩定版

思考模式

65,536

16,384

32,768

16,384

各100萬Token(不區分模態)

有效期間:百鍊開通後90天內

非思考模式

49,152

-

qwen3-omni-flash-2025-12-01

快照版

思考模式

65,536

16,384

32,768

16,384

非思考模式

49,152

-

qwen3-omni-flash-2025-09-15

又稱qwen3-omni-flash-0915

快照版

思考模式

65,536

16,384

32,768

16,384

非思考模式

49,152

-

更多模型

模型名稱

版本

上下文長度

最大輸入

最大輸出

免費額度

(注)

(Token數)

qwen-omni-turbo

當前與qwen-omni-turbo-2025-03-26能力相同

穩定版

32,768

30,720

2,048

各100萬Token(不區分模態)

有效期間:百鍊開通後90天內

qwen-omni-turbo-latest

始終與最新快照版
能力相同

最新版

qwen-omni-turbo-2025-03-26

又稱qwen-omni-turbo-0326

快照版

開源版模型

模型名稱

上下文長度

最大輸入

最大輸出

免費額度

(注)

(Token數)

qwen2.5-omni-7b

32,768

30,720

2,048

100萬Token(不區分模態)

有效期間:百鍊開通後90天內

中國大陸(北京)

商業版模型

模型名稱

版本

模式

上下文長度

最大輸入

最長思維鏈

最大輸出

免費額度

(注)

(Token數)

qwen3-omni-flash

當前與qwen3-omni-flash-2025-09-15能力相同

穩定版

思考模式

65,536

16,384

32,768

16,384

無免費額度

非思考模式

49,152

-

qwen3-omni-flash-2025-12-01

快照版

思考模式

65,536

16,384

32,768

16,384

非思考模式

49,152

-

qwen3-omni-flash-2025-09-15

又稱qwen3-omni-flash-0915

快照版

思考模式

65,536

16,384

32,768

16,384

非思考模式

49,152

-

更多模型

模型名稱

版本

上下文長度

最大輸入

最大輸出

免費額度

(注)

(Token數)

qwen-omni-turbo

當前與qwen-omni-turbo-2025-03-26能力相同

穩定版

32,768

30,720

2,048

無免費額度

qwen-omni-turbo-latest

始終與最新快照版
能力相同

最新版

qwen-omni-turbo-2025-03-26

又稱qwen-omni-turbo-0326

快照版

qwen-omni-turbo-2025-01-19

又稱qwen-omni-turbo-0119

開源版模型

模型名稱

上下文長度

最大輸入

最大輸出

免費額度

(注)

(Token數)

qwen2.5-omni-7b

32,768

30,720

2,048

無免費額度

使用方式

輸入

在單條 user 訊息中,content 數組可以包含文本和一種其他模態(圖片、音頻或視頻),不能同時包含多種。

輸出

  • 支援的輸出模態:其中輸出的音頻為Base64編碼資料,可參見解析輸出的Base 64 編碼的音頻資料將其換為音頻檔案。

    輸出模態

    modalities參數值

    回複風格

    文本

    ["text"](預設值)

    比較書面化,回複內容較為正式。

    文本+音頻

    ["text","audio"]

    Qwen3-Omni-Flash在思考模式下,不支援輸出音頻。

    比較口語化,回複內容包含語氣詞,會引導使用者與其進一步交流。

    Qwen-Omni-Turbo 在輸出模態包括音頻時不支援設定 System Message。
  • 支援輸出的音頻語言:

    • Qwen-Omni-Turbo僅支援漢語(普通話)和英語。

    • Qwen3-Omni-Flash(非思考模式):支援漢語(普通話,部分方言),英語,法語、德語、俄語、意語、西語、葡語、日語、韓語。

  • 支援的音色:輸出音訊音色與檔案格式通過audio參數來配置,如:audio={"voice": "Cherry", "format": "wav"}

    • 檔案格式(format):只支援設定為"wav"

    • 音頻音色(voice):各模型支援的音色可參見音色列表

限制

  • 必須使用流式輸出:所有對 Qwen-Omni 模型的請求都必須設定 stream=True

  • 僅 Qwen3-Omni-Flash 模型屬於混合思考模型,調用方法請參見開啟/關閉思考模式,在思考模式下,不支援輸出音頻。

開啟/關閉思考模式

Qwen3-Omni-Flash 模型屬於混合思考模型,通過enable_thinking參數控制是否開啟思考模式:

  • true:開啟思考模式

  • false(預設):關閉思考模式

Qwen-Omni-Turbo不屬于思考模型。

OpenAI 相容

import os
from openai import OpenAI

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-flash",
    messages=[{"role": "user", "content": "你是誰"}],

    # 開啟/關閉思考模式,在思考模式下不支援輸出音頻;qwen-omni-turbo不支援設定enable_thinking。
    extra_body={'enable_thinking': True},

    # 設定輸出資料的模態,非思考模式下當前支援兩種:["text","audio"]、["text"],思考模式僅支援:["text"]
    modalities=["text"],

    # 設定音色,思考模式下不支援設定audio參數
    # audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash",
    messages: [
        { role: "user", content: "你是誰?" }
    ],

    // stream 必須設定為 True,否則會報錯
    stream: true,
    stream_options: {
        include_usage: true
    },
    // 開啟/關閉思考模式,在思考模式下不支援輸出音頻;qwen-omni-turbo不支援設定enable_thinking。
    extra_body:{'enable_thinking': true},
    //  設定輸出資料的模態,非思考模式下當前支援兩種:["text","audio"]、["text"],思考模式僅支援:["text"]
    modalities: ["text"],
    // 設定音色,思考模式下不支援設定audio參數
    //audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}
# ======= 重要提示 =======
# 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
# === 執行時請刪除該注釋 ===

curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen3-omni-flash",
    "messages": [
        {
            "role": "user",
            "content": "你是誰?"
        }
    ],
    "stream":true,
    "stream_options":{
        "include_usage":true
    },
    "modalities":["text"],
    "enable_thinking": true
}'

返回結果

data: {"choices":[{"delta":{"content":null,"role":"assistant","reasoning_content":""},"index":0,"logprobs":null,"finish_reason":null}],"object":"chat.completion.chunk","usage":null,"created":1757937336,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-ce3d6fe5-e717-4b7e-8b40-3aef12288d4c"}
data: {"choices":[{"finish_reason":null,"logprobs":null,"delta":{"content":null,"reasoning_content":"嗯"},"index":0}],"object":"chat.completion.chunk","usage":null,"reated":1757937336,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-ce3d6fe5-e717-4b7e-8b40-3aef12288d4c"}
data: {"choices":[{"delta":{"content":null,"reasoning_content":","},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"reated":1757937336,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-ce3d6fe5-e717-4b7e-8b40-3aef12288d4c"}
......
data: {"choices":[{"delta":{"content":"告訴我"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1757937336,"tem_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-ce3d6fe5-e717-4b7e-8b40-3aef12288d4c"}
data: {"choices":[{"delta":{"content":"!"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1757937336,"systm_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-ce3d6fe5-e717-4b7e-8b40-3aef12288d4c"}
data: {"choices":[{"finish_reason":"stop","delta":{"content":"","reasoning_content":null},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1757937336,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-ce3d6fe5-e717-4b7e-8b40-3aef12288d4c"}
data: {"choices":[],"object":"chat.completion.chunk","usage":{"prompt_tokens":11,"completion_tokens":363,"total_tokens":374,"completion_tokens_details":{"reasoning_tokens":195,"text_tokens":168},"prompt_tokens_details":{"text_tokens":11}},"created":1757937336,"system_fingerprint":null,"model":"qwen3-omni-flash","id":"chatcmpl-ce3d6fe5-e717-4b7e-8b40-3aef12288d4c"}

圖片+文本輸入

Qwen-Omni 模型支援傳入多張圖片。對輸入圖片的要求如下:

  • 單個圖片檔案的大小不超過10 MB;

  • 圖片數量受模型圖文總 Token 上限(即最大輸入)的限制,所有圖片的總 Token 數必須小於模型的最大輸入;

  • 圖片的寬度和高度均應大於10像素,寬高比不應超過200:1或1:200;

  • 支援的圖片類型請參見視覺理解

以下範例程式碼以傳入圖片公網 URL 為例,傳入本地圖片請參見:輸入 Base 64 編碼的本地檔案。當前只支援以流式輸出的方式進行調用。

OpenAI 相容

import os
from openai import OpenAI

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"
                    },
                },
                {"type": "text", "text": "圖中描繪的是什麼景象?"},
            ],
        },
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={
        "include_usage": True
    }
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": [{
                "type": "image_url",
                "image_url": { "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg" },
            },
            { "type": "text", "text": "圖中描繪的是什麼景象?" }]
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}
# ======= 重要提示 =======
# 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
# === 執行時請刪除該注釋 ===


curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen3-omni-flash",
    "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "image_url",
          "image_url": {
            "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"
          }
        },
        {
          "type": "text",
          "text": "圖中描繪的是什麼景象?"
        }
      ]
    }
  ],
    "stream":true,
    "stream_options":{
        "include_usage":true
    },
    "modalities":["text","audio"],
    "audio":{"voice":"Cherry","format":"wav"}
}'

音頻+文本輸入

  • 僅支援輸入一個音頻檔案;

  • 檔案大小

    • Qwen3-Omni-Flash:不能超過  100MB,時間長度最長 20 分鐘。

    • Qwen-Omni-Turbo:不能超過 10MB,時間長度最長 3 分鐘。

以下範例程式碼以傳入音頻公網 URL 為例,傳入本地音頻請參見:輸入 Base 64 編碼的本地檔案。當前只支援以流式輸出的方式進行調用。

OpenAI 相容

import os
from openai import OpenAI

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-flash",# 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250211/tixcef/cherry.wav",
                        "format": "wav",
                    },
                },
                {"type": "text", "text": "這段音頻在說什麼"},
            ],
        },
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": [{
                "type": "input_audio",
                "input_audio": { "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250211/tixcef/cherry.wav", "format": "wav" },
            },
            { "type": "text", "text": "這段音頻在說什麼" }]
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}
# ======= 重要提示 =======
# 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
# === 執行時請刪除該注釋 ===

curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen3-omni-flash",
    "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_audio",
          "input_audio": {
            "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250211/tixcef/cherry.wav",
            "format": "wav"
          }
        },
        {
          "type": "text",
          "text": "這段音頻在說什麼"
        }
      ]
    }
  ],
    "stream":true,
    "stream_options":{
        "include_usage":true
    },
    "modalities":["text","audio"],
    "audio":{"voice":"Cherry","format":"wav"}
}'

視頻+文本輸入

視頻的傳入方式可以為圖片列表形式視頻檔案形式(可理解視頻中的音頻)

以下範例程式碼以傳入的視訊公網 URL 為例,傳入本地視頻請參見:輸入 Base 64 編碼的本地檔案。當前只支援以流式輸出的方式進行調用。

圖片列表形式

圖片數量

  • Qwen3-Omni-Flash:最少傳入 2 張圖片,最多可傳入 128 張圖片。

  • Qwen-Omni-Turbo:最少傳入 4 張圖片,最多可傳入 80 張圖片。

OpenAI 相容

import os
from openai import OpenAI

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "video",
                    "video": [
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/xzsgiz/football1.jpg",
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/tdescd/football2.jpg",
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/zefdja/football3.jpg",
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/aedbqh/football4.jpg",
                    ],
                },
                {"type": "text", "text": "描述這個視頻的具體過程"},
            ],
        }
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", //模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [{
        role: "user",
        content: [
            {
                type: "video",
                video: [
                    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/xzsgiz/football1.jpg",
                    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/tdescd/football2.jpg",
                    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/zefdja/football3.jpg",
                    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/aedbqh/football4.jpg"
                ]
            },
            {
                type: "text",
                text: "描述這個視頻的具體過程"
            }
        ]
    }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}
# ======= 重要提示 =======
# 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
# === 執行時請刪除該注釋 ===

curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen3-omni-flash",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "video",
                    "video": [
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/xzsgiz/football1.jpg",
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/tdescd/football2.jpg",
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/zefdja/football3.jpg",
                        "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/aedbqh/football4.jpg"
                    ]
                },
                {
                    "type": "text",
                    "text": "描述這個視頻的具體過程"
                }
            ]
        }
    ],
    "stream": true,
    "stream_options": {
        "include_usage": true
    },
    "modalities": ["text", "audio"],
    "audio": {
        "voice": "Cherry",
        "format": "wav"
    }
}'

視頻檔案形式(可理解視頻中的音頻)

  • 僅支援輸入一個視頻檔案;

  • 檔案大小:

    • Qwen3-Omni-Flash:限制為 256 MB,時間長度限制為 150s;

    • Qwen-Omni-Turbo:限制為 150 MB,時間長度限制為 40s;

  • 視頻檔案中的視覺資訊與音頻資訊會分開計費。

OpenAI 相容

import os
from openai import OpenAI

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241115/cqqkru/1.mp4"
                    },
                },
                {"type": "text", "text": "視頻的內容是什麼?"},
            ],
        },
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": [{
                "type": "video_url",
                "video_url": { "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241115/cqqkru/1.mp4" },
            },
            { "type": "text", "text": "視頻的內容是什麼?" }]
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});


for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}
# ======= 重要提示 =======
# 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
# === 執行時請刪除該注釋 ===

curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen3-omni-flash",
    "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "video_url",
          "video_url": {
            "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241115/cqqkru/1.mp4"
          }
        },
        {
          "type": "text",
          "text": "視頻的內容是什麼"
        }
      ]
    }
  ],
    "stream":true,
    "stream_options": {
        "include_usage": true
    },
    "modalities":["text","audio"],
    "audio":{"voice":"Cherry","format":"wav"}
}'

多輪對話

您在使用 Qwen-Omni 模型的多輪對話功能時,需要注意:

  • Assistant Message

    添加到 messages 數組中的 Assistant Message 只可以包含文本資料。

  • User Message

    一條 User Message 只可以包含文本和一種模態的資料,在多輪對話中您可以在不同的 User Message 中輸入不同模態的資料。

OpenAI 相容

import os
from openai import OpenAI

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/audios/welcome.mp3",
                        "format": "mp3",
                    },
                },
                {"type": "text", "text": "這段音頻在說什麼"},
            ],
        },
        {
            "role": "assistant",
            "content": [{"type": "text", "text": "這段音頻在說:歡迎使用阿里雲"}],
        },
        {
            "role": "user",
            "content": [{"type": "text", "text": "介紹一下這家公司?"}],
        },
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text"],
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": [
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/audios/welcome.mp3",
                        "format": "mp3",
                    },
                },
                { "type": "text", "text": "這段音頻在說什麼" },
            ],
        },
        {
            "role": "assistant",
            "content": [{ "type": "text", "text": "這段音頻在說:歡迎使用阿里雲" }],
        },
        {
            "role": "user",
            "content": [{ "type": "text", "text": "介紹一下這家公司?" }]
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text"]
});


for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}
# ======= 重要提示 =======
# 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
# === 執行時請刪除該注釋 ===

curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "model": "qwen3-omni-flash",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_audio",
          "input_audio": {
            "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/audios/welcome.mp3"
          }
        },
        {
          "type": "text",
          "text": "這段音頻在說什麼"
        }
      ]
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "text",
          "text": "這段音頻在說:歡迎使用阿里雲"
        }
      ]
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "介紹一下這家公司?"
        }
      ]
    }
  ],
  "stream": true,
  "stream_options": {
    "include_usage": true
  },
  "modalities": ["text"]
}'

解析輸出的Base 64 編碼的音頻資料

Qwen-Omni 模型輸出的音頻為流式輸出的 Base 64 編碼資料。您可以在模型產生過程中維護一個字串變數,將每個返回片段的 Base 64 編碼添加到字串變數後,待產生結束後進行 Base64 解碼,得到音頻檔案;也可以將每個返回片段的 Base 64 編碼資料即時解碼並播放。

# Installation instructions for pyaudio:
# APPLE Mac OS X
#   brew install portaudio
#   pip install pyaudio
# Debian/Ubuntu
#   sudo apt-get install python-pyaudio python3-pyaudio
#   or
#   pip install pyaudio
# CentOS
#   sudo yum install -y portaudio portaudio-devel && pip install pyaudio
# Microsoft Windows
#   python -m pip install pyaudio

import os
from openai import OpenAI
import base64
import numpy as np
import soundfile as sf

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[{"role": "user", "content": "你是誰"}],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

# 方式1: 待產生結束後再進行解碼
audio_string = ""
for chunk in completion:
    if chunk.choices:
        if hasattr(chunk.choices[0].delta, "audio"):
            try:
                audio_string += chunk.choices[0].delta.audio["data"]
            except Exception as e:
                print(chunk.choices[0].delta.content)
    else:
        print(chunk.usage)

wav_bytes = base64.b64decode(audio_string)
audio_np = np.frombuffer(wav_bytes, dtype=np.int16)
sf.write("audio_assistant_py.wav", audio_np, samplerate=24000)

# 方式2: 邊產生邊解碼(使用方式2請將方式1的代碼進行注釋)
# # 初始化 PyAudio
# import pyaudio
# import time
# p = pyaudio.PyAudio()
# # 建立音頻流
# stream = p.open(format=pyaudio.paInt16,
#                 channels=1,
#                 rate=24000,
#                 output=True)

# for chunk in completion:
#     if chunk.choices:
#         if hasattr(chunk.choices[0].delta, "audio"):
#             try:
#                 audio_string = chunk.choices[0].delta.audio["data"]
#                 wav_bytes = base64.b64decode(audio_string)
#                 audio_np = np.frombuffer(wav_bytes, dtype=np.int16)
#                 # 直接播放音頻資料
#                 stream.write(audio_np.tobytes())
#             except Exception as e:
#                 print(chunk.choices[0].delta.content)

# time.sleep(0.8)
# # 清理資源
# stream.stop_stream()
# stream.close()
# p.terminate()
// 運行前的準備工作:
// Windows/Mac/Linux 通用:
// 1. 確保已安裝 Node.js (建議版本 >= 14)
// 2. 運行以下命令安裝必要的依賴:
//    npm install openai wav
// 
// 如果要使用即時播放功能 (方式2), 還需要:
// Windows:
//    npm install speaker
// Mac:
//    brew install portaudio
//    npm install speaker
// Linux (Ubuntu/Debian):
//    sudo apt-get install libasound2-dev
//    npm install speaker

import OpenAI from "openai";

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": "你是誰?"
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

// 方式1: 待產生結束後再進行解碼
// 需要安裝: npm install wav
import { createWriteStream } from 'node:fs';  // node:fs 是 Node.js 內建模組,無需安裝
import { Writer } from 'wav';

async function convertAudio(audioString, audioPath) {
    try {
        // 解碼Base64字串為Buffer
        const wavBuffer = Buffer.from(audioString, 'base64');
        // 建立WAV檔案寫入流
        const writer = new Writer({
            sampleRate: 24000,  // 採樣率
            channels: 1,        // 單聲道
            bitDepth: 16        // 16位元深度
        });
        // 建立輸出檔案流並建立管道串連
        const outputStream = createWriteStream(audioPath);
        writer.pipe(outputStream);

        // 寫入PCM資料並結束寫入
        writer.write(wavBuffer);
        writer.end();

        // 使用Promise等待檔案寫入完成
        await new Promise((resolve, reject) => {
            outputStream.on('finish', resolve);
            outputStream.on('error', reject);
        });

        // 添加額外等待時間確保音頻完整
        await new Promise(resolve => setTimeout(resolve, 800));

        console.log(`音頻檔案已成功儲存為 ${audioPath}`);
    } catch (error) {
        console.error('處理過程中發生錯誤:', error);
    }
}

let audioString = "";
for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        if (chunk.choices[0].delta.audio) {
            if (chunk.choices[0].delta.audio["data"]) {
                audioString += chunk.choices[0].delta.audio["data"];
            }
        }
    } else {
        console.log(chunk.usage);
    }
}
// 執行轉換
convertAudio(audioString, "audio_assistant_mjs.wav");


// 方式2: 邊產生邊即時播放
// 需要先按照上方系統對應的說明安裝必要組件
// import Speaker from 'speaker'; // 引入音頻播放庫

// // 建立擴音器執行個體(配置與 WAV 檔案參數一致)
// const speaker = new Speaker({
//     sampleRate: 24000,  // 採樣率
//     channels: 1,        // 聲道數
//     bitDepth: 16,       // 位深
//     signed: true        // 有符號 PCM
// });
// for await (const chunk of completion) {
//     if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
//         if (chunk.choices[0].delta.audio) {
//             if (chunk.choices[0].delta.audio["data"]) {
//                 const pcmBuffer = Buffer.from(chunk.choices[0].delta.audio.data, 'base64');
//                 // 直接寫入擴音器播放
//                 speaker.write(pcmBuffer);
//             }
//         }
//     } else {
//         console.log(chunk.usage);
//     }
// }
// speaker.on('finish', () => console.log('播放完成'));
// speaker.end(); // 根據實際 API 流結束情況調用

輸入 Base 64 編碼的本地檔案

圖片

以儲存在本地的eagle.png為例。

import os
from openai import OpenAI
import base64

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)


#  Base 64 編碼格式
def encode_image(image_path):
    with open(image_path, "rb") as image_file:
        return base64.b64encode(image_file.read()).decode("utf-8")


base64_image = encode_image("eagle.png")

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {"url": f"data:image/png;base64,{base64_image}"},
                },
                {"type": "text", "text": "圖中描繪的是什麼景象?"},
            ],
        },
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";
import { readFileSync } from 'fs';

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);

const encodeImage = (imagePath) => {
    const imageFile = readFileSync(imagePath);
    return imageFile.toString('base64');
};
const base64Image = encodeImage("eagle.png")

const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash",// 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": [{
                "type": "image_url",
                "image_url": { "url": `data:image/png;base64,${base64Image}` },
            },
            { "type": "text", "text": "圖中描繪的是什麼景象?" }]
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}

音頻

以儲存在本地的welcome.mp3為例。

import os
from openai import OpenAI
import base64
import numpy as np
import soundfile as sf
import requests

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)


def encode_audio(audio_path):
    with open(audio_path, "rb") as audio_file:
        return base64.b64encode(audio_file.read()).decode("utf-8")


base64_audio = encode_audio("welcome.mp3")

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": f"data:;base64,{base64_audio}",
                        "format": "mp3",
                    },
                },
                {"type": "text", "text": "這段音頻在說什麼"},
            ],
        },
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";
import { readFileSync } from 'fs';

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);

const encodeAudio = (audioPath) => {
    const audioFile = readFileSync(audioPath);
    return audioFile.toString('base64');
};
const base64Audio = encodeAudio("welcome.mp3")

const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": [{
                "type": "input_audio",
                "input_audio": { "data": `data:;base64,${base64Audio}`, "format": "mp3" },
            },
            { "type": "text", "text": "這段音頻在說什麼" }]
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}

視頻

視頻檔案

以儲存在本地的spring_mountain.mp4為例。

import os
from openai import OpenAI
import base64
import numpy as np
import soundfile as sf

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

#  Base 64 編碼格式
def encode_video(video_path):
    with open(video_path, "rb") as video_file:
        return base64.b64encode(video_file.read()).decode("utf-8")


base64_video = encode_video("spring_mountain.mp4")

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "video_url",
                    "video_url": {"url": f"data:;base64,{base64_video}"},
                },
                {"type": "text", "text": "她在唱什麼"},
            ],
        },
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";
import { readFileSync } from 'fs';

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);

const encodeVideo = (videoPath) => {
    const videoFile = readFileSync(videoPath);
    return videoFile.toString('base64');
};
const base64Video = encodeVideo("spring_mountain.mp4")

const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [
        {
            "role": "user",
            "content": [{
                "type": "video_url",
                "video_url": { "url": `data:;base64,${base64Video}` },
            },
            { "type": "text", "text": "她在唱什麼" }]
        }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }
}

圖片列表

以儲存在本地的football1.jpgfootball2.jpgfootball3.jpgfootball4.jpg為例。

import os
from openai import OpenAI
import base64
import numpy as np
import soundfile as sf

client = OpenAI(
    # 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)


#  Base 64 編碼格式
def encode_image(image_path):
    with open(image_path, "rb") as image_file:
        return base64.b64encode(image_file.read()).decode("utf-8")


base64_image_1 = encode_image("football1.jpg")
base64_image_2 = encode_image("football2.jpg")
base64_image_3 = encode_image("football3.jpg")
base64_image_4 = encode_image("football4.jpg")

completion = client.chat.completions.create(
    model="qwen3-omni-flash", # 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "video",
                    "video": [
                        f"data:image/jpeg;base64,{base64_image_1}",
                        f"data:image/jpeg;base64,{base64_image_2}",
                        f"data:image/jpeg;base64,{base64_image_3}",
                        f"data:image/jpeg;base64,{base64_image_4}",
                    ],
                },
                {"type": "text", "text": "描述這個視頻的具體過程"},
            ],
        }
    ],
    # 設定輸出資料的模態,當前支援兩種:["text","audio"]、["text"]
    modalities=["text", "audio"],
    audio={"voice": "Cherry", "format": "wav"},
    # stream 必須設定為 True,否則會報錯
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in completion:
    if chunk.choices:
        print(chunk.choices[0].delta)
    else:
        print(chunk.usage)
import OpenAI from "openai";
import { readFileSync } from 'fs';

const openai = new OpenAI(
    {
        // 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
        apiKey: process.env.DASHSCOPE_API_KEY,
        // 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/compatible-mode/v1
        baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
    }
);

const encodeImage = (imagePath) => {
    const imageFile = readFileSync(imagePath);
    return imageFile.toString('base64');
  };
const base64Image1 = encodeImage("football1.jpg")
const base64Image2 = encodeImage("football2.jpg")
const base64Image3 = encodeImage("football3.jpg")
const base64Image4 = encodeImage("football4.jpg")

const completion = await openai.chat.completions.create({
    model: "qwen3-omni-flash", // 模型為Qwen3-Omni-Flash時,請在非思考模式下運行
    messages: [{
        role: "user",
        content: [
            {
                type: "video",
                video: [
                    `data:image/jpeg;base64,${base64Image1}`,
                    `data:image/jpeg;base64,${base64Image2}`,
                    `data:image/jpeg;base64,${base64Image3}`,
                    `data:image/jpeg;base64,${base64Image4}`
                ]
            },
            {
                type: "text",
                text: "描述這個視頻的具體過程"
            }
        ]
    }],
    stream: true,
    stream_options: {
        include_usage: true
    },
    modalities: ["text", "audio"],
    audio: { voice: "Cherry", format: "wav" }
});

for await (const chunk of completion) {
    if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
        console.log(chunk.choices[0].delta);
    } else {
        console.log(chunk.usage);
    }

API參考

關於通義千問Omni 模型的輸入輸出參數,請參見通義千問

計費與限流

計費規則

Qwen-Omni模型根據不同模態(音頻、映像、視頻)對應的Token數計費。計費詳情請參見模型列表

音頻、圖片與視頻轉換為Token數的規則

音頻

  • Qwen3-Omni-Flash:總 Tokens 數 = 音頻時間長度(單位:秒)* 12.5

  • Qwen-Omni-Turbo:總 Tokens 數 = 音頻時間長度(單位:秒)* 25,若音頻時間長度不足1秒,則按 1 秒計算。

圖片

  • Qwen3-Omni-Flash模型32x32像素對應 1 個 Token

  • Qwen-Omni-Turbo模型:每28x28像素對應 1 個 Token

一張圖最少需要 4 個 Token,最多支援 1280 個 Token;可使用以下代碼,傳入映像路徑即可估算單張圖片消耗的 Token 總量:

import math
# 使用以下命令安裝Pillow庫:pip install Pillow
from PIL import Image

# Qwen-Omni-Turbo模型,factor為28
# factor = 28
# Qwen3-Omni-Flash模型,factor為32
factor = 32

def token_calculate(image_path=''):
    """
    param image_path: 映像路徑
    return: 單張映像的Token數
    """
    if len(image_path) > 0:
        # 開啟指定的PNG圖片檔案
        image = Image.open(image_path)
        # 擷取圖片的原始大小
        height = image.height
        width = image.width
    print(f"縮放前的映像尺寸為:高度為{height},寬度為{width}")
    # 將高度調整為factor的整數倍
    h_bar = round(height / factor) * factor
    # 將寬度調整為factor的整數倍
    w_bar = round(width / factor) * factor
    # 映像的Token下限:4個Token
    min_pixels = 4 * factor * factor
    # 映像的Token上限:1280個Token
    max_pixels = 1280 * factor * factor
    # 對映像進行縮放處理,調整像素的總數在範圍[min_pixels,max_pixels]內
    if h_bar * w_bar > max_pixels:
        # 計算縮放因子beta,使得縮放後的映像總像素數不超過max_pixels
        beta = math.sqrt((height * width) / max_pixels)
        # 重新計算調整後的高度,確保為factor的整數倍
        h_bar = math.floor(height / beta / factor) * factor
        # 重新計算調整後的寬度,確保為factor的整數倍
        w_bar = math.floor(width / beta / factor) * factor
    elif h_bar * w_bar < min_pixels:
        # 計算縮放因子beta,使得縮放後的映像總像素數不低於min_pixels
        beta = math.sqrt(min_pixels / (height * width))
        # 重新計算調整後的高度,確保為factor的整數倍
        h_bar = math.ceil(height * beta / factor) * factor
        # 重新計算調整後的寬度,確保為factor的整數倍
        w_bar = math.ceil(width * beta / factor) * factor
    print(f"縮放後的映像尺寸為:高度為{h_bar},寬度為{w_bar}")
    # 計算映像的Token數:總像素除以factor * factor
    token = int((h_bar * w_bar) / (factor * factor)) + 2
    print(f"縮放後的token數量為:{token}")
    return token
    
if __name__ == "__main__":
    token = token_calculate(image_path="xxx/test.jpg")

視頻

視頻檔案的 Token 分為 video_tokens(視覺)與 audio_tokens(音頻)。

  • video_tokens

    計算過程較為複雜。請參見以下代碼:

    # 使用前安裝:pip install opencv-python
    import math
    import os
    import logging
    import cv2
    
    # 固定參數
    FRAME_FACTOR = 2
    
    # Qwen3-Omni-Flash模型,IMAGE_FACTOR為32
    IMAGE_FACTOR = 32
    
    # Qwen-Omni-Turbo模型,IMAGE_FACTOR為28
    # IMAGE_FACTOR = 28
    
    # 視訊框架的長寬比
    MAX_RATIO = 200
    
    # 視訊框架的像素下限,Qwen3-Omni-Flash為:128 * 32 * 32
    VIDEO_MIN_PIXELS = 128 * 32 * 32
    # Qwen-Omni-Turbo
    # VIDEO_MIN_PIXELS = 128 * 28 * 28
    
    # 視訊框架的像素上限,Qwen3-Omni-Flash為:768 * 32 * 32
    VIDEO_MAX_PIXELS = 768 * 32 * 32
    # Qwen-Omni-Turbo:
    # VIDEO_MAX_PIXELS = 768 * 28 * 28
    
    FPS = 2
    # 最少抽取幀數
    FPS_MIN_FRAMES = 4
    
    # 最大抽取幀數
    # Qwen3-Omni-Flash模型的大抽取幀數:128
    # Qwen3-Omni-Turbo模型的大抽取幀數:80
    FPS_MAX_FRAMES = 128
    
    # 視頻輸入的最大像素值,Qwen3-Omni-Flash為 16384 * 32 * 32;
    VIDEO_TOTAL_PIXELS = 16384 * 32 * 32
    # Qwen-Omni-Turbo:
    # VIDEO_TOTAL_PIXELS = 16384 * 28 * 28
    
    def round_by_factor(number, factor):
        return round(number / factor) * factor
    
    def ceil_by_factor(number, factor):
        return math.ceil(number / factor) * factor
    
    def floor_by_factor(number, factor):
        return math.floor(number / factor) * factor
    
    def get_video(video_path):
        cap = cv2.VideoCapture(video_path)
        frame_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
        frame_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
        total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
        video_fps = cap.get(cv2.CAP_PROP_FPS)
        cap.release()
        return frame_height, frame_width, total_frames, video_fps
    
    def smart_nframes(total_frames, video_fps):
        min_frames = ceil_by_factor(FPS_MIN_FRAMES, FRAME_FACTOR)
        max_frames = floor_by_factor(min(FPS_MAX_FRAMES, total_frames), FRAME_FACTOR)
        duration = total_frames / video_fps if video_fps != 0 else 0
        if duration - int(duration) > (1 / FPS):
            total_frames = math.ceil(duration * video_fps)
        else:
            total_frames = math.ceil(int(duration) * video_fps)
        nframes = total_frames / video_fps * FPS
        nframes = int(min(min(max(nframes, min_frames), max_frames), total_frames))
        if not (FRAME_FACTOR <= nframes <= total_frames):
            raise ValueError(f"nframes should in interval [{FRAME_FACTOR}, {total_frames}], but got {nframes}.")
        return nframes
    
    def smart_resize(height, width, nframes, factor=IMAGE_FACTOR):
        min_pixels = VIDEO_MIN_PIXELS
        total_pixels = VIDEO_TOTAL_PIXELS
        max_pixels = max(min(VIDEO_MAX_PIXELS, total_pixels / nframes * FRAME_FACTOR), int(min_pixels * 1.05))
        if max(height, width) / min(height, width) > MAX_RATIO:
            raise ValueError(f"absolute aspect ratio must be smaller than {MAX_RATIO}, got {max(height, width) / min(height, width)}")
        h_bar = max(factor, round_by_factor(height, factor))
        w_bar = max(factor, round_by_factor(width, factor))
        if h_bar * w_bar > max_pixels:
            beta = math.sqrt((height * width) / max_pixels)
            h_bar = floor_by_factor(height / beta, factor)
            w_bar = floor_by_factor(width / beta, factor)
        elif h_bar * w_bar < min_pixels:
            beta = math.sqrt(min_pixels / (height * width))
            h_bar = ceil_by_factor(height * beta, factor)
            w_bar = ceil_by_factor(width * beta, factor)
        return h_bar, w_bar
    
    def video_token_calculate(video_path):
        height, width, total_frames, video_fps = get_video(video_path)
        nframes = smart_nframes(total_frames, video_fps)
        resized_height, resized_width = smart_resize(height, width, nframes)
        video_token = int(math.ceil(nframes / FPS) * resized_height / 32 * resized_width / 32)
        video_token += 2  # 視覺標記
        return video_token
    
    if __name__ == "__main__":
        video_path = "spring_mountain.mp4"  # 你的視頻路徑
        video_token = video_token_calculate(video_path)
        print("video_tokens:", video_token)
  • audio_tokens

    • Qwen3-Omni-Flash:總Tokens數 = 音頻時間長度(單位:秒)* 12.5

    • Qwen-Omni-Turbo:總Tokens數 = 音頻時間長度(單位:秒)* 25

    若音頻時間長度不足1秒,則按 1 秒計算。

免費額度

關於免費額度的領取、查詢、使用方法等詳情,請參見新人免費額度

限流

模型限流規則及常見問題,請參見限流

錯誤碼

如果模型調用失敗並返回報錯資訊,請參見錯誤資訊進行解決。

音色列表

使用時將請求參數voice設定為如下表格的“voice參數”列對應的值:

qwen3-omni-flash-2025-12-01模型

音色名

voice參數

音色效果

描述

支援的語種

芊悅

Cherry

陽光積極、親切自然小姐姐

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

蘇瑤

Serena

溫柔小姐姐

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

晨煦

Ethan

標準普通話,帶部分北方口音。陽光、溫暖、活力、朝氣

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

千雪

Chelsie

二次元虛擬女友

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

茉兔

Momo

撒嬌搞怪,逗你開心

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

十三

Vivian

拽拽的、可愛的小暴躁

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

月白

Moon

率性帥氣的月白

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

四月

Maia

知性與溫柔的碰撞

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

Kai

耳朵的一場SPA

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

不吃魚

Nofish

不會翹舌音的設計師

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

萌寶

Bella

喝酒不打醉拳的小蘿莉

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

詹妮弗

Jennifer

品牌級、電影質感般美語女聲

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

甜茶

Ryan

節奏拉滿,戲感炸裂,真實與張力共舞

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

卡捷琳娜

Katerina

禦姐音色,韻律回味十足

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

艾登

Aiden

精通廚藝的美語大男孩

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

滄明子

Eldric Sage

沉穩睿智的老者,滄桑如松卻心明如鏡

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

乖小妹

Mia

溫順如春水,乖巧如初雪

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

沙小彌

Mochi

聰明伶俐的小大人,童真未泯卻早慧如禪

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

燕錚鶯

Bellona

聲音洪亮,吐字清晰,人物鮮活,聽得人熱血沸騰;

金戈鐵馬入夢來,字正腔圓間盡顯千面人聲的江湖

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

田叔

Vincent

一口獨特的沙啞煙嗓,一開口便道盡了千軍萬馬與江湖豪情

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

萌小姬

Bunny

“萌屬性”爆棚的小蘿莉

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

阿聞

Neil

平直的基準語調,字正腔圓的咬字發音,這就是最專業的新聞主持人

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

墨講師

Elias

既保持學科嚴謹性,又通過敘事技巧將複雜知識轉化為可消化的認知模組

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

徐大爺

Arthur

被歲月和旱煙浸泡過的質樸嗓音,不疾不徐地搖開了滿村的奇聞異事

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

鄰家妹妹

Nini

糯米糍一樣又軟又黏的嗓音,那一聲聲拉長了的“哥哥”,甜得能把人的骨頭都叫酥了

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

詭婆婆

Ebona

她的低語像一把生鏽的鑰匙,緩慢轉動你內心最深處的幽暗角落——那裡藏著所有你不敢承認的童年陰影與未知恐懼

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

小婉

Seren

溫和舒緩的聲線,助你更快地進入睡眠,晚安,好夢

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

頑屁小孩

Pip

調皮搗蛋卻充滿童真的他來了,這是你記憶中的小新嗎

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

少女阿月

Stella

平時是甜到發膩的迷糊少女音,但在喊出“代表月亮消滅你”時,瞬間充滿不容置疑的愛與正義

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

博德加

Bodega

熱情的西班牙大叔

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

索尼莎

Sonrisa

熱情開朗的拉美大姐

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

阿列克

Alek

一開口,是戰鬥民族的冷,也是毛呢大衣下的暖

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

多爾切

Dolce

慵懶的意大利大叔

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

素熙

Sohee

溫柔開朗,情緒豐富的韓國歐尼

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

小野杏

Ono Anna

鬼靈精怪的青梅竹馬

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

萊恩

Lenn

理性是底色,叛逆藏在細節裡——穿西裝也聽後龐克的德國青年

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

埃米爾安

Emilien

浪漫的法國大哥哥

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

安德雷

Andre

聲音磁性,自然舒服、沉穩男生

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

拉迪奧·戈爾

Radio Gol

足球詩人Rádio Gol!今天我要用名字為你們解說足球。

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

上海-阿珍

Jada

風風火火的滬上阿姐

中文(上海話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

北京-曉東

Dylan

北京胡同裡長大的少年

中文(北京話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

南京-老李

Li

耐心的瑜伽老師

中文(南京話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

陝西-秦川

Marcus

面寬話短,心實聲沉——老陝的味道

中文(陝西話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

閩南-阿傑

Roy

詼諧直爽、市井活潑的台灣哥仔形象

中文(閩南語)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

天津-李彼得

Peter

天津相聲,專業捧哏

中文(天津話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

四川-晴兒

Sunny

甜到你心裡的川妹子

中文(四川話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

四川-程川

Eric

一個跳脫市井的四川成都男子

中文(四川話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

粵語-阿強

Rocky

幽默風趣的阿強,線上陪聊

中文(粵語)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

粵語-阿清

Kiki

甜美的港妹閨蜜

中文(粵語)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

qwen3-omni-flash、qwen3-omni-flash-2025-09-15模型

音色名

voice參數

音色效果

描述

支援的語種

芊悅

Cherry

陽光積極、親切自然小姐姐

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

晨煦

Ethan

標準普通話,帶部分北方口音。陽光、溫暖、活力、朝氣

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

不吃魚

Nofish

不會翹舌音的設計師

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

詹妮弗

Jennifer

品牌級、電影質感般美語女聲

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

甜茶

Ryan

節奏拉滿,戲感炸裂,真實與張力共舞

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

卡捷琳娜

Katerina

禦姐音色,韻律回味十足

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

墨講師

Elias

既保持學科嚴謹性,又通過敘事技巧將複雜知識轉化為可消化的認知模組

中文、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

上海-阿珍

Jada

風風火火的滬上阿姐

中文(上海話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

北京-曉東

Dylan

北京胡同裡長大的少年

中文(北京話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

四川-晴兒

Sunny

甜到你心裡的川妹子

中文(四川話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

南京-老李

Li

耐心的瑜伽老師

中文(南京話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

陝西-秦川

Marcus

面寬話短,心實聲沉——老陝的味道

中文(陝西話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

閩南-阿傑

Roy

詼諧直爽、市井活潑的台灣哥仔形象

中文(閩南語)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

天津-李彼得

Peter

天津相聲,專業捧哏

中文(天津話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

粵語-阿強

Rocky

幽默風趣的阿強,線上陪聊

中文(粵語)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

粵語-阿清

Kiki

甜美的港妹閨蜜

中文(粵語)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

四川-程川

Eric

一個跳脫市井的四川成都男子

中文(四川話)、英語、法語、德語、俄語、意大利語、西班牙語、葡萄牙語、日語、韓語

Qwen-Omni-Turbo模型

音色名

voice參數

音色效果

描述

支援的語種

芊悅

Cherry

陽光積極、親切自然小姐姐

中文、英語

蘇瑤

Serena

溫柔小姐姐

中文、英語

晨煦

Ethan

標準普通話,帶部分北方口音。陽光、溫暖、活力、朝氣

中文、英語

千雪

Chelsie

二次元虛擬女友

中文、英語

Qwen-Omni 開源模型

音色名

voice參數

音色效果

描述

支援的語種

晨煦

Ethan

標準普通話,帶部分北方口音。陽光、溫暖、活力、朝氣

中文、英語

千雪

Chelsie

二次元虛擬女友

中文、英語