Skip to main content

Aliyun implementation for LiveKit Agents

Project description

Aliyun plugin for LiveKit Agents

Realtime speech-to-text, text-to-speech, and LLM support for LiveKit Agents using Aliyun DashScope.

The plugin exposes:

  • livekit.plugins.aliyun.STT
  • livekit.plugins.aliyun.TTS
  • livekit.plugins.aliyun.LLM

Installation

pip install livekit-plugins-alicloud

Pre-requisites

You'll need an API key from Aliyun. It can be set as an environment variable: DASHSCOPE_API_KEY

Quick Start

from dotenv import load_dotenv

from livekit.agents import Agent, AgentSession
from livekit.plugins import aliyun

load_dotenv()

session = AgentSession(
    llm=aliyun.LLM(),
    stt=aliyun.STT(),
    tts=aliyun.TTS(),
)

agent = Agent(instructions="Reply briefly and clearly.")

LLM

Common Options

from livekit.plugins import aliyun

llm = aliyun.LLM(
    model="qwen-plus",
    enable_thinking=False,
)
  • api_key: DashScope API key. Overrides the environment variable.
  • model: DashScope OpenAI-compatible chat model name. Defaults to qwen-plus.
  • base_url: Override the OpenAI-compatible endpoint. Defaults to https://dashscope.aliyuncs.com/compatible-mode/v1.
  • enable_thinking: Whether to enable Qwen deep-thinking mode. Defaults to False.
  • thinking_budget: Optional token budget for thinking mode. Requires enable_thinking=True.
  • max_tokens: Optional maximum output token count.
  • seed: Optional deterministic sampling seed.
  • tool_choice: Supports auto, none, and forcing a specific function tool. The required option is not supported.
  • preserve_thinking: Not supported in this version. Reasoning content is not persisted or returned as ordinary text.

STT

Common Options

from livekit.plugins import aliyun

stt = aliyun.STT(
    model="qwen3-asr-flash-realtime",
    language="zh",
    sample_rate=16000,
    interim_results=True,
)
  • api_key: DashScope API key. Overrides the environment variable.
  • model: Realtime ASR model name.
  • language: Optional language code such as zh, yue, or en.
  • sample_rate: Input sample rate. Typical value is 16000.
  • interim_results: Whether to emit interim transcripts.
  • turn_detection: Server-side VAD settings. Set it to None to use manual mode.

Manual Mode

To disable server-side turn detection and use manual mode:

from livekit.plugins import aliyun

stt = aliyun.STT(turn_detection=None)

TTS

Common Options

from livekit.plugins import aliyun

tts = aliyun.TTS(
    model="qwen3-tts-flash-realtime",
    voice="Cherry",
    language_type="Chinese",
)
  • api_key: DashScope API key. Overrides the environment variable.
  • model: Realtime TTS model name.
  • voice: Realtime TTS voice name.
  • language_type: One of Auto, Chinese, English, German, Italian, Portuguese, Spanish, Japanese, Korean, French, or Russian.
  • base_url: Override the websocket endpoint. For the international region, use wss://dashscope-intl.aliyuncs.com/api-ws/v1/realtime.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_alicloud-1.6.2.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livekit_plugins_alicloud-1.6.2-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_alicloud-1.6.2.tar.gz.

File metadata

  • Download URL: livekit_plugins_alicloud-1.6.2.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for livekit_plugins_alicloud-1.6.2.tar.gz
Algorithm Hash digest
SHA256 3772694cea707a5d5b884d1b46cdcba2c96d02963479bd574cb8d477e1c637dc
MD5 1f2ca79ba65b8b94eb6d0ad8ffe07431
BLAKE2b-256 11404b17f30101d77b92e4283ce5dd3fb9d13eae52c452645825d154364db27e

See more details on using hashes here.

File details

Details for the file livekit_plugins_alicloud-1.6.2-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_alicloud-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1213216895161e09edadf96ba37419d4c1d055f5a2ebdb106e1e3b3724942406
MD5 1286766c558cdf7650cd9f9239543f9d
BLAKE2b-256 544d145a31fb7a7fa2b90d2acbe3cc72b7bad1c90314eb5037f0b5f84dcc38d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page