Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions livekit-agents/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ openai = ["livekit-plugins-openai>=1.8.5"]
palabra = ["livekit-plugins-palabra>=1.8.5"]
perplexity = ["livekit-plugins-perplexity>=1.8.5"]
protoface = ["livekit-plugins-protoface>=1.8.5"]
qwen-asr = ["livekit-plugins-qwen-asr>=1.8.5"]
resemble = ["livekit-plugins-resemble>=1.8.5"]
respeecher = ["livekit-plugins-respeecher>=1.8.5"]
rime = ["livekit-plugins-rime>=1.8.5"]
Expand Down
58 changes: 58 additions & 0 deletions livekit-plugins/livekit-plugins-qwen-asr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Qwen3-ASR plugin for LiveKit Agents

Speech-to-text for a self-hosted [Qwen3-ASR](https://github.com/QwenLM/Qwen3-ASR) model served by [vLLM](https://docs.vllm.ai/projects/recipes/en/latest/Qwen/Qwen3-ASR.html).

This is not the Alibaba Model Studio realtime API. Point `base_url` at your own vLLM server.

## Installation

```bash
pip install livekit-agents[qwen-asr]
```

## Run the model

Batch transcription works with a normal serve:

```bash
vllm serve Qwen/Qwen3-ASR-1.7B
```

Realtime also needs the realtime architecture. That process still serves batch transcription, including context prompts:

```bash
vllm serve Qwen/Qwen3-ASR-1.7B \
--hf-overrides '{"architectures": ["Qwen3ASRRealtimeGeneration"]}'
```

## Batch

`use_realtime=False` is the default. LiveKit's VAD cuts each turn and `recognize()` posts it to `/v1/audio/transcriptions`. Leave `prompt` unset for an empty context. Set it to bias names and domain words; vLLM puts that text in Qwen's system turn. LiveKit keyterms are appended to the same text, because the model has no separate keywords field.

```python
from livekit.plugins import qwen_asr

stt = qwen_asr.STT(
base_url="http://127.0.0.1:8000/v1",
model="Qwen/Qwen3-ASR-1.7B",
language="tr",
prompt="Türkçe telefon görüşmesi. Fibabanka tüketici kredisi.",
)
```

Omit `language` to let the model detect it. Omit `prompt` to send no context.

## Realtime

`use_realtime=True` opens vLLM's `/v1/realtime` socket. Audio is resampled to 16 kHz PCM. The server does not detect end of speech, so the plugin uses the bundled Silero VAD and closes the turn itself. Pass `vad=None` and call `flush()` to close turns yourself.

```python
stt = qwen_asr.STT(
base_url="http://127.0.0.1:8000/v1",
model="Qwen/Qwen3-ASR-1.7B",
language="tr",
use_realtime=True,
)
```

`language` and `prompt` are sent on `session.update`. vLLM 0.30 reads the model name from that event and does not apply the prompt inside its realtime template, so context biasing currently applies to batch recognition. The plugin also drops the `language …<asr_text>` preamble that this vLLM version streams in front of the words.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Qwen3-ASR plugin for a self-hosted vLLM server."""

from livekit.agents import Plugin

from .log import logger
from .stt import STT, SpeechStream
from .version import __version__

__all__ = ["STT", "SpeechStream", "__version__"]


class QwenAsrPlugin(Plugin):
def __init__(self) -> None:
super().__init__(__name__, __version__, __package__, logger)


Plugin.register_plugin(QwenAsrPlugin())

_module = dir()
NOT_IN_ALL = [m for m in _module if m not in __all__]

__pdoc__ = {}

for n in NOT_IN_ALL:
__pdoc__[n] = False
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import logging

logger = logging.getLogger("livekit.plugins.qwen_asr")
Loading
Loading