Skip to main content

Qwen-Audio-Live

Select the Qwen-Audio-Live transmission method and look up client- and server-side events by operation.

To run your first session, follow the quickstart.

Choose a transport

Both setups start with a WebSocket connection. Choose a setup based on how you want to send and receive audio.
  • WebSocket only. Base64-encoded PCM in sent and received events. Omit session.transport, or set its type to websocket.
  • WebSocket + WebRTC or AOQ. Keep the control WebSocket open to configure the session, set up the media connection, and send task requests. Once the media connection is ready, use it to send and receive audio. Receive server events over either connection.
    • WebRTC. Send and receive audio via WebRTC media tracks. Set session.transport.type to rtc, then submit an Offer and receive an Answer via the control WebSocket.
    • AOQ. Connect to the Relay using the AOQ Client SDK to send and receive audio. After setting ws_audio=true, you can also receive a downstream audio stream via the control WebSocket. Set session.transport.type to aoq to retrieve temporary credentials for this session via WebSocket.
All protocols share the WebSocket connection endpoint and authentication. After sending session.update, wait for session.updated. For WebRTC and AOQ, additionally wait for their respective media connections to become ready.

Look up events by operation

Configure and end a session

OperationClient sendsServer returns
Establish a WebSocket connectionInitiate connectionsession.created
Configure session parameterssession.updatesession.updated
View session usageRead events proactively reported by the servicesession.usage.updated
End sessionsession.closesession.closed
Handle request errorsTroubleshoot errors returned by eventerror

Send and receive audio, subtitles, and text

OperationClient sendsServer returns
Send and receive audio using pure WebSocket integrationsession.input_audio.appendsession.output_audio.delta
Mute or unmute upstream audiosession.input_audio.mute、session.input_audio.unmutesession.input_audio.muted、session.input_audio.unmuted
Display user transcription and model-generated subtitlesReceive and accumulate text fragmentssession.input_transcript.delta、session.output_transcript.delta
Send text messagessession.item.create, item.type is set to messageReceive audio and subtitles per session configuration

Handle delegated tasks and function calls

When session.delegation.type is set to client, the application receives and processes the task; when set to responses, Model Studio invokes the configured backend model. Refer to Task delegation and tools for operational steps in both modes.
OperationRequest or eventAssociated field or acknowledgment
Receive an automatically dispatched taskService sends session.delegation.createddelegation_id
Update task progressApplication sends session.thinking.appendsession.thinking.appended
Prompt the user to provide additional informationApplication sends session.instruction.append, filling in delegation_id for the current taskReceive session.instructions.appended acknowledgment. Read supplementary information from the supplements field (if present) in subsequent session.delegation.created events.
Return Client-mode task resultsApplication sends session.commentary.append, filling in delegation_idsession.commentary.appended
Explicitly initiate backend generationApplication sends response.item.create with input, then sends response.createresponse.event. The inner response.completed indicates completion of backend generation
Handle frontend function callsService sends session.event; application returns the result by sending session.item.createcall_id
For the complete list of fields and JSON examples, see Client Events and Server Events.