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.
Both setups start with a WebSocket connection. Choose a setup based on how you want to send and receive audio.
When
For the complete list of fields and JSON examples, see Client Events and Server Events.
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 itstypetowebsocket. - 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.typetortc, 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. Setsession.transport.typetoaoqto retrieve temporary credentials for this session via WebSocket.
- WebRTC. Send and receive audio via WebRTC media tracks. Set
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
| Operation | Client sends | Server returns |
|---|---|---|
| Establish a WebSocket connection | Initiate connection | session.created |
| Configure session parameters | session.update | session.updated |
| View session usage | Read events proactively reported by the service | session.usage.updated |
| End session | session.close | session.closed |
| Handle request errors | Troubleshoot errors returned by event | error |
Send and receive audio, subtitles, and text
| Operation | Client sends | Server returns |
|---|---|---|
| Send and receive audio using pure WebSocket integration | session.input_audio.append | session.output_audio.delta |
| Mute or unmute upstream audio | session.input_audio.mute、session.input_audio.unmute | session.input_audio.muted、session.input_audio.unmuted |
| Display user transcription and model-generated subtitles | Receive and accumulate text fragments | session.input_transcript.delta、session.output_transcript.delta |
| Send text messages | session.item.create, item.type is set to message | Receive 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, QwenCloud invokes the configured backend model. Refer to Task delegation and tools for operational steps in both modes.
| Operation | Request or event | Associated field or acknowledgment |
|---|---|---|
| Receive an automatically dispatched task | Service sends session.delegation.created | delegation_id |
| Update task progress | Application sends session.thinking.append | session.thinking.appended |
| Prompt the user to provide additional information | Application sends session.instruction.append, filling in delegation_id for the current task | Receive session.instructions.appended acknowledgment. Read supplementary information from the supplements field (if present) in subsequent session.delegation.created events. |
| Return Client-mode task results | Application sends session.commentary.append, filling in delegation_id | session.commentary.appended |
| Explicitly initiate backend generation | Application sends response.item.create with input, then sends response.create | response.event. The inner response.completed indicates completion of backend generation |
| Handle frontend function calls | Service sends session.event; application returns the result by sending session.item.create | call_id |