Skip to navigation

Qwen Audio 3.1 Live

Qwen Audio 3.1 Live
Alibaba Cloud · Audio Generation
WEBSOCKET /v1/realtime

Full-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

FieldValue
Model idqwen-audio-3-1-live
Model release date2026-11-23
Input modalitiesAudio, Text
Output modalitiesAudio, Text
Context window-
Weight precision-
RegionSingapore
Featuresrealtime, speech_to_speech, audio_in, audio_out, function_calling
Native inferenceNo
NewYes
Supported endpointsWEBSOCKET /v1/realtime
Alternate model idsqwen-audio-3.1-live, alibaba/qwen-audio-3-1-live

Pricing

ChargeSpecRate
Sessionper second$0.00142

Example request

import asyncio, json, os, websockets
URL = "wss://api.empiriolabs.ai/v1/realtime?model=qwen-audio-3-1-live"
async def main():
async with websockets.connect(
URL,
additional_headers=[("Authorization", f"Bearer {os.environ['EMPIRIOLABS_API_KEY']}")],
max_size=None,
) as ws:
print(json.loads(await ws.recv())["type"]) # session.created
await ws.send(json.dumps({
"type": "conversation.item.create",
"item": {"type": "message", "role": "user",
"content": [{"type": "input_text", "text": "Say hello."}]},
}))
await ws.send(json.dumps({"type": "response.create"}))
async for raw in ws:
event = json.loads(raw)
if event["type"] == "response.done":
break
asyncio.run(main())

Parameters

ParameterTypeRequiredDefaultDescription
voiceenumno"yunshu"Speaking voice of the qwen-audio-4.0-realtime-preview frontend, set with session.update. With qwen-audio-3.1-realtime-flash, use a voice of Qwen Audio 3.1 Realtime Flash instead. · Allowed: yunshu, xiaoman, wanfeng, qingyou, poxiao, maiya, wulong, xuesong
instructionsstringno-System guidance for how the model should behave and speak during the conversation.
modelenumyes"qwen-audio-4.0-realtime-preview"The voice model that holds the conversation, required in session.update. qwen-audio-4.0-realtime-preview listens while it speaks (set turn_detection to duplex); qwen-audio-3.1-realtime-flash answers after you pause. · Allowed: qwen-audio-4.0-realtime-preview, qwen-audio-3.1-realtime-flash
delegationstringno-How delegated tasks run. {“type”: “client”} hands a longer task to your application as a session.delegation.created event while the model keeps talking; return its result with session.commentary.append. Use it with qwen-audio-3.1-realtime-flash, which reads each returned result aloud. Leave it out and the model holds the conversation alone.
input_audio_formatenumno"pcm"Encoding of the audio you send in session.input_audio.append: base64 16-bit PCM at 16 kHz, mono. · Allowed: pcm
output_audio_formatenumno"pcm"Encoding of the audio the model streams back in session.output_audio.delta: 16-bit PCM at 24 kHz, mono. · Allowed: pcm
turn_detectionstringno{"type": "duplex"}duplex with qwen-audio-4.0-realtime-preview, which listens while it speaks and can be interrupted at any moment. Leave it out with qwen-audio-3.1-realtime-flash, which answers after you pause.

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-preview with turn_detection set to {"type": "duplex"} listens while it speaks, so it can be interrupted at any moment.
  • qwen-audio-3.1-realtime-flash answers after you pause. Leave turn_detection out with it.

Set voice, instructions and tools in the same event.

Sending and receiving audio

  • Send microphone audio as session.input_audio.append events: base64 16-bit PCM at 16 kHz, mono, in small frames (20 ms works well).
  • The reply streams as session.output_audio.delta events: base64 16-bit PCM at 24 kHz, mono.
  • session.input_transcript.delta carries the transcript of your speech and session.output_transcript.delta the reply’s subtitles.
  • session.input_audio.mute and session.input_audio.unmute pause and resume listening without ending the session.
  • Text sent as an input_text message with session.item.create adds information to the spoken conversation.
  • session.usage.updated reports the session’s elapsed seconds every 5 seconds.

Delegated tasks and tools

  • With delegation set to {"type": "client"}, the model hands a longer task to your application in a session.delegation.created event and keeps talking meanwhile. Report progress with session.thinking.append, ask the user for a missing detail with session.instruction.append, and return the result with session.commentary.append, each carrying the task’s delegation_id. For sessions that delegate tasks, use qwen-audio-3.1-realtime-flash, which reads each returned result aloud.
  • A function declared in tools is called with a session.event whose event.item is a function_call. Run it once per call_id and return the result with session.item.create as a function_call_output.
  • Backend responses (responses delegation) 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.