All Products
Search
Document Center

Alibaba Cloud Model Studio:Qwen-Audio-Live Client events

Last Updated:Nov 23, 2026

Configure a session, send audio, and return task results.

Send JSON events by controlling the WebSocket. For connection and authentication, see WebSocket integration.

session.update

Configure a session. The service confirms that the configuration has taken effect via session.updated. With pure WebSocket integration, audio can be sent immediately after this step. For WebRTC and AOQ, you must wait for their respective media connections to become ready.

typestringRequired

Event type; fixed value: session.update.

event_idstringRequired

Client event ID. Non-empty; maximum length: 128 characters.

sessionobjectRequired

Session configuration.

View child fields

modelstringRequired

Frontend speech model ID used for the session. Options: qwen-audio-4.0-realtime-preview or qwen-audio-3.1-realtime-flash.

For duplex conversations, use qwen-audio-4.0-realtime-preview and set turn_detection.type to duplex.

instructionsstringOptional

If you omit session.instructions in the initial session configuration, the frontend model uses its built-in instructions. Providing session.instructions replaces them.

modalitiesarrayOptional

Output modality. Default includes audio and text.

voicestringOptional

System voice ID used by the frontend model. Default value: yunshu.

Voice nameVoice ID
云舒yunshu
小满xiaoman
晚风wanfeng
青柚qingyou
破晓poxiao
麦芽maiya
乌龙wulong
雪松xuesong
turn_detectionobjectOptional

Turn detection configuration.

View child fields

typestringRequired

Set to duplex for duplex conversations, and select qwen-audio-4.0-realtime-preview as the frontend model.

input_audio_formatstringOptional

Input format. Pure WebSocket uses pcm, defaulting to 16 kHz, mono PCM16LE.

output_audio_formatstringOptional

Output format. Pure WebSocket uses pcm, defaulting to 24 kHz, mono PCM16LE.

toolsarray[object]Optional

Frontend functions executable by the application. Default: empty array.

View child fields

typestring

Tool type. Use function for a custom function.

namestring

Function name.

descriptionstring

What the function does.

parametersobject

Function parameters defined using JSON Schema.

View child fields

typestring

Parameter structure. Use object for an object.

propertiesobject

Types and constraints of parameters, keyed by the names defined by your application.

requiredarray[string]

Names of the required parameters.

additionalPropertiesboolean | object

Controls whether undeclared parameters are allowed. Set to false to reject them.

delegationobjectRequired

Task execution method.

View child fields

typestringRequired

client: Task executed by the application. responses: Backend Responses model invoked by the service.

responsesobjectConditionally required

Required in Responses mode. Model Studio passes the settings documented here to the backend model. See the Responses API for the tool definition format.

View child fields

modelstringRequired

Backend Responses model ID for handling delegated tasks, e.g., qwen4-max.

instructionsstringOptional

Task instructions for the backend model in Responses mode. Model Studio supplies no built-in backend instructions.

toolsarray[object]Optional

Declares tools available for the backend model. The structure of each tool depends on its type. The fields below apply to custom functions (type is function).

View child fields

typestring

Tool type. Use function for a custom function.

namestring

Function name.

descriptionstring

What the function does.

parametersobject

Function parameters defined using JSON Schema.

View child fields

typestring

Parameter structure. Use object for an object.

propertiesobject

Types and constraints of parameters, keyed by the names defined by your application.

requiredarray[string]

Names of the required parameters.

additionalPropertiesboolean | object

Controls whether undeclared parameters are allowed. Set to false to reject them.

transportobjectOptional

Uses WebSocket if omitted or an empty object is passed.

View child fields

typestringConditionally required

Specify the transport method explicitly. websocket uses WebSocket, rtc uses WebRTC, and aoq uses AOQ.

sdpstringConditionally required

Required when type is rtc. Pass the Offer SDP generated by the client. See WebRTC integration.

aoqobjectOptional

AOQ configuration.

View child fields

ws_audiobooleanOptional

Whether to deliver downstream audio via WebSocket in addition. Default is false.

Client mode

{
  "type": "session.update",
  "event_id": "evt_update_client",
  "session": {
    "model": "qwen-audio-4.0-realtime-preview",
    "modalities": [
      "text",
      "audio"
    ],
    "turn_detection": {
      "type": "duplex"
    },
    "delegation": {
      "type": "client"
    }
  }
}

Responses mode

{
  "type": "session.update",
  "event_id": "evt_update_responses",
  "session": {
    "model": "qwen-audio-4.0-realtime-preview",
    "modalities": [
      "text",
      "audio"
    ],
    "turn_detection": {
      "type": "duplex"
    },
    "delegation": {
      "type": "responses",
      "responses": {
        "model": "qwen4-max"
      }
    }
  }
}

session.input_audio.append

Sends one frame of audio in a pure WebSocket session. Audio is sent via AOQ in AOQ sessions.

typestringRequired

Event type; fixed value: session.input_audio.append.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

audiostringRequired

Base64-encoded 16 kHz, 16-bit, mono PCM16LE.

{
  "type": "session.input_audio.append",
  "audio": "AAAAAA=="
}

session.input_audio.mute

Mutes audio input. The service returns session.input_audio.muted.

typestringRequired

Event type; fixed value: session.input_audio.mute.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

{
  "type": "session.input_audio.mute",
  "event_id": "evt_mute"
}

