Qwen Audio 3.1 Live

WEBSOCKET /v1/realtimeFull-duplex voice conversation that keeps talking while your application runs delegated tasks, with function calling and billing by the second.
See Qwen Audio 3.1 Live pricing and specs or try it in the Playground.
At a glance
Pricing
Example request
Parameters
Notes
Connecting
Full-duplex voice over a WebSocket at wss://api.empiriolabs.ai/v1/realtime?model=qwen-audio-3-1-live, authenticated with the ordinary Authorization Bearer header. This model has its own event protocol, described below, rather than the OpenAI Realtime protocol.
Setting up the session
Send one session.update and wait for session.updated. session.model is required:
qwen-audio-4.0-realtime-previewwithturn_detectionset to{"type": "duplex"}listens while it speaks, so it can be interrupted at any moment.qwen-audio-3.1-realtime-flashanswers after you pause. Leaveturn_detectionout with it.
Set voice, instructions and tools in the same event.
Sending and receiving audio
- Send microphone audio as
session.input_audio.appendevents: base64 16-bit PCM at 16 kHz, mono, in small frames (20 ms works well). - The reply streams as
session.output_audio.deltaevents: base64 16-bit PCM at 24 kHz, mono. session.input_transcript.deltacarries the transcript of your speech andsession.output_transcript.deltathe reply’s subtitles.session.input_audio.muteandsession.input_audio.unmutepause and resume listening without ending the session.- Text sent as an
input_textmessage withsession.item.createadds information to the spoken conversation. session.usage.updatedreports the session’s elapsed seconds every 5 seconds.
Delegated tasks and tools
- With
delegationset to{"type": "client"}, the model hands a longer task to your application in asession.delegation.createdevent and keeps talking meanwhile. Report progress withsession.thinking.append, ask the user for a missing detail withsession.instruction.append, and return the result withsession.commentary.append, each carrying the task’sdelegation_id. For sessions that delegate tasks, useqwen-audio-3.1-realtime-flash, which reads each returned result aloud. - A function declared in
toolsis called with asession.eventwhoseevent.itemis afunction_call. Run it once percall_idand return the result withsession.item.createas afunction_call_output. - Backend responses (
responsesdelegation) and the WebRTC and AOQ transports are not available on this model.
Voices
With qwen-audio-4.0-realtime-preview, choose one of the 8 voices in the voice list. With qwen-audio-3.1-realtime-flash, use a voice of Qwen Audio 3.1 Realtime Flash, or leave voice out for its default.
Ending a session
Send session.close and wait for session.closed, or close the socket.
Capacity
When the model is at capacity, a new session receives a session_unavailable error and close code 1013. Try again shortly.
Billing
A session is billed by its length, from when it opens until it closes, in whole seconds, with a partial second counted as a full second and at least 3 seconds per session. Listening, silence and text all count as session time.
Machine-readable schema: GET https://api.empiriolabs.ai/v1/models/qwen-audio-3-1-live.
