Skip to main content
Qwen-Audio-Live

Qwen-Audio-Live Client events

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. type (string, Required) Event type; fixed value: session.update. event_id (string, Required) Client event ID. Non-empty; maximum length: 128 characters. session (object, Required) Session configuration.
model (string, Required)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.instructions (string, Optional)If you omit session.instructions in the initial session configuration, the frontend model uses its built-in instructions. Providing session.instructions replaces them.modalities (array, Optional)Output modality. Default includes audio and text.voice (string, Optional)System voice ID used by the frontend model. Default value: yunshu.
Voice nameVoice ID
云舒yunshu
小满xiaoman
晚风wanfeng
青柚qingyou
破晓poxiao
麦芽maiya
乌龙wulong
雪松xuesong
turn_detection (object, Optional)Turn detection configuration.
type (string, Required)Set to duplex for duplex conversations, and select qwen-audio-4.0-realtime-preview as the frontend model.
input_audio_format (string, Optional)Input format. Pure WebSocket uses pcm, defaulting to 16 kHz, mono PCM16LE.output_audio_format (string, Optional)Output format. Pure WebSocket uses pcm, defaulting to 24 kHz, mono PCM16LE.tools (array[object], Optional)Frontend functions executable by the application. Default: empty array.
type (string)Tool type. Use function for a custom function.name (string)Function name.description (string)What the function does.parameters (object)Function parameters defined using JSON Schema.
type (string)Parameter structure. Use object for an object.properties (object)Types and constraints of parameters, keyed by the names defined by your application.required (array[string])Names of the required parameters.additionalProperties (boolean | object)Controls whether undeclared parameters are allowed. Set to false to reject them.
delegation (object, Required)Task execution method.
type (string, Required)client: Task executed by the application. responses: Backend Responses model invoked by the service.responses (object, Conditionally required)Required in Responses mode. QwenCloud passes the settings documented here to the backend model. See the Responses API for the tool definition format.
model (string, Required)Backend Responses model ID for handling delegated tasks, e.g., qwen4-max.instructions (string, Optional)Task instructions for the backend model in Responses mode. QwenCloud supplies no built-in backend instructions.tools (array[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).
type (string)Tool type. Use function for a custom function.name (string)Function name.description (string)What the function does.parameters (object)Function parameters defined using JSON Schema.
type (string)Parameter structure. Use object for an object.properties (object)Types and constraints of parameters, keyed by the names defined by your application.required (array[string])Names of the required parameters.additionalProperties (boolean | object)Controls whether undeclared parameters are allowed. Set to false to reject them.
transport (object, Optional)Uses WebSocket if omitted or an empty object is passed.
type (string, Conditionally required)Specify the transport method explicitly. websocket uses WebSocket, rtc uses WebRTC, and aoq uses AOQ.sdp (string, Conditionally required)Required when type is rtc. Pass the Offer SDP generated by the client. See WebRTC integration.aoq (object, Optional)AOQ configuration.
ws_audio (boolean, Optional)Whether to deliver downstream audio via WebSocket in addition. Default is false.
  • Client mode
  • Responses 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"
    }
  }
}

session.input_audio.append

Sends one frame of audio in a pure WebSocket session. Audio is sent via AOQ in AOQ sessions. type (string, Required) Event type; fixed value: session.input_audio.append. event_id (string, Optional) Client event ID. Non-empty; maximum length: 128 characters. audio (string, Required) 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. type (string, Required) Event type; fixed value: session.input_audio.mute. event_id (string, Optional) 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. type (string, Required) Event type; fixed value: session.input_audio.unmute. event_id (string, Optional) 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. type (string, Required) Event type; fixed value: session.item.create. event_id (string, Optional) Client event ID. Non-empty; maximum length: 128 characters. item (object, Fill according to purpose.) Session content to be written.
type (string, Required)Enter message or function_call_output.role (string, Fill according to type.)Example for message: user.content (array, Fill according to type.)Content of message.
type (string, Required)Enter input_text for text input.text (string, Required)User text.
call_id (string, Fill according to type.)Frontend function call ID corresponding to function_call_output.output (string, Fill according to type.)String result of function_call_output.
  • Return function result
  • Input text
{
  "type": "session.item.create",
  "event_id": "evt_function_result",
  "item": {
    "type": "function_call_output",
    "call_id": "call_stock",
    "output": "{\"stock\":7}"
  }
}

session.thinking.append

Update task progress. The service returns session.thinking.appended. type (string, Required) Event type; fixed value: session.thinking.append. event_id (string, Optional) Client event ID. Non-empty; maximum length: 128 characters. delegation_id (string, Required) Use the ID from session.delegation.created received over the current connection. content (string, Required) Task progress. start_ms (number, Optional) Start time on the session timeline, in milliseconds. end_ms (number, Optional) 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. type (string, Required) Event type; fixed value: session.instruction.append. event_id (string, Optional) Client event ID. Non-empty; maximum length: 128 characters. delegation_id (string, Required) Use the ID from session.delegation.created received over the current connection. task_id (string, Optional) Typically omitted. content (string, Required) Information requiring user input. start_ms (number, Optional) Start time on the session timeline, in milliseconds. end_ms (number, Optional) 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. type (string, Required) Event type; fixed value: session.commentary.append. event_id (string, Optional) Client event ID. Non-empty; maximum length: 128 characters. delegation_id (string, Required when returning a task result.) Use the ID from session.delegation.created received over the current connection. content (string, Optional) Task result or user text. start_ms (number, Optional) Start time on the session timeline, in milliseconds. end_ms (number, Optional) 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. error (object, Optional) Task error message.
  • Return task result.
  • Input text
{
  "type": "session.commentary.append",
  "event_id": "evt_stock_result",
  "delegation_id": "task_stock",
  "content": "库存还有七把雨伞。"
}

response.item.create

Add backend input in Responses mode. Then send response.create to trigger generation. type (string, Required) Event type; fixed value: response.item.create. event_id (string, Optional) Client event ID. Non-empty; maximum length: 128 characters. item (object, Required) Backend input. Supports message and function_call_output.
type (string, Required)Input item type.role (string, Fill according to type.)Example for message: user.content (array, Fill according to type.)User message content.
type (string, Required)Enter input_text for text input.text (string, Required)User text.
call_id (string)Function call ID for function_call_output. Use the call_id returned in the backend event.output (string)Function result as a string for function_call_output.
  • Input text
  • Return a backend function result
{
  "type": "response.item.create",
  "event_id": "evt_backend_item",
  "item": {
    "role": "user",
    "type": "message",
    "content": [
      {
        "type": "input_text",
        "text": "请查询雨伞库存。"
      }
    ]
  }
}

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. type (string, Required) Event type; fixed value: response.create. event_id (string, Optional) Client event ID. Non-empty; maximum length: 128 characters. response (object, Optional) 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. type (string, Required) Event type; fixed value: session.close. event_id (string, Required) Client event ID. Non-empty; maximum length: 128 characters.
{
  "type": "session.close",
  "event_id": "evt_close"
}