session.input_audio.unmute

Resumes audio input. The service returns session.input_audio.unmuted.

typestringRequired

Event type; fixed value: session.input_audio.unmute.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

{
  "type": "session.input_audio.unmute",
  "event_id": "evt_unmute"
}

session.item.create

Input user text or return the result of a frontend function. The application executes the function at most once per call_id.

typestringRequired

Event type; fixed value: session.item.create.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

itemobjectFill according to purpose.

Session content to be written.

View child fields

typestringRequired

Enter message or function_call_output.

rolestringFill according to type.

Example for message: user.

contentarrayFill according to type.

Content of message.

View child fields

typestringRequired

Enter input_text for text input.

textstringRequired

User text.

call_idstringFill according to type.

Frontend function call ID corresponding to function_call_output.

outputstringFill according to type.

String result of function_call_output.

Return function result

{
  "type": "session.item.create",
  "event_id": "evt_function_result",
  "item": {
    "type": "function_call_output",
    "call_id": "call_stock",
    "output": "{\"stock\":7}"
  }
}

Input text

{
  "type": "session.item.create",
  "event_id": "evt_user_message",
  "item": {
    "role": "user",
    "type": "message",
    "content": [
      {
        "type": "input_text",
        "text": "请查询雨伞库存。"
      }
    ]
  }
}

session.thinking.append

Update task progress. The service returns session.thinking.appended.

typestringRequired

Event type; fixed value: session.thinking.append.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

delegation_idstringRequired

Use the ID from session.delegation.created received over the current connection.

contentstringRequired

Task progress.

start_msnumberOptional

Start time on the session timeline, in milliseconds.

end_msnumberOptional

End time, in milliseconds. Provided in conjunction with start_ms. Both values must be finite and non-negative, and the end time must not precede the start time.

{
  "type": "session.thinking.append",
  "event_id": "evt_thinking",
  "delegation_id": "task_stock",
  "content": "正在查询库存。"
}

session.instruction.append

Provides questions requiring user input. The service returns session.instructions.appended.

typestringRequired

Event type; fixed value: session.instruction.append.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

delegation_idstringRequired

Use the ID from session.delegation.created received over the current connection.

task_idstringOptional

Typically omitted.

contentstringRequired

Information requiring user input.

start_msnumberOptional

Start time on the session timeline, in milliseconds.

end_msnumberOptional

End time, in milliseconds. Provided in conjunction with start_ms. Both values must be finite and non-negative, and the end time must not precede the start time.

{
  "type": "session.instruction.append",
  "event_id": "evt_instruction",
  "delegation_id": "task_stock",
  "content": "请问要查哪种商品的库存?"
}

session.commentary.append

Returns the task result handled by this connection, or submits user text. The service returns session.commentary.appended.

typestringRequired

Event type; fixed value: session.commentary.append.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

delegation_idstringRequired when returning a task result.

Use the ID from session.delegation.created received over the current connection.

contentstringOptional

Task result or user text.

start_msnumberOptional

Start time on the session timeline, in milliseconds.

end_msnumberOptional

End time, in milliseconds. Provided in conjunction with start_ms. Both values must be finite and non-negative, and the end time must not precede the start time.

errorobjectOptional

Task error message.

Return task result.

{
  "type": "session.commentary.append",
  "event_id": "evt_stock_result",
  "delegation_id": "task_stock",
  "content": "库存还有七把雨伞。"
}

Input text

{
  "type": "session.commentary.append",
  "event_id": "evt_user_text",
  "content": "请查询雨伞库存。"
}

response.item.create

Add backend input in Responses mode. Then send response.create to trigger generation.

typestringRequired

Event type; fixed value: response.item.create.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

itemobjectRequired

Backend input. Supports message and function_call_output.

View child fields

typestringRequired

Input item type.

rolestringFill according to type.

Example for message: user.

contentarrayFill according to type.

User message content.

View child fields

typestringRequired

Enter input_text for text input.

textstringRequired

User text.

call_idstring

Function call ID for function_call_output. Use the call_id returned in the backend event.

outputstring

Function result as a string for function_call_output.

Input text

{
  "type": "response.item.create",
  "event_id": "evt_backend_item",
  "item": {
    "role": "user",
    "type": "message",
    "content": [
      {
        "type": "input_text",
        "text": "请查询雨伞库存。"
      }
    ]
  }
}

Return a backend function result

{
  "type": "response.item.create",
  "event_id": "evt_backend_output",
  "item": {
    "type": "function_call_output",
    "call_id": "call_stock_001",
    "output": "{\"stock\":7}"
  }
}

response.create

Initiate a new backend task. The service returns backend events via response.event. When explicitly initiated, the service returns backend events directly; only auto-delegated workflows send session.delegation.created.

typestringRequired

Event type; fixed value: response.create.

event_idstringOptional

Client event ID. Non-empty; maximum length: 128 characters.

responseobjectOptional

Pass backend generation configuration. For configuration format, see Responses API.

{
  "type": "response.create",
  "event_id": "evt_backend_create"
}

session.close

Terminate the session. The service returns session.closed.

typestringRequired

Event type; fixed value: session.close.

event_idstringRequired

Client event ID. Non-empty; maximum length: 128 characters.

{
  "type": "session.close",
  "event_id": "evt_close"
}