すべてのプロダクト
Search
ドキュメントセンター

Alibaba Cloud Model Studio:Qwen-Audio-ASR-Streaming サーバーイベント

最終更新日:Nov 16, 2026

Qwen-Audio-ASR-Streaming の サーバーイベントリファレンス。タスク開始、認識結果、完了、失敗のフィールドと対応するリクエストを説明します。

イベントフロー

  1. run-task を送信し、task-started を受信してから音声の送信を開始します。
  2. 音声を継続して送信しながら、result-generated を受信します。
  3. すべての音声の送信後に finish-task を送信し、task-finished まで結果を受信します。タスクが失敗すると task-failed が返されます。

音声データは run-task では送信しません。WebSocket ではバイナリフレーム、AOQ では Audio Track を使用します。接続、認証、音声転送については、WebSocket API または AOQ 接続 をご参照ください。

task-started

タスクが正常に開始され、クライアントが音声を送信できることを示します。

重要task-started を受信してから音声を送信してください。 run-task はタスクの開始と設定に使用し、音声データは含みません。

headerobject
task_idstring

クライアントによって生成されたタスク ID (UUID フォーマット)。

eventstring

イベントタイプ。この値は常に task-started です。

attributesobject

追加の属性。この値は通常、空です。

payloadobject

この値は常に {} です。

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "task_uuid": "f32fbf86736e4c279b5d133bff74b657",
    "event": "task-started",
    "attributes": {}
  },
  "payload": {}
}

result-generated

文の開始、中間結果、文の最終結果、ハートビートなどの認識結果を返します。

重要sentence_end=true は文の終了を示し、タスクの終了ではありません。 ハートビート結果(heartbeat=true)はスキップできます。タスクの終了は task-finished で判断します。

headerobject
task_idstring

クライアントによって生成されたタスク ID (UUID フォーマット)。

eventstring

イベントタイプ。この値は常に result-generated です。

payloadobject
outputobject
sentenceobject
sentence_idinteger

文のシーケンス識別子。通常の認識結果では、sentence_id は 1 から増分します。heartbeat が true (つまり、ハートビートパケット) の場合、sentence_id は常に 0 です。

begin_timeinteger

文の開始時刻 (ミリ秒単位)。

end_timeinteger | null

文の終了時刻 (ミリ秒単位)。 中間結果またはハートビートでは null の場合があります。

textstring

認識されたテキスト。

sentence_beginboolean

文の開始を示します。

sentence_endboolean

文が終了したかどうか (true = 最終結果、false = 中間結果)。

heartbeatboolean

この値が true の場合、結果はハートビートパケットであり、無視できます。

wordsarray[object]

単語レベルのタイムスタンプ情報。

begin_timeinteger

単語の開始時刻 (ミリ秒単位)。

end_timeinteger

単語の終了時刻 (ミリ秒単位)。

textstring

認識されたテキスト。

punctuationstring

句読点。

usageobject

現在のタスクの累積使用量。

注記usage は現在のタスクの累積使用量で、一部の中間結果には含まれない場合があります。イベント間で usage を合計しないでください。 qwen-audio-3.0-asr-flash-streaming は時間、qwen-audio-3.1-asr-flash-streaming はトークンに基づいて課金されます。各フィールドの適用範囲は以下をご確認ください。

durationinteger

累積音声時間(秒)。

注記qwen-audio-3.0-asr-flash-streaming の課金に使用します。

input_tokensinteger

累積入力トークン数。

注記適用モデル: qwen-audio-3.1-asr-flash-streaming。

output_tokensinteger

累積出力トークン数。

注記適用モデル: qwen-audio-3.1-asr-flash-streaming。

total_tokensinteger

入力と出力のトークン数を合計した累積トークン数。

注記適用モデル: qwen-audio-3.1-asr-flash-streaming。

文の開始

task-started を受信してから音声を送信します。以下は、その後に返される result-generated イベントの例です。音声は WebSocket のバイナリフレームまたは AOQ の Audio Track で送信します。

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 1,
        "begin_time": 0,
        "end_time": null,
        "text": "",
        "channel_id": 0,
        "sentence_end": false,
        "sentence_begin": true,
        "words": []
      },
      "text": "",
      "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
      "output": {
        "sentence": {
          "sentence_id": 1,
          "begin_time": 0,
          "end_time": null,
          "text": "",
          "channel_id": 0,
          "sentence_end": false,
          "sentence_begin": true,
          "words": []
        },
        "text": "",
        "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4"
      }
    }
  }
}

中間結果

task-started を受信してから音声を送信します。以下は、その後に返される result-generated イベントの例です。音声は WebSocket のバイナリフレームまたは AOQ の Audio Track で送信します。

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 1,
        "begin_time": 0,
        "end_time": null,
        "text": "Please",
        "channel_id": 0,
        "sentence_end": false,
        "words": [
          {
            "begin_time": 0,
            "end_time": 320,
            "text": "Please",
            "punctuation": "",
            "fixed": false,
            "speaker_id": null
          }
        ]
      },
      "text": "Please",
      "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
      "output": {
        "sentence": {
          "sentence_id": 1,
          "begin_time": 0,
          "end_time": null,
          "text": "Please",
          "channel_id": 0,
          "sentence_end": false,
          "words": [
            {
              "begin_time": 0,
              "end_time": 320,
              "text": "Please",
              "punctuation": "",
              "fixed": false,
              "speaker_id": null
            }
          ]
        },
        "text": "Please",
        "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4"
      }
    }
  }
}

文の最終結果

