> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.empiriolabs.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.empiriolabs.ai/_mcp/server.

# Qwen Audio 3.1 Realtime Flash

> Duplex speech conversation over one socket, with 88 voices, native web search that works alongside tool calling, and separate text and audio token rates.

![Qwen Audio 3.1 Realtime Flash](https://media.empiriolabs.ai/model-logos/qwen.png)

[Alibaba Cloud](/providers/alibaba) · Audio Generation

`WEBSOCKET /v1/realtime`

Duplex speech conversation over one socket, with 88 voices, native web search that works alongside tool calling, and separate text and audio token rates.

## At a glance

| Field               | Value                                                                                       |
| ------------------- | ------------------------------------------------------------------------------------------- |
| Model id            | `qwen-audio-3-1-realtime-flash`                                                             |
| Model release date  | 2026-10-27                                                                                  |
| Input modalities    | Audio, Text                                                                                 |
| Output modalities   | Audio, Text                                                                                 |
| Context window      | 240K                                                                                        |
| Weight precision    | -                                                                                           |
| Max output tokens   | 16,384                                                                                      |
| Region              | Singapore                                                                                   |
| Features            | realtime, speech_to_speech, audio_in, audio_out, function_calling, web_search, multilingual |
| Native inference    | No                                                                                          |
| New                 | Yes                                                                                         |
| Supported endpoints | `WEBSOCKET /v1/realtime`                                                                    |
| Alternate model ids | `qwen-audio-3.1-realtime-flash`, `alibaba/qwen-audio-3-1-realtime-flash`                    |

## Pricing

| Charge        | Spec                                       | Rate   |
| ------------- | ------------------------------------------ | ------ |
| Input: audio  | per 1M audio input tokens                  | \$1.86 |
| Input         | per 1M prompt tokens                       | \$0.46 |
| Output        | per 1M generated tokens, text-only replies | \$1.40 |
| Output: audio | per 1M generated audio tokens              | \$3.74 |
| Web search    | per call when invoked                      | \$0.00 |

## Example request

```python
import asyncio, json, os, websockets

URL = "wss://api.empiriolabs.ai/v1/realtime?model=qwen-audio-3-1-realtime-flash"

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

| Parameter               | Type    | Required | Default                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------- | ------- | -------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `voice`                 | enum    | no       | `"longanqian_v3.1"`                | Speaking voice for the session. Set it with session.update before the model produces any audio. These voices are specific to this model. · Allowed: `longanqian_v3.1`, `longanhuan_v3.1`, `longanlingxin_v3.1`, `longanfengyue_v3.1`, `xunanchuan_v3.1`, `beth_v3.1`, `betty_v3.1`, `cally_v3.1`, `longanqian`, `longanlingxin`, `longanlufeng`, `longanlingxi`, `longanxiaoxin`, `longanfengyue`, `longanyuanfei`, `longanhuan_v3.6`, `longjielidou_v3.6`, `longpaopao_v3.6`, `longhuohuo_v3.6`, `longchuanshu_v3.6`, `loongmary`, `loongeva_v3.6`, `loongjohn`, `daniel`, `echo`, `hannah`, `sherry`, `yuxiaoyun_v3.1`, `qiaoxiaojiao_v3.1`, `xiaxiaochen_v3.1`, `anmingyuan_v3.1`, `wenhuaiqing_v3.1`, `anxiaolan_v3.1`, `xieshurou_v3.1`, `baiqinglan_v3.1`, `xuyuyuan_v3.1`, `anruorou_v3.1`, `wenhuaizhi_v3.1`, `xiaoxingzhi_v3.1`, `guyunshu_v3.1`, `huozhuoshi_v3.1`, `yeqinghe_v3.1`, `yunhuanhuan_v3.1`, `xuxiaoqiao_v3.1`, `baianran_v3.1`, `xuyanchu_v3.1`, `yezhiqing_v3.1`, `andi_v3.1`, `anyuqing_v3.1`, `emily_v3.1`, `luna_v3.1`, `eric_v3.1`, `luca_v3.1`, `abby_v3.1`, `annie_v3.1`, `ava_v3.1`, `cindy_v3.1`, `donna_v3.1`, `andy_v3.1`, `brian_v3.1`, `david_v3.1`, `longanyuanfei_v3.1`, `longjielidou_v3.1`, `longanlingxi_v3.1`, `longhuohuo_v3.1`, `longyingtao_v3.1`, `longanya_v3.1`, `longwan_v3.1`, `longxing_v3.1`, `longhua_v3.1`, `longhan_v3.1`, `longanzhi_v3.1`, `longzhe_v3.1`, `longanyang_v3.1`, `libai_v3.1`, `longling_v3.1`, `longniuniu_v3.1`, `longshanshan_v3.1`, `longpaopao_v3.1`, `loongstella_v3.1`, `longyuan_v3.1`, `longmiao_v3.1`, `longsanshu_v3.1`, `longanli_v3.1`, `longanwen_v3.1`, `longanlang_v3.1`, `longxiaoxia_v3.1`, `longanchong_v3.1` |
| `instructions`          | string  | no       | -                                  | System guidance for how the model should behave and speak during the conversation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `input_language`        | enum    | no       | `"auto"`                           | Language you speak. The transcript of your speech is written in it; auto detects it. Also accepted as input_audio_transcription.language. · Allowed: `auto`, `zh`, `en`, `ja`, `ko`, `vi`, `th`, `id`, `ar`, `fr`, `de`, `es`, `pt`, `ru`, `it`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `output_language`       | enum    | no       | `"auto"`                           | Language the spoken reply is read in, for example Japanese or Chinese for the same characters. It does not translate the reply: ask for its language in your instructions. auto lets the model choose. Also accepted as output_audio.language. · Allowed: `auto`, `zh`, `en`, `ja`, `ko`, `vi`, `th`, `id`, `ar`, `fr`, `de`, `es`, `pt`, `ru`, `it`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `speed`                 | number  | no       | -                                  | Speaking rate of the reply, from 0.5 to 2. Lower values slow the speech and higher values speed it up. Also accepted as speech_rate. When omitted, the model's own default applies. · Range: 0.5 – 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `enable_speech_emotion` | boolean | no       | true                               | More pronounced emotion in the spoken reply. Turn it off for a more even delivery.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `max_history_turns`     | integer | no       | -                                  | How many earlier exchanges the model reads for each reply, from 1 to 50. Fewer exchanges use fewer input tokens. When omitted, the model's own default applies. · Range: 1 – 50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `enable_search`         | boolean | no       | false                              | Search the web for real-time information. Works in the same session as function calling. Search results are added to the conversation and count as input tokens.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `modalities`            | string  | no       | `["text", "audio"]`                | Which output types the model returns for a turn. Drop audio for a text-only reply.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `input_audio_format`    | enum    | no       | `"pcm16"`                          | Encoding of the audio you append to the input buffer: base64 16-bit PCM at 16 kHz. · Allowed: `pcm16`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `output_audio_format`   | enum    | no       | `"pcm24"`                          | Encoding of the audio the model streams back: 16-bit PCM at 24 kHz. · Allowed: `pcm24`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `turn_detection`        | string  | no       | `&#123;"type": "server_vad"&#125;` | Voice activity detection: decides when you have finished speaking and the model should reply. It is on by default as server_vad, which ends your turn after a pause. smart_turn also weighs what you said, so filler sounds such as um do not end your turn or interrupt the reply, and smart_turn_v2 also answers bystanders and side remarks less often. threshold is a number from -1 to 1, 0.5 by default; a higher value needs clearer, louder speech to count. With server_vad, silence_duration_ms, from 200 to 6000 and 800 by default, is how long a pause must last to end your turn. Set turn_detection to null to end each turn yourself with input_audio_buffer.commit and response.create.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

## Notes

**Connecting**

Full-duplex voice over a WebSocket at `wss://api.empiriolabs.ai/v1/realtime?model=qwen-audio-3-1-realtime-flash`, authenticated with the ordinary Authorization Bearer header. Configure the session with `session.update` over the socket: voice, instructions, modalities, turn detection, languages and delivery.

**Sending audio**

* Append microphone audio as `input_audio_buffer.append` events.
* Voice activity detection decides when you have stopped speaking, so keep streaming for about a second after the speech ends.

**Language and delivery**

Set `input_language` to the language you speak, which the transcript of your speech is written in, and `output_language` to the language the spoken reply is read in. Each takes auto or one of zh, en, ja, ko, vi, th, id, ar, fr, de, es, pt, ru and it. The output language does not translate the reply, so ask for its language in your instructions too. `speed` (0.5 to 2) sets the speaking rate, `enable_speech_emotion` the expressive delivery, and `max_history_turns` (1 to 50) how many earlier exchanges the model reads.

**Voices**

The voices on this model are its own set. Pick one from the voice list rather than carrying a voice across from another model, or leave it unset and the default is supplied for you.

**Web search**

Web search is off by default. Turn it on with `enable_search`. It works in the same session as function calling, and search results are added to the conversation and count as input tokens.

**Billing**

Audio and text tokens are priced separately in both directions. A spoken reply is billed for its audio output tokens only, and the text output rate applies to replies with no audio. Each completed turn is billed on its own from the usage the model reports.

---

*Machine-readable schema:* `GET https://api.empiriolabs.ai/v1/models/qwen-audio-3-1-realtime-flash`.