{
  "aboutHtml": "<p>Qwen-Audio-3.0-Realtime-Plus 是 Alibaba 的即時語音對話模型。它接受語音與文字，以音訊與文字回應，並支援自然交換話語的雙向對話。聲音可分段傳送與接收，讓互動隨對話進行。</p><h4>判斷對方是否說完</h4><p>可透過聲音活動、語意完整度或明確控制，判斷一次發話的邊界。在模型開發商提供的模式中，須在傳送第一段音訊前選定模式；開始對話後若要變更，必須建立新的連線。這種控制是否可用，取決於選定的方法。語意模式會考量停頓與填充詞：短暫猶豫不一定表示使用者已說完。使用者的新發話可中斷正在形成的回應，讓對話依下一段發話繼續。語意模式下，可用指定對話者的語音樣本引導辨識，以減少其他人聲及背景雜音的干擾。</p><p>指令設定助理角色及交談風格。語音表達可考量語調、速度與情緒；3.0 版本提供五種系統聲音，以及依語音樣本設定的聲音。模型支援 11 種語言，包括俄語，也支援模型開發商列出的漢語方言變體。在模型開發商的設定方式中，聲音於第一次更新工作階段設定時指定；同一段對話之後傳入的新聲音會被忽略。這些設定須由選定的呼叫方式支援。</p><h4>工具與對話歷史</h4><p>支援函式呼叫。模型提出所需動作，連接的應用程式執行動作，再將結果傳回對話。這讓對話能圍繞實際資料展開，並在操作完成後繼續。語音助理可利用工具結果，同時保留對話脈絡。模型開發商的功能也包括內建網路搜尋，前提是選定的方法有提供。網路搜尋與函式呼叫不能在同一工作階段同時啟用。</p><p>預設歷史保留 20 輪對話，可設定的範圍為一至 50 輪。累積音訊的上限為 300 秒；超過限制時，較舊的歷史片段會被刪除。這與單次發話的長度不同：歷史設定決定繼續對話時，哪些先前素材仍可使用。</p><h4>文字脈絡與聲音</h4><p>正式脈絡長度為 40 960 個 Token。輸入長度上限為 16 384 個 Token，輸出上限為 8192；推理模式也採用相同的輸入與輸出上限，另外限制推理鏈最多為 1024 個 Token。</p><p>串流聲音使用單聲道、16 位元 PCM：輸入為 16 kHz，輸出為 24 kHz。文字與音訊資料屬於同一段對話。此特定模型未宣稱支援視覺輸入或輸出圖片；專長是語音、文字及語音互動。</p>",
  "aboutText": "Qwen-Audio-3.0-Realtime-Plus 是 Alibaba 的即時語音對話模型。它接受語音與文字，以音訊與文字回應，並支援自然交換話語的雙向對話。聲音可分段傳送與接收，讓互動隨對話進行。\n\n### 判斷對方是否說完\n\n可透過聲音活動、語意完整度或明確控制，判斷一次發話的邊界。在模型開發商提供的模式中，須在傳送第一段音訊前選定模式；開始對話後若要變更，必須建立新的連線。這種控制是否可用，取決於選定的方法。語意模式會考量停頓與填充詞：短暫猶豫不一定表示使用者已說完。使用者的新發話可中斷正在形成的回應，讓對話依下一段發話繼續。語意模式下，可用指定對話者的語音樣本引導辨識，以減少其他人聲及背景雜音的干擾。\n\n指令設定助理角色及交談風格。語音表達可考量語調、速度與情緒；3.0 版本提供五種系統聲音，以及依語音樣本設定的聲音。模型支援 11 種語言，包括俄語，也支援模型開發商列出的漢語方言變體。在模型開發商的設定方式中，聲音於第一次更新工作階段設定時指定；同一段對話之後傳入的新聲音會被忽略。這些設定須由選定的呼叫方式支援。\n\n### 工具與對話歷史\n\n支援函式呼叫。模型提出所需動作，連接的應用程式執行動作，再將結果傳回對話。這讓對話能圍繞實際資料展開，並在操作完成後繼續。語音助理可利用工具結果，同時保留對話脈絡。模型開發商的功能也包括內建網路搜尋，前提是選定的方法有提供。網路搜尋與函式呼叫不能在同一工作階段同時啟用。\n\n預設歷史保留 20 輪對話，可設定的範圍為一至 50 輪。累積音訊的上限為 300 秒；超過限制時，較舊的歷史片段會被刪除。這與單次發話的長度不同：歷史設定決定繼續對話時，哪些先前素材仍可使用。\n\n### 文字脈絡與聲音\n\n正式脈絡長度為 40 960 個 Token。輸入長度上限為 16 384 個 Token，輸出上限為 8192；推理模式也採用相同的輸入與輸出上限，另外限制推理鏈最多為 1024 個 Token。\n\n串流聲音使用單聲道、16 位元 PCM：輸入為 16 kHz，輸出為 24 kHz。文字與音訊資料屬於同一段對話。此特定模型未宣稱支援視覺輸入或輸出圖片；專長是語音、文字及語音互動。",
  "editorialOverlay": {
    "copy_fields": null,
    "copy_sha256": null,
    "copy_source": null,
    "html_sha256": "36cb690eb63552c7f36cc16933ce1bf1aad0da6bc379e0c0e1aa2584e8edc248",
    "module_sha256": "ee9dc1c50b1e6a8fb7fa062030fcb4646b9aaaeb08be513b723a5a92a7290f06",
    "raw_model_unchanged": true,
    "schema": "ailoot-native-model-editorial-v1"
  },
  "locale": "zh-hant-tw",
  "methods": [
    {
      "html": "<div class=\"sheet-head\"><span class=\"mav\" aria-hidden=\"true\">Al</span><h2 id=\"sheet-title\">qwen-audio-3.0-realtime-plus</h2><button class=\"icon-btn\" type=\"button\" data-close-sheet aria-label=\"關閉\">×</button></div><div class=\"idline\"><span>Alibaba /</span><code>qwen-audio-3.0-realtime-plus</code><button type=\"button\" id=\"copy-id\">複製 ID</button></div><nav class=\"card-jump-nav\" aria-label=\"模型卡片區段\"><button type=\"button\" data-card-jump=\"overview\">入門</button><button type=\"button\" data-card-jump=\"methods\">輸入與方法</button><button type=\"button\" data-card-jump=\"pricing\">方案</button><button type=\"button\" data-card-jump=\"examples\">範例</button><button type=\"button\" data-card-jump=\"results\">結果</button><button type=\"button\" data-card-jump=\"aliases\">別名</button></nav><div class=\"card-method-tabs\" role=\"tablist\" aria-label=\"API 方法\"><button type=\"button\" role=\"tab\" tabindex=\"0\" aria-controls=\"card-method-content\" aria-selected=\"true\" id=\"card-method-tab-0\" data-card-method=\"Core|realtime|/v1/realtime?model=qwen-audio-3.0-realtime-plus|qwen-audio-3.0-realtime-plus\">即時</button></div><div id=\"card-method-content\" role=\"tabpanel\" aria-labelledby=\"card-method-tab-0\"><section class=\"card-section\" data-card-section=\"overview\"><h3 tabindex=\"-1\">入門</h3><p class=\"mdesc-full\">即時語音對話模型，接受語音與文字，並以語音或文字回應。設計重點是自然的交談節奏，以及與工具互動。</p><dl class=\"card-io\" data-card-io><div><dt>接受的輸入</dt><dd>文字 · 音訊</dd></div><div><dt>結果</dt><dd>文字 · 音訊</dd></div></dl><details class=\"card-about\"><summary>關於模型</summary><p class=\"note-s\" data-model-method-boundary>此說明介紹模型的能力。Ailoot 可用的輸入、輸出與選項，依所選方法列於下方。</p><div class=\"mabout\" id=\"m-about\"><p>Qwen-Audio-3.0-Realtime-Plus 是 Alibaba 的即時語音對話模型。它接受語音與文字，以音訊與文字回應，並支援自然交換話語的雙向對話。聲音可分段傳送與接收，讓互動隨對話進行。</p><h4>判斷對方是否說完</h4><p>可透過聲音活動、語意完整度或明確控制，判斷一次發話的邊界。在模型開發商提供的模式中，須在傳送第一段音訊前選定模式；開始對話後若要變更，必須建立新的連線。這種控制是否可用，取決於選定的方法。語意模式會考量停頓與填充詞：短暫猶豫不一定表示使用者已說完。使用者的新發話可中斷正在形成的回應，讓對話依下一段發話繼續。語意模式下，可用指定對話者的語音樣本引導辨識，以減少其他人聲及背景雜音的干擾。</p><p>指令設定助理角色及交談風格。語音表達可考量語調、速度與情緒；3.0 版本提供五種系統聲音，以及依語音樣本設定的聲音。模型支援 11 種語言，包括俄語，也支援模型開發商列出的漢語方言變體。在模型開發商的設定方式中，聲音於第一次更新工作階段設定時指定；同一段對話之後傳入的新聲音會被忽略。這些設定須由選定的呼叫方式支援。</p><h4>工具與對話歷史</h4><p>支援函式呼叫。模型提出所需動作，連接的應用程式執行動作，再將結果傳回對話。這讓對話能圍繞實際資料展開，並在操作完成後繼續。語音助理可利用工具結果，同時保留對話脈絡。模型開發商的功能也包括內建網路搜尋，前提是選定的方法有提供。網路搜尋與函式呼叫不能在同一工作階段同時啟用。</p><p>預設歷史保留 20 輪對話，可設定的範圍為一至 50 輪。累積音訊的上限為 300 秒；超過限制時，較舊的歷史片段會被刪除。這與單次發話的長度不同：歷史設定決定繼續對話時，哪些先前素材仍可使用。</p><h4>文字脈絡與聲音</h4><p>正式脈絡長度為 40 960 個 Token。輸入長度上限為 16 384 個 Token，輸出上限為 8192；推理模式也採用相同的輸入與輸出上限，另外限制推理鏈最多為 1024 個 Token。</p><p>串流聲音使用單聲道、16 位元 PCM：輸入為 16 kHz，輸出為 24 kHz。文字與音訊資料屬於同一段對話。此特定模型未宣稱支援視覺輸入或輸出圖片；專長是語音、文字及語音互動。</p></div></details></section><section class=\"card-section\" data-card-section=\"methods\"><h3 tabindex=\"-1\">Ailoot 可用 · 輸入與方法</h3><details class=\"card-method\" open><summary><b>Ailoot · 即時語音</b> <code>GET /v1/realtime?model=qwen-audio-3.0-realtime-plus</code></summary><dl class=\"method-capabilities\"><div><dt>輸入</dt><dd><code>text</code>, <code>audio</code></dd></div><div><dt>輸出</dt><dd><code>text</code>, <code>audio</code></dd></div><div><dt>輸出格式</dt><dd>工作階段事件</dd></div></dl><div class=\"tw\" data-card-parameters data-typed-parameters><table><thead><tr><th>欄位</th><th>類型</th><th>要求</th><th>值與限制</th><th>預設值</th></tr></thead><tbody><tr data-parameter-availability=\"source_interface\"><th data-cell-label=\"欄位\" scope=\"row\"><span class=\"card-cell-label\">欄位</span><code class=\"card-field-name\">query.model</code></th><td data-cell-label=\"類型\" data-field-type><span class=\"card-cell-label\">類型</span><code>string</code></td><td data-cell-label=\"要求\"><span class=\"card-cell-label\">要求</span>必填</td><td data-cell-label=\"值與限制\"><span class=\"card-cell-label\">值與限制</span><div>qwen-audio-3.0-realtime-plus</div></td><td data-cell-label=\"預設值\" data-default=\"unspecified\"><span class=\"card-cell-label\">預設值</span>—</td></tr><tr data-parameter-availability=\"source_interface\"><th data-cell-label=\"欄位\" scope=\"row\"><span class=\"card-cell-label\">欄位</span><code class=\"card-field-name\">session.input_audio_format</code></th><td data-cell-label=\"類型\" data-field-type><span class=\"card-cell-label\">類型</span><code>string</code></td><td data-cell-label=\"要求\"><span class=\"card-cell-label\">要求</span>選填</td><td data-cell-label=\"值與限制\"><span class=\"card-cell-label\">值與限制</span><div>pcm16, pcm</div></td><td data-cell-label=\"預設值\" data-default=\"unspecified\"><span class=\"card-cell-label\">預設值</span>—</td></tr><tr data-parameter-availability=\"source_interface\"><th data-cell-label=\"欄位\" scope=\"row\"><span class=\"card-cell-label\">欄位</span><code class=\"card-field-name\">session.output_audio_format</code></th><td data-cell-label=\"類型\" data-field-type><span class=\"card-cell-label\">類型</span><code>string</code></td><td data-cell-label=\"要求\"><span class=\"card-cell-label\">要求</span>選填</td><td data-cell-label=\"值與限制\"><span class=\"card-cell-label\">值與限制</span><div>pcm16, pcm</div></td><td data-cell-label=\"預設值\" data-default=\"unspecified\"><span class=\"card-cell-label\">預設值</span>—</td></tr><tr data-parameter-availability=\"source_interface\"><th data-cell-label=\"欄位\" scope=\"row\"><span class=\"card-cell-label\">欄位</span><code class=\"card-field-name\">session.instructions</code></th><td data-cell-label=\"類型\" data-field-type><span class=\"card-cell-label\">類型</span><code>string</code></td><td data-cell-label=\"要求\"><span class=\"card-cell-label\">要求</span>選填</td><td data-cell-label=\"值與限制\"><span class=\"card-cell-label\">值與限制</span><div>限制適用對象: 所選的工作階段政策</div></td><td data-cell-label=\"預設值\" data-default=\"unspecified\"><span class=\"card-cell-label\">預設值</span>—</td></tr><tr data-parameter-availability=\"source_interface\"><th data-cell-label=\"欄位\" scope=\"row\"><span class=\"card-cell-label\">欄位</span><code class=\"card-field-name\">session.max_history_turns</code></th><td data-cell-label=\"類型\" data-field-type><span class=\"card-cell-label\">類型</span><code>integer</code></td><td data-cell-label=\"要求\"><span class=\"card-cell-label\">要求</span>選填</td><td data-cell-label=\"值與限制\"><span class=\"card-cell-label\">值與限制</span><div>最小值: 1</div><div>限制適用對象: 所選的工作階段政策</div></td><td data-cell-label=\"預設值\" data-default=\"unspecified\"><span class=\"card-cell-label\">預設值</span>—</td></tr><tr data-parameter-availability=\"source_interface\"><th data-cell-label=\"欄位\" scope=\"row\"><span class=\"card-cell-label\">欄位</span><code class=\"card-field-name\">input_audio_buffer.append.audio</code></th><td data-cell-label=\"類型\" data-field-type><span class=\"card-cell-label\">類型</span><code>base64_string</code></td><td data-cell-label=\"要求\"><span class=\"card-cell-label\">要求</span>必填</td><td data-cell-label=\"值與限制\"><span class=\"card-cell-label\">值與限制</span><div>輸入內容: PCM16 單聲道；輸入 16 kHz，輸出 24 kHz；位元組長度須非零且為偶數</div></td><td data-cell-label=\"預設值\" data-default=\"unspecified\"><span class=\"card-cell-label\">預設值</span>—</td></tr></tbody></table></div><details class=\"card-about\" data-material-combinations><summary>輸入素材組合</summary><p class=\"note-s\"><b>realtime_text_audio</b></p></details><details class=\"note-s\" data-method-contract><summary>方法參數與生命週期</summary><div class=\"tw\" data-card-table=\"contract\"><table><thead><tr><th>參數</th><th>規格</th></tr></thead><tbody><tr><th data-cell-label=\"參數\" scope=\"row\"><span class=\"card-cell-label\">參數</span><code>material_types</code></th><td data-cell-label=\"規格\"><span class=\"card-cell-label\">規格</span>text, audio</td></tr><tr><th data-cell-label=\"參數\" scope=\"row\"><span class=\"card-cell-label\">參數</span><code>required</code></th><td data-cell-label=\"規格\"><span class=\"card-cell-label\">規格</span>null</td></tr><tr><th data-cell-label=\"參數\" scope=\"row\"><span class=\"card-cell-label\">參數</span><code>optional_controls</code></th><td data-cell-label=\"規格\"><span class=\"card-cell-label\">規格</span>null</td></tr><tr><th data-cell-label=\"參數\" scope=\"row\"><span class=\"card-cell-label\">參數</span><code>content_type</code></th><td data-cell-label=\"規格\"><span class=\"card-cell-label\">規格</span>WebSocket</td></tr></tbody></table></div><p>生命週期： <code>exact retained published method</code></p><p class=\"note-s\">方法結構與 ID 均為精確值；供應商能力與准入狀態分開。</p></details></details></section><section class=\"card-section\" data-card-section=\"pricing\"><h3 tabindex=\"-1\">方案</h3><h4>Ailoot 方法費率</h4><section class=\"meth\" data-route=\"Core\"><header><b><span class=\"alias\">Ailoot</span> 即時語音</b><code>GET /v1/realtime?model=qwen-audio-3.0-realtime-plus</code></header><dl><div><dt>輸入</dt><dd>US$0.0008 <em>/ 1K</em></dd></div><div><dt>輸出</dt><dd>US$0.0064 <em>/ 1K</em></dd></div><div><dt>輸入</dt><dd>US$0.0048 <em>每分鐘音訊</em></dd></div><div><dt>輸出</dt><dd>US$0.018 <em>每分鐘輸出音訊</em></dd></div></dl></section><p class=\"note-s\">Ailoot 會在請求前預留估算金額。取得結果後，依實測用量結算最終費用。串流結算採用最終用量紀錄。<a href=\"/docs/zh-hant-tw/billing/reserve/\">預留金額與結算的運作方式 →</a></p></section><section class=\"card-section\" data-card-section=\"examples\"><h3 tabindex=\"-1\">請求範例</h3><h4>Ailoot · 即時語音</h4><div class=\"code-group\"><div class=\"cg-bar\"><div class=\"cg-tabs\" role=\"tablist\" aria-label=\"程式碼版本\"><button class=\"cg-tab\" id=\"model-code-40-tab-0\" role=\"tab\" type=\"button\" aria-controls=\"model-code-40-panel-0\" aria-selected=\"true\" tabindex=\"0\">Python WebSocket · 文字</button><button class=\"cg-tab\" id=\"model-code-40-tab-1\" role=\"tab\" type=\"button\" aria-controls=\"model-code-40-panel-1\" aria-selected=\"false\" tabindex=\"-1\">Python WebSocket · 音訊</button></div><div class=\"cg-tools\"><button class=\"cg-btn cg-copy\" type=\"button\" aria-label=\"複製程式碼\"><svg class=\"cp\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.4\"><rect x=\"5.25\" y=\"5.25\" width=\"8.5\" height=\"8.5\" rx=\"1.75\"/><path d=\"M10.75 5.25V3.5a1.25 1.25 0 0 0-1.25-1.25H3.5A1.25 1.25 0 0 0 2.25 3.5v6a1.25 1.25 0 0 0 1.25 1.25h1.75\"/></svg><svg class=\"ok\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.4\"><path d=\"m3 8.5 3.25 3.25L13 5\"/></svg></button></div></div><div class=\"cg-body\"><div class=\"cg-pane\" id=\"model-code-40-panel-0\" role=\"tabpanel\" aria-labelledby=\"model-code-40-tab-0\"><pre data-lang=\"python\"><code># Install the documented client once: python3 -m pip install websockets\nimport base64, json, os, time, wave\nfrom pathlib import Path\nfrom websockets.sync.client import connect\n\nkey = os.environ.get(&quot;AILOOT_API_KEY&quot;, &quot;&quot;)\nif not key.strip():\n    raise SystemExit(&quot;Set your AILOOT_API_KEY before connecting&quot;)\nfile = Path(os.environ.get(&quot;AILOOT_TEXT_FILE&quot;, &quot;&quot;))\nif not file.is_file(): raise SystemExit(&quot;Set AILOOT_TEXT_FILE to your actual UTF-8 material&quot;)\nmaterial = file.read_text(encoding=&quot;utf-8&quot;)\nif not material.strip(): raise SystemExit(&quot;Text material must not be empty&quot;)\nout = Path(&quot;realtime-results&quot;)\nout.mkdir(exist_ok=True)\naudio, texts, complete = {}, {}, []\ncurrent_response = None\npending = False\ndeadline = time.monotonic() + 570  # Local client bound; lower server/session limits still apply.\n\ndef receive(ws, log):\n    global current_response, pending\n    left = deadline - time.monotonic()\n    if left &lt;= 0:\n        raise TimeoutError(&quot;Client session limit; preserve IDs and partial results, do not replay&quot;)\n    event = json.loads(ws.recv(timeout=min(60, left)))\n    log.write(json.dumps(event, ensure_ascii=False) + &quot;\\n&quot;)\n    log.flush()\n    kind = event.get(&quot;type&quot;)\n    if kind == &quot;error&quot;:\n        raise RuntimeError(json.dumps(event, ensure_ascii=False))\n    if kind == &quot;response.created&quot;:\n        current_response = event[&quot;response&quot;][&quot;id&quot;]\n    if kind in {&quot;response.audio.delta&quot;, &quot;response.output_audio.delta&quot;, &quot;response.text.delta&quot;, &quot;response.output_text.delta&quot;, &quot;response.audio_transcript.delta&quot;, &quot;response.output_audio_transcript.delta&quot;, &quot;response.text.done&quot;, &quot;response.audio_transcript.done&quot;}:\n        identity = (event[&quot;response_id&quot;], event[&quot;item_id&quot;], event[&quot;output_index&quot;], event[&quot;content_index&quot;])\n        if kind in {&quot;response.audio.delta&quot;, &quot;response.output_audio.delta&quot;}:\n            raw = base64.b64decode(event[&quot;delta&quot;], validate=True)\n            if len(raw) % 2: raise ValueError(&quot;Output PCM16 chunk must have an even byte length&quot;)\n            audio.setdefault(identity, bytearray()).extend(raw)\n        elif kind.endswith(&quot;.done&quot;):\n            texts[identity] = event.get(&quot;text&quot;, event.get(&quot;transcript&quot;, &quot;&quot;))\n        else:\n            texts[identity] = texts.get(identity, &quot;&quot;) + event[&quot;delta&quot;]\n            print(event[&quot;delta&quot;], end=&quot;&quot;, flush=True)\n    if kind == &quot;response.done&quot;:\n        response = event[&quot;response&quot;]\n        complete.append(response)\n        if current_response is None: current_response = response[&quot;id&quot;]\n        if response[&quot;id&quot;] == current_response: pending = False\n    return event\n\ndef wait_for(ws, log, kind):\n    while True:\n        event = receive(ws, log)\n        if event.get(&quot;type&quot;) == kind: return event\n\ndef send(ws, event):\n    ws.send(json.dumps(event, ensure_ascii=False))\n\ntry:\n    # One exact model query; no reconnect/retry loop and no provider credentials.\n    with connect(&quot;wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus&quot;, additional_headers={&quot;Authorization&quot;: &quot;Bearer &quot; + key}) as ws:\n        with (out / &quot;events.jsonl&quot;).open(&quot;w&quot;, encoding=&quot;utf-8&quot;) as log:\n            wait_for(ws, log, &quot;session.created&quot;)\n            send(ws, {&quot;type&quot;:&quot;session.update&quot;, &quot;session&quot;:{&quot;modalities&quot;:[&quot;audio&quot;,&quot;text&quot;], &quot;input_audio_format&quot;:&quot;pcm&quot;, &quot;output_audio_format&quot;:&quot;pcm&quot;, &quot;turn_detection&quot;:None}})\n            wait_for(ws, log, &quot;session.updated&quot;)\n            send(ws, {&quot;type&quot;:&quot;conversation.item.create&quot;, &quot;item&quot;:{&quot;type&quot;:&quot;message&quot;, &quot;role&quot;:&quot;user&quot;, &quot;content&quot;:[{&quot;type&quot;:&quot;input_text&quot;, &quot;text&quot;:material}]}})\n            send(ws, {&quot;type&quot;:&quot;response.create&quot;})\n            pending = True\n            try:\n                while pending: receive(ws, log)\n            except KeyboardInterrupt:\n                # Cancel the actual current inference, then preserve its returned status.\n                send(ws, {&quot;type&quot;:&quot;response.cancel&quot;})\n                while pending: receive(ws, log)\n    if not complete or complete[-1].get(&quot;status&quot;) != &quot;completed&quot;:\n        raise RuntimeError(&quot;Response did not complete normally; inspect saved events and status&quot;)\nfinally:\n    manifest = {&quot;responses&quot;:complete, &quot;parts&quot;:[]}\n    for number, identity in enumerate(dict.fromkeys(list(audio) + list(texts))):\n        record = {&quot;response_id&quot;:identity[0], &quot;item_id&quot;:identity[1], &quot;output_index&quot;:identity[2], &quot;content_index&quot;:identity[3]}\n        if identity in audio:\n            raw = bytes(audio[identity])\n            pcm_file = out / (&quot;audio-&quot; + str(number) + &quot;.pcm&quot;)\n            wav_file = out / (&quot;audio-&quot; + str(number) + &quot;.wav&quot;)\n            pcm_file.write_bytes(raw)\n            with wave.open(str(wav_file), &quot;wb&quot;) as wav:\n                wav.setnchannels(1); wav.setsampwidth(2); wav.setframerate(24000); wav.writeframes(raw)\n            record.update({&quot;pcm&quot;:str(pcm_file), &quot;wav&quot;:str(wav_file), &quot;sample_rate_hz&quot;:24000})\n        if identity in texts:\n            text_file = out / (&quot;text-&quot; + str(number) + &quot;.txt&quot;)\n            text_file.write_text(texts[identity], encoding=&quot;utf-8&quot;)\n            record[&quot;text&quot;] = str(text_file)\n        manifest[&quot;parts&quot;].append(record)\n    (out / &quot;results.json&quot;).write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding=&quot;utf-8&quot;)\n    print(&quot;\\nSaved every received event and result in&quot;, out)\n</code></pre></div><div class=\"cg-pane\" id=\"model-code-40-panel-1\" role=\"tabpanel\" aria-labelledby=\"model-code-40-tab-1\" hidden><pre data-lang=\"python\"><code># Install the documented client once: python3 -m pip install websockets\nimport base64, json, os, time, wave\nfrom pathlib import Path\nfrom websockets.sync.client import connect\n\nkey = os.environ.get(&quot;AILOOT_API_KEY&quot;, &quot;&quot;)\nif not key.strip():\n    raise SystemExit(&quot;Set your AILOOT_API_KEY before connecting&quot;)\nfile = Path(os.environ.get(&quot;AILOOT_AUDIO_FILE&quot;, &quot;&quot;))\nif not file.is_file(): raise SystemExit(&quot;Set AILOOT_AUDIO_FILE to your raw PCM16 mono 16-kHz recording&quot;)\nmaterial = file.read_bytes()\nif not material or len(material) % 2 or material.startswith(b&quot;RIFF&quot;):\n    raise SystemExit(&quot;Use nonempty signed little-endian PCM16 mono 16-kHz bytes, not a WAV header&quot;)\nout = Path(&quot;realtime-results&quot;)\nout.mkdir(exist_ok=True)\naudio, texts, complete = {}, {}, []\ncurrent_response = None\npending = False\ndeadline = time.monotonic() + 570  # Local client bound; lower server/session limits still apply.\n\ndef receive(ws, log):\n    global current_response, pending\n    left = deadline - time.monotonic()\n    if left &lt;= 0:\n        raise TimeoutError(&quot;Client session limit; preserve IDs and partial results, do not replay&quot;)\n    event = json.loads(ws.recv(timeout=min(60, left)))\n    log.write(json.dumps(event, ensure_ascii=False) + &quot;\\n&quot;)\n    log.flush()\n    kind = event.get(&quot;type&quot;)\n    if kind == &quot;error&quot;:\n        raise RuntimeError(json.dumps(event, ensure_ascii=False))\n    if kind == &quot;response.created&quot;:\n        current_response = event[&quot;response&quot;][&quot;id&quot;]\n    if kind in {&quot;response.audio.delta&quot;, &quot;response.output_audio.delta&quot;, &quot;response.text.delta&quot;, &quot;response.output_text.delta&quot;, &quot;response.audio_transcript.delta&quot;, &quot;response.output_audio_transcript.delta&quot;, &quot;response.text.done&quot;, &quot;response.audio_transcript.done&quot;}:\n        identity = (event[&quot;response_id&quot;], event[&quot;item_id&quot;], event[&quot;output_index&quot;], event[&quot;content_index&quot;])\n        if kind in {&quot;response.audio.delta&quot;, &quot;response.output_audio.delta&quot;}:\n            raw = base64.b64decode(event[&quot;delta&quot;], validate=True)\n            if len(raw) % 2: raise ValueError(&quot;Output PCM16 chunk must have an even byte length&quot;)\n            audio.setdefault(identity, bytearray()).extend(raw)\n        elif kind.endswith(&quot;.done&quot;):\n            texts[identity] = event.get(&quot;text&quot;, event.get(&quot;transcript&quot;, &quot;&quot;))\n        else:\n            texts[identity] = texts.get(identity, &quot;&quot;) + event[&quot;delta&quot;]\n            print(event[&quot;delta&quot;], end=&quot;&quot;, flush=True)\n    if kind == &quot;response.done&quot;:\n        response = event[&quot;response&quot;]\n        complete.append(response)\n        if current_response is None: current_response = response[&quot;id&quot;]\n        if response[&quot;id&quot;] == current_response: pending = False\n    return event\n\ndef wait_for(ws, log, kind):\n    while True:\n        event = receive(ws, log)\n        if event.get(&quot;type&quot;) == kind: return event\n\ndef send(ws, event):\n    ws.send(json.dumps(event, ensure_ascii=False))\n\ntry:\n    # One exact model query; no reconnect/retry loop and no provider credentials.\n    with connect(&quot;wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus&quot;, additional_headers={&quot;Authorization&quot;: &quot;Bearer &quot; + key}) as ws:\n        with (out / &quot;events.jsonl&quot;).open(&quot;w&quot;, encoding=&quot;utf-8&quot;) as log:\n            wait_for(ws, log, &quot;session.created&quot;)\n            send(ws, {&quot;type&quot;:&quot;session.update&quot;, &quot;session&quot;:{&quot;modalities&quot;:[&quot;audio&quot;,&quot;text&quot;], &quot;input_audio_format&quot;:&quot;pcm&quot;, &quot;output_audio_format&quot;:&quot;pcm&quot;, &quot;turn_detection&quot;:None}})\n            wait_for(ws, log, &quot;session.updated&quot;)\n            for offset in range(0, len(material), 640):\n                send(ws, {&quot;type&quot;:&quot;input_audio_buffer.append&quot;, &quot;audio&quot;:base64.b64encode(material[offset:offset+640]).decode(&quot;ascii&quot;)})\n                time.sleep(0.02)\n            send(ws, {&quot;type&quot;:&quot;input_audio_buffer.commit&quot;})\n            wait_for(ws, log, &quot;input_audio_buffer.committed&quot;)\n            send(ws, {&quot;type&quot;:&quot;response.create&quot;})\n            pending = True\n            try:\n                while pending: receive(ws, log)\n            except KeyboardInterrupt:\n                # Cancel the actual current inference, then preserve its returned status.\n                send(ws, {&quot;type&quot;:&quot;response.cancel&quot;})\n                while pending: receive(ws, log)\n    if not complete or complete[-1].get(&quot;status&quot;) != &quot;completed&quot;:\n        raise RuntimeError(&quot;Response did not complete normally; inspect saved events and status&quot;)\nfinally:\n    manifest = {&quot;responses&quot;:complete, &quot;parts&quot;:[]}\n    for number, identity in enumerate(dict.fromkeys(list(audio) + list(texts))):\n        record = {&quot;response_id&quot;:identity[0], &quot;item_id&quot;:identity[1], &quot;output_index&quot;:identity[2], &quot;content_index&quot;:identity[3]}\n        if identity in audio:\n            raw = bytes(audio[identity])\n            pcm_file = out / (&quot;audio-&quot; + str(number) + &quot;.pcm&quot;)\n            wav_file = out / (&quot;audio-&quot; + str(number) + &quot;.wav&quot;)\n            pcm_file.write_bytes(raw)\n            with wave.open(str(wav_file), &quot;wb&quot;) as wav:\n                wav.setnchannels(1); wav.setsampwidth(2); wav.setframerate(24000); wav.writeframes(raw)\n            record.update({&quot;pcm&quot;:str(pcm_file), &quot;wav&quot;:str(wav_file), &quot;sample_rate_hz&quot;:24000})\n        if identity in texts:\n            text_file = out / (&quot;text-&quot; + str(number) + &quot;.txt&quot;)\n            text_file.write_text(texts[identity], encoding=&quot;utf-8&quot;)\n            record[&quot;text&quot;] = str(text_file)\n        manifest[&quot;parts&quot;].append(record)\n    (out / &quot;results.json&quot;).write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding=&quot;utf-8&quot;)\n    print(&quot;\\nSaved every received event and result in&quot;, out)\n</code></pre></div></div></div></section><section class=\"card-section\" data-card-section=\"results\"><h3 tabindex=\"-1\">接收並儲存結果</h3><h4>Ailoot · 即時語音</h4><p class=\"note-s\">工作階段事件</p><div class=\"card-result-process\" data-all-results><h5>保留所有已完成的結果</h5><p class=\"note-s\">請保留所有完整傳回的回應、檔案與內容區塊。</p><p class=\"note-s\">請依每個實際回應 ID，組合所有回傳的音訊增量片段與文字／事件結果。</p></div><div class=\"card-result-process\" data-unknown-recovery><h5>需要檢查原始回應時</h5><p class=\"note-s\">請保留實際的工作階段／回應／事件 ID 與紀錄憑證。</p></div><details class=\"card-about\" data-method-errors><summary>錯誤與後續步驟</summary><div class=\"tw\" data-card-table=\"errors\"><table><thead><tr><th>回應</th><th>條件</th><th>下一步</th></tr></thead><tbody><tr><th data-cell-label=\"回應\" scope=\"row\"><span class=\"card-cell-label\">回應</span>426 · <code>invalid_request_error</code></th><td data-cell-label=\"條件\"><span class=\"card-cell-label\">條件</span>未進行 WebSocket 升級</td><td data-cell-label=\"下一步\"><span class=\"card-cell-label\">下一步</span>請使用 WebSocket 用戶端，並帶入 Upgrade: websocket。</td></tr></tbody></table></div></details></section><section class=\"card-section\" data-card-section=\"aliases\"><h3 tabindex=\"-1\">別名</h3><h4>模型別名</h4><p class=\"note-s\"><span data-model-alias-route=\"Core\"><b>Ailoot</b> <a href=\"#m=qwen-audio-3.0-realtime-plus&amp;route=Core&amp;caller=qwen-audio-3.0-realtime-plus&amp;fmt=realtime\"><code>qwen-audio-3.0-realtime-plus</code></a></span></p><h4>方法路徑別名</h4><p class=\"note-s\">請使用上方列出的 API 方法路徑。</p><h4>相關呼叫用 ID</h4><p class=\"note-s\"><a href=\"#m=qwen-audio-3.0-realtime-plus&amp;route=Core&amp;caller=qwen-audio-3.0-realtime-plus&amp;fmt=realtime\"><code>qwen-audio-3.0-realtime-plus</code></a></p></section></div>",
      "method_identity": {
        "effective_request_model_id": "qwen-audio-3.0-realtime-plus",
        "fmt": "realtime",
        "http": "GET",
        "path": "/v1/realtime?model=qwen-audio-3.0-realtime-plus",
        "request_model_id": "qwen-audio-3.0-realtime-plus",
        "route_label": "Core"
      },
      "method_key": "Core|realtime|/v1/realtime?model=qwen-audio-3.0-realtime-plus|qwen-audio-3.0-realtime-plus",
      "ordinal": 0,
      "rawMethod": {
        "cache_read": null,
        "cache_write": null,
        "cache_write_1h": null,
        "cache_write_5m": null,
        "conditional_meter": null,
        "contract": {
          "data": {
            "all_results": "請依每個實際回應 ID，組合所有回傳的音訊增量片段與文字／事件結果。",
            "endpoint": {
              "http": "GET",
              "path": "/v1/realtime",
              "query": {
                "model": "qwen-audio-3.0-realtime-plus"
              },
              "transport": "WebSocket",
              "url": "wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus"
            },
            "errors": [
              {
                "condition": "未進行 WebSocket 升級",
                "http_status": 426,
                "recovery": "請使用 WebSocket 用戶端，並帶入 Upgrade: websocket。",
                "type": "invalid_request_error"
              }
            ],
            "hints": [
              "Append the model query once; do not add another ?model to a URL that already contains it.",
              "Use the actual WebSocket upgrade and API-key authentication.",
              "Tools, web search and voiceprint enhancement are not supported on this exact route."
            ],
            "ignored_fields": [],
            "lifecycle": {
              "close": "Close the actual establishedWebSocket session; no fakeHTTP cancelpath.",
              "mode": "WebSocket session",
              "unknown": "請保留實際的工作階段／回應／事件 ID 與紀錄憑證。"
            },
            "material_combinations": [
              {
                "events": [
                  "session.update",
                  "input_audio_buffer.append",
                  "input_audio_buffer.commit",
                  "input_audio_buffer.clear",
                  "response.create",
                  "response.cancel",
                  "conversation.item.create",
                  "conversation.item.retrieve",
                  "conversation.item.delete"
                ],
                "mode": "realtime_text_audio"
              }
            ],
            "operation_modes": [
              "realtime_text_audio"
            ],
            "outputs": {
              "all_outputs": "Assemble every returned audio delta and text/event result for each actual response ID.",
              "audio_format": "PCM16 mono 24 kHz",
              "family": [
                "text",
                "audio"
              ],
              "format": "工作階段事件"
            },
            "parameters": [
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": [
                  "qwen-audio-3.0-realtime-plus"
                ],
                "enum_known": true,
                "enum_status": "specified",
                "name": "query.model",
                "required": true,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": [
                  "pcm16",
                  "pcm"
                ],
                "enum_known": true,
                "enum_status": "specified",
                "name": "session.input_audio_format",
                "required": false,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": [
                  "pcm16",
                  "pcm"
                ],
                "enum_known": true,
                "enum_status": "specified",
                "name": "session.output_audio_format",
                "required": false,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": null,
                "enum_known": false,
                "enum_status": "not_specified",
                "limit_scope": "所選的工作階段政策",
                "name": "session.instructions",
                "required": false,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": null,
                "enum_known": false,
                "enum_status": "not_specified",
                "limit_scope": "所選的工作階段政策",
                "minimum": 1,
                "name": "session.max_history_turns",
                "required": false,
                "type": "integer"
              },
              {
                "availability": "source_interface",
                "content": "PCM16 單聲道；輸入 16 kHz，輸出 24 kHz；位元組長度須非零且為偶數",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": null,
                "enum_known": false,
                "enum_status": "not_specified",
                "name": "input_audio_buffer.append.audio",
                "required": true,
                "type": "base64_string"
              }
            ],
            "unsupported": []
          },
          "hints": [
            "方法結構與 ID 均為精確值；供應商能力與准入狀態分開。"
          ],
          "input": {
            "content_type": "WebSocket",
            "material_types": [
              "text",
              "audio"
            ],
            "optional_controls": null,
            "required": null
          },
          "lifecycle": {
            "mode": "exact retained published method"
          },
          "method": {
            "http": "GET",
            "path": "/v1/realtime?model=qwen-audio-3.0-realtime-plus"
          },
          "operation_modes": [
            "realtime"
          ],
          "output": {
            "family": [
              "text",
              "audio"
            ],
            "format": "session events",
            "multioutputs": "retain every actual response output"
          }
        },
        "ctx": null,
        "examples": [
          {
            "code": "# Install the documented client once: python3 -m pip install websockets\nimport base64, json, os, time, wave\nfrom pathlib import Path\nfrom websockets.sync.client import connect\n\nkey = os.environ.get(\"AILOOT_API_KEY\", \"\")\nif not key.strip():\n    raise SystemExit(\"Set your AILOOT_API_KEY before connecting\")\nfile = Path(os.environ.get(\"AILOOT_TEXT_FILE\", \"\"))\nif not file.is_file(): raise SystemExit(\"Set AILOOT_TEXT_FILE to your actual UTF-8 material\")\nmaterial = file.read_text(encoding=\"utf-8\")\nif not material.strip(): raise SystemExit(\"Text material must not be empty\")\nout = Path(\"realtime-results\")\nout.mkdir(exist_ok=True)\naudio, texts, complete = {}, {}, []\ncurrent_response = None\npending = False\ndeadline = time.monotonic() + 570  # Local client bound; lower server/session limits still apply.\n\ndef receive(ws, log):\n    global current_response, pending\n    left = deadline - time.monotonic()\n    if left <= 0:\n        raise TimeoutError(\"Client session limit; preserve IDs and partial results, do not replay\")\n    event = json.loads(ws.recv(timeout=min(60, left)))\n    log.write(json.dumps(event, ensure_ascii=False) + \"\\n\")\n    log.flush()\n    kind = event.get(\"type\")\n    if kind == \"error\":\n        raise RuntimeError(json.dumps(event, ensure_ascii=False))\n    if kind == \"response.created\":\n        current_response = event[\"response\"][\"id\"]\n    if kind in {\"response.audio.delta\", \"response.output_audio.delta\", \"response.text.delta\", \"response.output_text.delta\", \"response.audio_transcript.delta\", \"response.output_audio_transcript.delta\", \"response.text.done\", \"response.audio_transcript.done\"}:\n        identity = (event[\"response_id\"], event[\"item_id\"], event[\"output_index\"], event[\"content_index\"])\n        if kind in {\"response.audio.delta\", \"response.output_audio.delta\"}:\n            raw = base64.b64decode(event[\"delta\"], validate=True)\n            if len(raw) % 2: raise ValueError(\"Output PCM16 chunk must have an even byte length\")\n            audio.setdefault(identity, bytearray()).extend(raw)\n        elif kind.endswith(\".done\"):\n            texts[identity] = event.get(\"text\", event.get(\"transcript\", \"\"))\n        else:\n            texts[identity] = texts.get(identity, \"\") + event[\"delta\"]\n            print(event[\"delta\"], end=\"\", flush=True)\n    if kind == \"response.done\":\n        response = event[\"response\"]\n        complete.append(response)\n        if current_response is None: current_response = response[\"id\"]\n        if response[\"id\"] == current_response: pending = False\n    return event\n\ndef wait_for(ws, log, kind):\n    while True:\n        event = receive(ws, log)\n        if event.get(\"type\") == kind: return event\n\ndef send(ws, event):\n    ws.send(json.dumps(event, ensure_ascii=False))\n\ntry:\n    # One exact model query; no reconnect/retry loop and no provider credentials.\n    with connect(\"wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus\", additional_headers={\"Authorization\": \"Bearer \" + key}) as ws:\n        with (out / \"events.jsonl\").open(\"w\", encoding=\"utf-8\") as log:\n            wait_for(ws, log, \"session.created\")\n            send(ws, {\"type\":\"session.update\", \"session\":{\"modalities\":[\"audio\",\"text\"], \"input_audio_format\":\"pcm\", \"output_audio_format\":\"pcm\", \"turn_detection\":None}})\n            wait_for(ws, log, \"session.updated\")\n            send(ws, {\"type\":\"conversation.item.create\", \"item\":{\"type\":\"message\", \"role\":\"user\", \"content\":[{\"type\":\"input_text\", \"text\":material}]}})\n            send(ws, {\"type\":\"response.create\"})\n            pending = True\n            try:\n                while pending: receive(ws, log)\n            except KeyboardInterrupt:\n                # Cancel the actual current inference, then preserve its returned status.\n                send(ws, {\"type\":\"response.cancel\"})\n                while pending: receive(ws, log)\n    if not complete or complete[-1].get(\"status\") != \"completed\":\n        raise RuntimeError(\"Response did not complete normally; inspect saved events and status\")\nfinally:\n    manifest = {\"responses\":complete, \"parts\":[]}\n    for number, identity in enumerate(dict.fromkeys(list(audio) + list(texts))):\n        record = {\"response_id\":identity[0], \"item_id\":identity[1], \"output_index\":identity[2], \"content_index\":identity[3]}\n        if identity in audio:\n            raw = bytes(audio[identity])\n            pcm_file = out / (\"audio-\" + str(number) + \".pcm\")\n            wav_file = out / (\"audio-\" + str(number) + \".wav\")\n            pcm_file.write_bytes(raw)\n            with wave.open(str(wav_file), \"wb\") as wav:\n                wav.setnchannels(1); wav.setsampwidth(2); wav.setframerate(24000); wav.writeframes(raw)\n            record.update({\"pcm\":str(pcm_file), \"wav\":str(wav_file), \"sample_rate_hz\":24000})\n        if identity in texts:\n            text_file = out / (\"text-\" + str(number) + \".txt\")\n            text_file.write_text(texts[identity], encoding=\"utf-8\")\n            record[\"text\"] = str(text_file)\n        manifest[\"parts\"].append(record)\n    (out / \"results.json\").write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding=\"utf-8\")\n    print(\"\\nSaved every received event and result in\", out)\n",
            "label": "Python WebSocket · text material and all text/audio results",
            "language": "python"
          },
          {
            "code": "# Install the documented client once: python3 -m pip install websockets\nimport base64, json, os, time, wave\nfrom pathlib import Path\nfrom websockets.sync.client import connect\n\nkey = os.environ.get(\"AILOOT_API_KEY\", \"\")\nif not key.strip():\n    raise SystemExit(\"Set your AILOOT_API_KEY before connecting\")\nfile = Path(os.environ.get(\"AILOOT_AUDIO_FILE\", \"\"))\nif not file.is_file(): raise SystemExit(\"Set AILOOT_AUDIO_FILE to your raw PCM16 mono 16-kHz recording\")\nmaterial = file.read_bytes()\nif not material or len(material) % 2 or material.startswith(b\"RIFF\"):\n    raise SystemExit(\"Use nonempty signed little-endian PCM16 mono 16-kHz bytes, not a WAV header\")\nout = Path(\"realtime-results\")\nout.mkdir(exist_ok=True)\naudio, texts, complete = {}, {}, []\ncurrent_response = None\npending = False\ndeadline = time.monotonic() + 570  # Local client bound; lower server/session limits still apply.\n\ndef receive(ws, log):\n    global current_response, pending\n    left = deadline - time.monotonic()\n    if left <= 0:\n        raise TimeoutError(\"Client session limit; preserve IDs and partial results, do not replay\")\n    event = json.loads(ws.recv(timeout=min(60, left)))\n    log.write(json.dumps(event, ensure_ascii=False) + \"\\n\")\n    log.flush()\n    kind = event.get(\"type\")\n    if kind == \"error\":\n        raise RuntimeError(json.dumps(event, ensure_ascii=False))\n    if kind == \"response.created\":\n        current_response = event[\"response\"][\"id\"]\n    if kind in {\"response.audio.delta\", \"response.output_audio.delta\", \"response.text.delta\", \"response.output_text.delta\", \"response.audio_transcript.delta\", \"response.output_audio_transcript.delta\", \"response.text.done\", \"response.audio_transcript.done\"}:\n        identity = (event[\"response_id\"], event[\"item_id\"], event[\"output_index\"], event[\"content_index\"])\n        if kind in {\"response.audio.delta\", \"response.output_audio.delta\"}:\n            raw = base64.b64decode(event[\"delta\"], validate=True)\n            if len(raw) % 2: raise ValueError(\"Output PCM16 chunk must have an even byte length\")\n            audio.setdefault(identity, bytearray()).extend(raw)\n        elif kind.endswith(\".done\"):\n            texts[identity] = event.get(\"text\", event.get(\"transcript\", \"\"))\n        else:\n            texts[identity] = texts.get(identity, \"\") + event[\"delta\"]\n            print(event[\"delta\"], end=\"\", flush=True)\n    if kind == \"response.done\":\n        response = event[\"response\"]\n        complete.append(response)\n        if current_response is None: current_response = response[\"id\"]\n        if response[\"id\"] == current_response: pending = False\n    return event\n\ndef wait_for(ws, log, kind):\n    while True:\n        event = receive(ws, log)\n        if event.get(\"type\") == kind: return event\n\ndef send(ws, event):\n    ws.send(json.dumps(event, ensure_ascii=False))\n\ntry:\n    # One exact model query; no reconnect/retry loop and no provider credentials.\n    with connect(\"wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus\", additional_headers={\"Authorization\": \"Bearer \" + key}) as ws:\n        with (out / \"events.jsonl\").open(\"w\", encoding=\"utf-8\") as log:\n            wait_for(ws, log, \"session.created\")\n            send(ws, {\"type\":\"session.update\", \"session\":{\"modalities\":[\"audio\",\"text\"], \"input_audio_format\":\"pcm\", \"output_audio_format\":\"pcm\", \"turn_detection\":None}})\n            wait_for(ws, log, \"session.updated\")\n            for offset in range(0, len(material), 640):\n                send(ws, {\"type\":\"input_audio_buffer.append\", \"audio\":base64.b64encode(material[offset:offset+640]).decode(\"ascii\")})\n                time.sleep(0.02)\n            send(ws, {\"type\":\"input_audio_buffer.commit\"})\n            wait_for(ws, log, \"input_audio_buffer.committed\")\n            send(ws, {\"type\":\"response.create\"})\n            pending = True\n            try:\n                while pending: receive(ws, log)\n            except KeyboardInterrupt:\n                # Cancel the actual current inference, then preserve its returned status.\n                send(ws, {\"type\":\"response.cancel\"})\n                while pending: receive(ws, log)\n    if not complete or complete[-1].get(\"status\") != \"completed\":\n        raise RuntimeError(\"Response did not complete normally; inspect saved events and status\")\nfinally:\n    manifest = {\"responses\":complete, \"parts\":[]}\n    for number, identity in enumerate(dict.fromkeys(list(audio) + list(texts))):\n        record = {\"response_id\":identity[0], \"item_id\":identity[1], \"output_index\":identity[2], \"content_index\":identity[3]}\n        if identity in audio:\n            raw = bytes(audio[identity])\n            pcm_file = out / (\"audio-\" + str(number) + \".pcm\")\n            wav_file = out / (\"audio-\" + str(number) + \".wav\")\n            pcm_file.write_bytes(raw)\n            with wave.open(str(wav_file), \"wb\") as wav:\n                wav.setnchannels(1); wav.setsampwidth(2); wav.setframerate(24000); wav.writeframes(raw)\n            record.update({\"pcm\":str(pcm_file), \"wav\":str(wav_file), \"sample_rate_hz\":24000})\n        if identity in texts:\n            text_file = out / (\"text-\" + str(number) + \".txt\")\n            text_file.write_text(texts[identity], encoding=\"utf-8\")\n            record[\"text\"] = str(text_file)\n        manifest[\"parts\"].append(record)\n    (out / \"results.json\").write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding=\"utf-8\")\n    print(\"\\nSaved every received event and result in\", out)\n",
            "label": "Python WebSocket · actual PCM recording and all results",
            "language": "python"
          }
        ],
        "family": "openai",
        "fast_multiplier": null,
        "flex_multiplier": null,
        "fmt": "realtime",
        "http": "GET",
        "img_in": null,
        "img_out": null,
        "in": 0.8,
        "input": [
          "text",
          "audio"
        ],
        "label": "即時語音",
        "max_out": null,
        "max_tool_calls": null,
        "out": 6.4,
        "output": [
          "text",
          "audio"
        ],
        "path": "/v1/realtime?model=qwen-audio-3.0-realtime-plus",
        "pricing_profiles": [
          {
            "dimensions": {},
            "label": "Core",
            "units": [
              {
                "amount": 0.8,
                "amount_unit": "usd_per_million_tokens",
                "key": "in",
                "label": "Input",
                "side": "in"
              },
              {
                "amount": 6.4,
                "amount_unit": "usd_per_million_tokens",
                "key": "out",
                "label": "Output",
                "side": "out"
              },
              {
                "amount": 0.0048,
                "amount_unit": "usd_per_display_unit",
                "key": "audio_input_second",
                "label": "per minute of audio",
                "side": "in"
              },
              {
                "amount": 0.018,
                "amount_unit": "usd_per_display_unit",
                "key": "audio_output_second",
                "label": "per minute of output audio",
                "side": "out"
              }
            ]
          }
        ],
        "request_model_id": "qwen-audio-3.0-realtime-plus",
        "route_label": "Core",
        "status_reads": [],
        "tiers": [],
        "tool_prices": null,
        "unit": "conditional",
        "units": [
          {
            "key": "audio_input_second",
            "label": "per minute of audio",
            "side": "in",
            "usd": 0.0048
          },
          {
            "key": "audio_output_second",
            "label": "per minute of output audio",
            "side": "out",
            "usd": 0.018
          }
        ]
      }
    }
  ],
  "model_id": "qwen-audio-3.0-realtime-plus",
  "nativeProvenance": {
    "input_facts_canonical_sha256": "2a10f98fa28a80ee732b7263526a8094e903266f63b1726342b77745f0b53c26",
    "input_html_sha256": "f9d0a86047e2e83434316da611ec020fa886ed6ea3fad015bdc9cd607e86e52b",
    "private_audit_sha256": "2367840fca63d8be6dd1e7d33749a02e37cede2c349a0a5a7b1b737acfcf5f58",
    "role": "historical-normalized-input-audit-hashes",
    "schema": "ailoot-native-model-provenance-v2"
  },
  "page": {
    "canonical": "https://ailoot.ai/models/zh-hant-tw/qwen-audio-3-0-realtime-plus/",
    "description": "即時語音對話模型，接受語音與文字，並以語音或文字回應。設計重點是自然的交談節奏，以及與工具互動。",
    "locale": "zh-hant-tw",
    "md_url": "https://ailoot.ai/models/zh-hant-tw/qwen-audio-3-0-realtime-plus/index.md",
    "title": "qwen-audio-3.0-realtime-plus — Ailoot",
    "url": "https://ailoot.ai/models/zh-hant-tw/qwen-audio-3-0-realtime-plus/"
  },
  "rawModel": {
    "about": "Qwen-Audio-3.0-Realtime-Plus 是 Alibaba 的即時語音對話模型。它接受語音與文字，以音訊與文字回應，並支援自然交換話語的雙向對話。聲音可分段傳送與接收，讓互動隨對話進行。\n\n### 判斷對方是否說完\n\n可透過聲音活動、語意完整度或明確控制，判斷一次發話的邊界。在模型開發商提供的模式中，須在傳送第一段音訊前選定模式；開始對話後若要變更，必須建立新的連線。這種控制是否可用，取決於選定的方法。語意模式會考量停頓與填充詞：短暫猶豫不一定表示使用者已說完。使用者的新發話可中斷正在形成的回應，讓對話依下一段發話繼續。語意模式下，可用指定對話者的語音樣本引導辨識，以減少其他人聲及背景雜音的干擾。\n\n指令設定助理角色及交談風格。語音表達可考量語調、速度與情緒；3.0 版本提供五種系統聲音，以及依語音樣本設定的聲音。模型支援 11 種語言，包括俄語，也支援模型開發商列出的漢語方言變體。在模型開發商的設定方式中，聲音於第一次更新工作階段設定時指定；同一段對話之後傳入的新聲音會被忽略。這些設定須由選定的呼叫方式支援。\n\n### 工具與對話歷史\n\n支援函式呼叫。模型提出所需動作，連接的應用程式執行動作，再將結果傳回對話。這讓對話能圍繞實際資料展開，並在操作完成後繼續。語音助理可利用工具結果，同時保留對話脈絡。模型開發商的功能也包括內建網路搜尋，前提是選定的方法有提供。網路搜尋與函式呼叫不能在同一工作階段同時啟用。\n\n預設歷史保留 20 輪對話，可設定的範圍為一至 50 輪。累積音訊的上限為 300 秒；超過限制時，較舊的歷史片段會被刪除。這與單次發話的長度不同：歷史設定決定繼續對話時，哪些先前素材仍可使用。\n\n### 文字脈絡與聲音\n\n正式脈絡長度為 40 960 個 Token。輸入長度上限為 16 384 個 Token，輸出上限為 8192；推理模式也採用相同的輸入與輸出上限，另外限制推理鏈最多為 1024 個 Token。\n\n串流聲音使用單聲道、16 位元 PCM：輸入為 16 kHz，輸出為 24 kHz。文字與音訊資料屬於同一段對話。此特定模型未宣稱支援視覺輸入或輸出圖片；專長是語音、文字及語音互動。",
    "alias_of": null,
    "aliases": [],
    "author": "Alibaba",
    "ctx": null,
    "formats": [
      "realtime"
    ],
    "id": "qwen-audio-3.0-realtime-plus",
    "input": [
      "text",
      "audio"
    ],
    "kind": "speech",
    "max_out": null,
    "methods": [
      {
        "cache_read": null,
        "cache_write": null,
        "cache_write_1h": null,
        "cache_write_5m": null,
        "conditional_meter": null,
        "contract": {
          "data": {
            "all_results": "請依每個實際回應 ID，組合所有回傳的音訊增量片段與文字／事件結果。",
            "endpoint": {
              "http": "GET",
              "path": "/v1/realtime",
              "query": {
                "model": "qwen-audio-3.0-realtime-plus"
              },
              "transport": "WebSocket",
              "url": "wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus"
            },
            "errors": [
              {
                "condition": "未進行 WebSocket 升級",
                "http_status": 426,
                "recovery": "請使用 WebSocket 用戶端，並帶入 Upgrade: websocket。",
                "type": "invalid_request_error"
              }
            ],
            "hints": [
              "Append the model query once; do not add another ?model to a URL that already contains it.",
              "Use the actual WebSocket upgrade and API-key authentication.",
              "Tools, web search and voiceprint enhancement are not supported on this exact route."
            ],
            "ignored_fields": [],
            "lifecycle": {
              "close": "Close the actual establishedWebSocket session; no fakeHTTP cancelpath.",
              "mode": "WebSocket session",
              "unknown": "請保留實際的工作階段／回應／事件 ID 與紀錄憑證。"
            },
            "material_combinations": [
              {
                "events": [
                  "session.update",
                  "input_audio_buffer.append",
                  "input_audio_buffer.commit",
                  "input_audio_buffer.clear",
                  "response.create",
                  "response.cancel",
                  "conversation.item.create",
                  "conversation.item.retrieve",
                  "conversation.item.delete"
                ],
                "mode": "realtime_text_audio"
              }
            ],
            "operation_modes": [
              "realtime_text_audio"
            ],
            "outputs": {
              "all_outputs": "Assemble every returned audio delta and text/event result for each actual response ID.",
              "audio_format": "PCM16 mono 24 kHz",
              "family": [
                "text",
                "audio"
              ],
              "format": "工作階段事件"
            },
            "parameters": [
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": [
                  "qwen-audio-3.0-realtime-plus"
                ],
                "enum_known": true,
                "enum_status": "specified",
                "name": "query.model",
                "required": true,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": [
                  "pcm16",
                  "pcm"
                ],
                "enum_known": true,
                "enum_status": "specified",
                "name": "session.input_audio_format",
                "required": false,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": [
                  "pcm16",
                  "pcm"
                ],
                "enum_known": true,
                "enum_status": "specified",
                "name": "session.output_audio_format",
                "required": false,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": null,
                "enum_known": false,
                "enum_status": "not_specified",
                "limit_scope": "所選的工作階段政策",
                "name": "session.instructions",
                "required": false,
                "type": "string"
              },
              {
                "availability": "source_interface",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": null,
                "enum_known": false,
                "enum_status": "not_specified",
                "limit_scope": "所選的工作階段政策",
                "minimum": 1,
                "name": "session.max_history_turns",
                "required": false,
                "type": "integer"
              },
              {
                "availability": "source_interface",
                "content": "PCM16 單聲道；輸入 16 kHz，輸出 24 kHz；位元組長度須非零且為偶數",
                "default": null,
                "default_known": false,
                "default_status": "not_specified",
                "enum": null,
                "enum_known": false,
                "enum_status": "not_specified",
                "name": "input_audio_buffer.append.audio",
                "required": true,
                "type": "base64_string"
              }
            ],
            "unsupported": []
          },
          "hints": [
            "方法結構與 ID 均為精確值；供應商能力與准入狀態分開。"
          ],
          "input": {
            "content_type": "WebSocket",
            "material_types": [
              "text",
              "audio"
            ],
            "optional_controls": null,
            "required": null
          },
          "lifecycle": {
            "mode": "exact retained published method"
          },
          "method": {
            "http": "GET",
            "path": "/v1/realtime?model=qwen-audio-3.0-realtime-plus"
          },
          "operation_modes": [
            "realtime"
          ],
          "output": {
            "family": [
              "text",
              "audio"
            ],
            "format": "session events",
            "multioutputs": "retain every actual response output"
          }
        },
        "ctx": null,
        "examples": [
          {
            "code": "# Install the documented client once: python3 -m pip install websockets\nimport base64, json, os, time, wave\nfrom pathlib import Path\nfrom websockets.sync.client import connect\n\nkey = os.environ.get(\"AILOOT_API_KEY\", \"\")\nif not key.strip():\n    raise SystemExit(\"Set your AILOOT_API_KEY before connecting\")\nfile = Path(os.environ.get(\"AILOOT_TEXT_FILE\", \"\"))\nif not file.is_file(): raise SystemExit(\"Set AILOOT_TEXT_FILE to your actual UTF-8 material\")\nmaterial = file.read_text(encoding=\"utf-8\")\nif not material.strip(): raise SystemExit(\"Text material must not be empty\")\nout = Path(\"realtime-results\")\nout.mkdir(exist_ok=True)\naudio, texts, complete = {}, {}, []\ncurrent_response = None\npending = False\ndeadline = time.monotonic() + 570  # Local client bound; lower server/session limits still apply.\n\ndef receive(ws, log):\n    global current_response, pending\n    left = deadline - time.monotonic()\n    if left <= 0:\n        raise TimeoutError(\"Client session limit; preserve IDs and partial results, do not replay\")\n    event = json.loads(ws.recv(timeout=min(60, left)))\n    log.write(json.dumps(event, ensure_ascii=False) + \"\\n\")\n    log.flush()\n    kind = event.get(\"type\")\n    if kind == \"error\":\n        raise RuntimeError(json.dumps(event, ensure_ascii=False))\n    if kind == \"response.created\":\n        current_response = event[\"response\"][\"id\"]\n    if kind in {\"response.audio.delta\", \"response.output_audio.delta\", \"response.text.delta\", \"response.output_text.delta\", \"response.audio_transcript.delta\", \"response.output_audio_transcript.delta\", \"response.text.done\", \"response.audio_transcript.done\"}:\n        identity = (event[\"response_id\"], event[\"item_id\"], event[\"output_index\"], event[\"content_index\"])\n        if kind in {\"response.audio.delta\", \"response.output_audio.delta\"}:\n            raw = base64.b64decode(event[\"delta\"], validate=True)\n            if len(raw) % 2: raise ValueError(\"Output PCM16 chunk must have an even byte length\")\n            audio.setdefault(identity, bytearray()).extend(raw)\n        elif kind.endswith(\".done\"):\n            texts[identity] = event.get(\"text\", event.get(\"transcript\", \"\"))\n        else:\n            texts[identity] = texts.get(identity, \"\") + event[\"delta\"]\n            print(event[\"delta\"], end=\"\", flush=True)\n    if kind == \"response.done\":\n        response = event[\"response\"]\n        complete.append(response)\n        if current_response is None: current_response = response[\"id\"]\n        if response[\"id\"] == current_response: pending = False\n    return event\n\ndef wait_for(ws, log, kind):\n    while True:\n        event = receive(ws, log)\n        if event.get(\"type\") == kind: return event\n\ndef send(ws, event):\n    ws.send(json.dumps(event, ensure_ascii=False))\n\ntry:\n    # One exact model query; no reconnect/retry loop and no provider credentials.\n    with connect(\"wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus\", additional_headers={\"Authorization\": \"Bearer \" + key}) as ws:\n        with (out / \"events.jsonl\").open(\"w\", encoding=\"utf-8\") as log:\n            wait_for(ws, log, \"session.created\")\n            send(ws, {\"type\":\"session.update\", \"session\":{\"modalities\":[\"audio\",\"text\"], \"input_audio_format\":\"pcm\", \"output_audio_format\":\"pcm\", \"turn_detection\":None}})\n            wait_for(ws, log, \"session.updated\")\n            send(ws, {\"type\":\"conversation.item.create\", \"item\":{\"type\":\"message\", \"role\":\"user\", \"content\":[{\"type\":\"input_text\", \"text\":material}]}})\n            send(ws, {\"type\":\"response.create\"})\n            pending = True\n            try:\n                while pending: receive(ws, log)\n            except KeyboardInterrupt:\n                # Cancel the actual current inference, then preserve its returned status.\n                send(ws, {\"type\":\"response.cancel\"})\n                while pending: receive(ws, log)\n    if not complete or complete[-1].get(\"status\") != \"completed\":\n        raise RuntimeError(\"Response did not complete normally; inspect saved events and status\")\nfinally:\n    manifest = {\"responses\":complete, \"parts\":[]}\n    for number, identity in enumerate(dict.fromkeys(list(audio) + list(texts))):\n        record = {\"response_id\":identity[0], \"item_id\":identity[1], \"output_index\":identity[2], \"content_index\":identity[3]}\n        if identity in audio:\n            raw = bytes(audio[identity])\n            pcm_file = out / (\"audio-\" + str(number) + \".pcm\")\n            wav_file = out / (\"audio-\" + str(number) + \".wav\")\n            pcm_file.write_bytes(raw)\n            with wave.open(str(wav_file), \"wb\") as wav:\n                wav.setnchannels(1); wav.setsampwidth(2); wav.setframerate(24000); wav.writeframes(raw)\n            record.update({\"pcm\":str(pcm_file), \"wav\":str(wav_file), \"sample_rate_hz\":24000})\n        if identity in texts:\n            text_file = out / (\"text-\" + str(number) + \".txt\")\n            text_file.write_text(texts[identity], encoding=\"utf-8\")\n            record[\"text\"] = str(text_file)\n        manifest[\"parts\"].append(record)\n    (out / \"results.json\").write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding=\"utf-8\")\n    print(\"\\nSaved every received event and result in\", out)\n",
            "label": "Python WebSocket · text material and all text/audio results",
            "language": "python"
          },
          {
            "code": "# Install the documented client once: python3 -m pip install websockets\nimport base64, json, os, time, wave\nfrom pathlib import Path\nfrom websockets.sync.client import connect\n\nkey = os.environ.get(\"AILOOT_API_KEY\", \"\")\nif not key.strip():\n    raise SystemExit(\"Set your AILOOT_API_KEY before connecting\")\nfile = Path(os.environ.get(\"AILOOT_AUDIO_FILE\", \"\"))\nif not file.is_file(): raise SystemExit(\"Set AILOOT_AUDIO_FILE to your raw PCM16 mono 16-kHz recording\")\nmaterial = file.read_bytes()\nif not material or len(material) % 2 or material.startswith(b\"RIFF\"):\n    raise SystemExit(\"Use nonempty signed little-endian PCM16 mono 16-kHz bytes, not a WAV header\")\nout = Path(\"realtime-results\")\nout.mkdir(exist_ok=True)\naudio, texts, complete = {}, {}, []\ncurrent_response = None\npending = False\ndeadline = time.monotonic() + 570  # Local client bound; lower server/session limits still apply.\n\ndef receive(ws, log):\n    global current_response, pending\n    left = deadline - time.monotonic()\n    if left <= 0:\n        raise TimeoutError(\"Client session limit; preserve IDs and partial results, do not replay\")\n    event = json.loads(ws.recv(timeout=min(60, left)))\n    log.write(json.dumps(event, ensure_ascii=False) + \"\\n\")\n    log.flush()\n    kind = event.get(\"type\")\n    if kind == \"error\":\n        raise RuntimeError(json.dumps(event, ensure_ascii=False))\n    if kind == \"response.created\":\n        current_response = event[\"response\"][\"id\"]\n    if kind in {\"response.audio.delta\", \"response.output_audio.delta\", \"response.text.delta\", \"response.output_text.delta\", \"response.audio_transcript.delta\", \"response.output_audio_transcript.delta\", \"response.text.done\", \"response.audio_transcript.done\"}:\n        identity = (event[\"response_id\"], event[\"item_id\"], event[\"output_index\"], event[\"content_index\"])\n        if kind in {\"response.audio.delta\", \"response.output_audio.delta\"}:\n            raw = base64.b64decode(event[\"delta\"], validate=True)\n            if len(raw) % 2: raise ValueError(\"Output PCM16 chunk must have an even byte length\")\n            audio.setdefault(identity, bytearray()).extend(raw)\n        elif kind.endswith(\".done\"):\n            texts[identity] = event.get(\"text\", event.get(\"transcript\", \"\"))\n        else:\n            texts[identity] = texts.get(identity, \"\") + event[\"delta\"]\n            print(event[\"delta\"], end=\"\", flush=True)\n    if kind == \"response.done\":\n        response = event[\"response\"]\n        complete.append(response)\n        if current_response is None: current_response = response[\"id\"]\n        if response[\"id\"] == current_response: pending = False\n    return event\n\ndef wait_for(ws, log, kind):\n    while True:\n        event = receive(ws, log)\n        if event.get(\"type\") == kind: return event\n\ndef send(ws, event):\n    ws.send(json.dumps(event, ensure_ascii=False))\n\ntry:\n    # One exact model query; no reconnect/retry loop and no provider credentials.\n    with connect(\"wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus\", additional_headers={\"Authorization\": \"Bearer \" + key}) as ws:\n        with (out / \"events.jsonl\").open(\"w\", encoding=\"utf-8\") as log:\n            wait_for(ws, log, \"session.created\")\n            send(ws, {\"type\":\"session.update\", \"session\":{\"modalities\":[\"audio\",\"text\"], \"input_audio_format\":\"pcm\", \"output_audio_format\":\"pcm\", \"turn_detection\":None}})\n            wait_for(ws, log, \"session.updated\")\n            for offset in range(0, len(material), 640):\n                send(ws, {\"type\":\"input_audio_buffer.append\", \"audio\":base64.b64encode(material[offset:offset+640]).decode(\"ascii\")})\n                time.sleep(0.02)\n            send(ws, {\"type\":\"input_audio_buffer.commit\"})\n            wait_for(ws, log, \"input_audio_buffer.committed\")\n            send(ws, {\"type\":\"response.create\"})\n            pending = True\n            try:\n                while pending: receive(ws, log)\n            except KeyboardInterrupt:\n                # Cancel the actual current inference, then preserve its returned status.\n                send(ws, {\"type\":\"response.cancel\"})\n                while pending: receive(ws, log)\n    if not complete or complete[-1].get(\"status\") != \"completed\":\n        raise RuntimeError(\"Response did not complete normally; inspect saved events and status\")\nfinally:\n    manifest = {\"responses\":complete, \"parts\":[]}\n    for number, identity in enumerate(dict.fromkeys(list(audio) + list(texts))):\n        record = {\"response_id\":identity[0], \"item_id\":identity[1], \"output_index\":identity[2], \"content_index\":identity[3]}\n        if identity in audio:\n            raw = bytes(audio[identity])\n            pcm_file = out / (\"audio-\" + str(number) + \".pcm\")\n            wav_file = out / (\"audio-\" + str(number) + \".wav\")\n            pcm_file.write_bytes(raw)\n            with wave.open(str(wav_file), \"wb\") as wav:\n                wav.setnchannels(1); wav.setsampwidth(2); wav.setframerate(24000); wav.writeframes(raw)\n            record.update({\"pcm\":str(pcm_file), \"wav\":str(wav_file), \"sample_rate_hz\":24000})\n        if identity in texts:\n            text_file = out / (\"text-\" + str(number) + \".txt\")\n            text_file.write_text(texts[identity], encoding=\"utf-8\")\n            record[\"text\"] = str(text_file)\n        manifest[\"parts\"].append(record)\n    (out / \"results.json\").write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding=\"utf-8\")\n    print(\"\\nSaved every received event and result in\", out)\n",
            "label": "Python WebSocket · actual PCM recording and all results",
            "language": "python"
          }
        ],
        "family": "openai",
        "fast_multiplier": null,
        "flex_multiplier": null,
        "fmt": "realtime",
        "http": "GET",
        "img_in": null,
        "img_out": null,
        "in": 0.8,
        "input": [
          "text",
          "audio"
        ],
        "label": "即時語音",
        "max_out": null,
        "max_tool_calls": null,
        "out": 6.4,
        "output": [
          "text",
          "audio"
        ],
        "path": "/v1/realtime?model=qwen-audio-3.0-realtime-plus",
        "pricing_profiles": [
          {
            "dimensions": {},
            "label": "Core",
            "units": [
              {
                "amount": 0.8,
                "amount_unit": "usd_per_million_tokens",
                "key": "in",
                "label": "Input",
                "side": "in"
              },
              {
                "amount": 6.4,
                "amount_unit": "usd_per_million_tokens",
                "key": "out",
                "label": "Output",
                "side": "out"
              },
              {
                "amount": 0.0048,
                "amount_unit": "usd_per_display_unit",
                "key": "audio_input_second",
                "label": "per minute of audio",
                "side": "in"
              },
              {
                "amount": 0.018,
                "amount_unit": "usd_per_display_unit",
                "key": "audio_output_second",
                "label": "per minute of output audio",
                "side": "out"
              }
            ]
          }
        ],
        "request_model_id": "qwen-audio-3.0-realtime-plus",
        "route_label": "Core",
        "status_reads": [],
        "tiers": [],
        "tool_prices": null,
        "unit": "conditional",
        "units": [
          {
            "key": "audio_input_second",
            "label": "per minute of audio",
            "side": "in",
            "usd": 0.0048
          },
          {
            "key": "audio_output_second",
            "label": "per minute of output audio",
            "side": "out",
            "usd": 0.018
          }
        ]
      }
    ],
    "model_aliases": [
      {
        "canonical_model_id": "qwen-audio-3.0-realtime-plus",
        "request_model_id": "qwen-audio-3.0-realtime-plus",
        "route_label": "Core"
      }
    ],
    "name": "qwen-audio-3.0-realtime-plus",
    "price": {
      "in": 0.8,
      "in_label": null,
      "out": 6.4,
      "out_label": null,
      "sort_in": 0.8,
      "sort_out": 6.4,
      "varies": false
    },
    "short": "即時語音對話模型，接受語音與文字，並以語音或文字回應。設計重點是自然的交談節奏，以及與工具互動。"
  },
  "renderer_schema": {
    "method_order": "Original DTO methods order; every exact route/format/path/caller survives.",
    "prices": "Original public DTO fields and original native display HTML; no flattened or normalized offers."
  },
  "representation": "exact-public-dto-and-native-renderer-html",
  "representationNotes": {
    "current_reference": {
      "about_json_pointer": "/aboutHtml",
      "methods": [
        {
          "contract_json_pointer": "/methods/0/rawMethod/contract",
          "html_json_pointer": "/methods/0/html",
          "method_ordinal": 0
        }
      ],
      "role": "current-semantic-reference"
    },
    "raw_input": {
      "examples_role": "historical-input-not-current-ready-examples",
      "json_pointers": [
        "/rawModel",
        "/methods/0/rawMethod"
      ],
      "role": "historical-owner-input"
    },
    "schema": "ailoot-native-model-representations-v1"
  },
  "schema": "ailoot-static-model-facts-v1",
  "schema_version": 1,
  "shortText": "即時語音對話模型，接受語音與文字，並以語音或文字回應。設計重點是自然的交談節奏，以及與工具互動。",
  "source": {
    "audit_sha256": "2e00086bcbfc28e64d0cebe97aa47c17d8d5618963027f8ffb9dc6123d7d25b1",
    "bridge_map_sha256": "1125275768b9636fc8461bc7da5061239a81ddfe508e2557843ca42c58ab0036",
    "raw_model_json_sha256": "a1d1c38d6a57e9f00a2b6ade9988bf927a075566f93b431e618b334caedca23f",
    "renderer_sha256": "13a3fc1b22d07359278e2249d630bfc9bb9e6416c71ba53def933fb5a903660b"
  },
  "sourceRevision": "45c73078edac05a24fb2f8f631929245af841da49d072e3dc1cce06c06786c31"
}