task-started を受信してから音声を送信します。以下は、その後に返される result-generated イベントの例です。音声は WebSocket のバイナリフレームまたは AOQ の Audio Track で送信します。

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 1,
        "begin_time": 120,
        "end_time": 3990,
        "text": "Please send the quarterly project report to Kellera before Friday. ",
        "channel_id": 0,
        "sentence_end": true,
        "words": [
          {
            "begin_time": 120,
            "end_time": 320,
            "text": "Please",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 320,
            "end_time": 560,
            "text": " send",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 560,
            "end_time": 760,
            "text": " the",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 760,
            "end_time": 1360,
            "text": " quarterly",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 1360,
            "end_time": 1800,
            "text": " project",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 1800,
            "end_time": 2120,
            "text": " report",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2120,
            "end_time": 2280,
            "text": " to",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2280,
            "end_time": 2336,
            "text": " ",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2336,
            "end_time": 2560,
            "text": "Kell",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2560,
            "end_time": 2800,
            "text": "era",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2800,
            "end_time": 3160,
            "text": " before",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 3160,
            "end_time": 3990,
            "text": " Friday",
            "punctuation": ". ",
            "fixed": true,
            "speaker_id": null
          }
        ],
        "stash": {
          "sentence_id": 2,
          "text": "",
          "begin_time": 3990,
          "current_time": 3990,
          "words": []
        }
      },
      "text": "Please send the quarterly project report to Kellera before Friday. ",
      "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
      "output": {
        "sentence": {
          "sentence_id": 1,
          "begin_time": 120,
          "end_time": 3990,
          "text": "Please send the quarterly project report to Kellera before Friday. ",
          "channel_id": 0,
          "sentence_end": true,
          "words": [
            {
              "begin_time": 120,
              "end_time": 320,
              "text": "Please",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 320,
              "end_time": 560,
              "text": " send",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 560,
              "end_time": 760,
              "text": " the",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 760,
              "end_time": 1360,
              "text": " quarterly",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 1360,
              "end_time": 1800,
              "text": " project",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 1800,
              "end_time": 2120,
              "text": " report",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2120,
              "end_time": 2280,
              "text": " to",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2280,
              "end_time": 2336,
              "text": " ",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2336,
              "end_time": 2560,
              "text": "Kell",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2560,
              "end_time": 2800,
              "text": "era",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2800,
              "end_time": 3160,
              "text": " before",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 3160,
              "end_time": 3990,
              "text": " Friday",
              "punctuation": ". ",
              "fixed": true,
              "speaker_id": null
            }
          ],
          "stash": {
            "sentence_id": 2,
            "text": "",
            "begin_time": 3990,
            "current_time": 3990,
            "words": []
          }
        },
        "text": "Please send the quarterly project report to Kellera before Friday. ",
        "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4"
      },
      "usage": {
        "duration": 4,
        "input_tokens": 50,
        "output_tokens": 13,
        "total_tokens": 63
      }
    },
    "usage": {
      "duration": 4,
      "input_tokens": 50,
      "output_tokens": 13,
      "total_tokens": 63
    }
  }
}

ハートビート

run-task で heartbeat=true を設定し、無音の音声を継続して送信します。以下は、サーバーから返されるハートビートイベントの例です。

{
  "header": {
    "action": "run-task",
    "task_id": "eac269a3-a31d-417a-979d-51066926d8a6",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000,
      "heartbeat": true
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "eac269a3-a31d-417a-979d-51066926d8a6",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 0,
        "begin_time": 0,
        "end_time": null,
        "text": "",
        "channel_id": 0,
        "speaker_id": null,
        "sentence_end": false,
        "heartbeat": true,
        "words": []
      },
      "text": "",
      "request_id": "eac269a3-a31d-417a-979d-51066926d8a6",
      "output": {
        "sentence": {
          "sentence_id": 0,
          "begin_time": 0,
          "end_time": null,
          "text": "",
          "channel_id": 0,
          "speaker_id": null,
          "sentence_end": false,
          "heartbeat": true,
          "words": []
        },
        "text": "",
        "request_id": "eac269a3-a31d-417a-979d-51066926d8a6"
      }
    },
    "usage": {
      "duration": 2
    }
  }
}

task-finished

タスクの処理が完了し、すべての認識結果が返されたことを示します。

headerobject
task_idstring

クライアントによって生成されたタスク ID (UUID フォーマット)。

eventstring

イベントタイプ。この値は常に task-finished です。

attributesobject

追加の属性。この値は通常、空です。

payloadobject
usageobject

タスク終了時の累積使用量。各フィールドの意味は result-generated.usageと同じです。

{
  "header": {
    "action": "finish-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "task-finished",
    "attributes": {}
  },
  "payload": {
    "output": {},
    "usage": {
      "duration": 4,
      "input_tokens": 50,
      "output_tokens": 13,
      "total_tokens": 63
    }
  }
}

task-failed

タスクの失敗を示します。原因は error_code と error_message で確認します。タスクの失敗後、WebSocket 接続は閉じられ、再利用できません。

headerobject
task_idstring

クライアントによって生成されたタスク ID (UUID フォーマット)。

eventstring

イベントタイプ。この値は常に task-failed です。

error_codestring

エラータイプの詳細。

error_messagestring

エラーの具体的な原因。

attributesobject

追加の属性。この値は通常、空です。

payloadobject

この値は常に {} です。

以下ではサポートされていない音声形式を指定し、task-failed を示します。エラーコードとメッセージは失敗の原因により異なります。

{
  "header": {
    "action": "run-task",
    "task_id": "9272a5a2-8df4-4f2d-af0e-e544c17f3e42",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "invalid-format",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "9272a5a2-8df4-4f2d-af0e-e544c17f3e42",
    "event": "task-failed",
    "error_code": "UNSUPPORTED_FORMAT",
    "error_message": "UNSUPPORTED_FORMAT"
  },
  "payload": {}
}