@ai-coustics/livekit-plugin

中文文档
0.3.0发布于 2026/10/11Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 4268

Deprecated: use @ai-coustics/livekit-extras. ai-coustics noise cancellation and VAD for LiveKit Agents

原始使用文档
文档目录7 节
  1. Installation
  2. Migrating from the official LiveKit plugin
  3. Model provisioning
  4. Usage
  5. Audio-quality analysis
  6. Combining frame processors
  7. Configuration

ai-coustics LiveKit plugin for Node.js

[!WARNING] This package is deprecated and will no longer be maintained. Use @ai-coustics/livekit-extras for VAD, Analyzer, and FrameProcessorChain. Use the official @livekit/plugins-ai-coustics package for speech enhancement. You can install the two packages together:

npm uninstall @ai-coustics/livekit-plugin
npm install @livekit/plugins-ai-coustics @ai-coustics/livekit-extras
OldNew
@ai-coustics/livekit-plugin@ai-coustics/livekit-extras
Processor@livekit/plugins-ai-coustics
pcm16ToFloat32, float32ToPcm16Removed

For all steps, refer to the migration guide.

Audio enhancement, voice activity detection, and audio-quality analysis for LiveKit Agents, backed by the public @ai-coustics/aic-sdk package.

[!IMPORTANT] The official @livekit/plugins-ai-coustics package is the recommended integration path for most applications. It supports LiveKit Cloud, integrates more deeply with the LiveKit ecosystem and tooling, and offers stronger stability guarantees. Avoiding breaking changes is an explicit goal of the official plugin.

This ai-coustics-maintained package follows a faster release cadence and is designed for teams that want early access to the latest ai-coustics models and product features. Some of those capabilities may be experimental and subject to change, and use of this package is billed separately through ai-coustics. Choose it when early adoption of new ai-coustics capabilities is important for your application.

Installation

This package is an alternative to @livekit/plugins-ai-coustics, not an extension of it. If you choose to migrate, uninstall the official package and do not mix objects from the two implementations.

npm uninstall @livekit/plugins-ai-coustics
npm install @ai-coustics/livekit-plugin
export AIC_SDK_LICENSE=...

Migrating from the official LiveKit plugin

Replace the package import and update the following APIs:

Official LiveKit pluginThis package
audioEnhancement(...)new Processor({ model })
EnhancerModel.*An SDK Model loaded from a provisioned model file
modelParameters or updateModelParameters(...)processor.getContext().setParameter(...)
vad() and vadSettingsnew VAD({ model, vadParameters })
Auth.livekitCloud() or Auth.aiCousticsApi(...)AIC_SDK_LICENSE or licenseKey

Before:

import * as aic from "@livekit/plugins-ai-coustics";

const processor = aic.audioEnhancement({ model: aic.EnhancerModel.QuailL });
const vad = aic.vad();

After loading the SDK models as described below:

import { FrameProcessorChain, Processor, VAD } from "@ai-coustics/livekit-plugin";

const processor = new Processor({ model: enhancementModel });
const vad = new VAD({ model: vadModel });
const frameProcessor = new FrameProcessorChain(vad.processor, processor);

This package still uses a dedicated SDK VAD model. Like the official plugin, inference runs in the RoomIO frame-processor path and the VAD streams consume frame metadata. Provision a separate VAD model and install vad.processor as described below. LiveKit Cloud authentication is not carried over; obtain an ai-coustics SDK license before migrating.

Model provisioning

Download models during deployment or container setup:

import { Model } from "@ai-coustics/livekit-plugin";

const enhancementPath = await Model.download("quail-vf-2.2-l-16khz", "./models");
const vadPath = await Model.download("vad-2.1-xxs-16khz", "./models");
const analysisPath = await Model.download("tyto-1.1-l-16khz", "./models");

Enhancement and VAD models are different model types. Make the returned paths available to your worker, then load each model once per worker process:

const enhancementModel = Model.fromFile(enhancementPath);
const vadModel = Model.fromFile(vadPath);
const analysisModel = Model.fromFile(analysisPath);

Usage

Create a Processor and VAD for each agent session:

import { voice } from "@livekit/agents";
import { FrameProcessorChain, Processor, VAD } from "@ai-coustics/livekit-plugin";

const processor = new Processor({ model: enhancementModel });
const vad = new VAD({ model: vadModel });
const frameProcessor = new FrameProcessorChain(vad.processor, processor);

const session = new voice.AgentSession({
  vad,
  // ... stt, llm, tts
});

await session.start({
  // ... agent, room
  inputOptions: { noiseCancellation: frameProcessor },
});

vad.processor must be installed in the noiseCancellation path whenever the VAD is used. Put it first in the chain so it runs on original microphone audio before enhancement. All VAD streams read the resulting immutable metadata, so the SDK model runs only once per audio block.

For VAD without enhancement, use noiseCancellation: vad.processor. For enhancement without VAD, use noiseCancellation: processor.

Audio-quality analysis

Create an Analyzer, install its collector in RoomIO's audio path, and subscribe to its results:

import { Analyzer } from "@ai-coustics/livekit-plugin";

const analyzer = new Analyzer({
  model: analysisModel,
  analysisInterval: 5, // seconds; 5 is the default
});

analyzer.on("analysisResult", (event) => {
  console.log(event.result.riskScore);
});

await session.start({
  // ... agent, room
  inputOptions: { noiseCancellation: analyzer.collector },
});

The Analyzer receives audio through analyzer.collector; constructing the analyzer without installing its collector does not feed it any room audio.

Results are not logged by the plugin; log or handle them in the callback.

Combining frame processors

Use FrameProcessorChain to run any number of processors in the same RoomIO audio path. For example, this runs VAD inference and analysis on the raw input before enhancement:

import { FrameProcessorChain } from "@ai-coustics/livekit-plugin";

const frameProcessor = new FrameProcessorChain(
  vad.processor,
  analyzer.collector,
  processor,
);

await session.start({
  // ... agent, room
  inputOptions: { noiseCancellation: frameProcessor },
});

FrameProcessorChain runs its processors in order. Keep vad.processor first: it annotates the original frame while preserving its audio. We recommend placing analyzer.collector before processor; measuring raw input makes it easier to understand how input audio quality affects the rest of the pipeline.

This still uses LiveKit's noiseCancellation slot as a temporary integration. RoomIO owns the chain and closes the processor, collector, and analyzer together.

Analysis inference runs on a worker thread, so it never blocks the agent's event loop. If you own an Analyzer outside RoomIO, analyzer.close() returns a promise that resolves once any in-flight analysis has settled and the SDK session is released; awaiting it is optional.

Configuration

Set the enhancement level through the Processor context, and configure all SDK VAD parameters on the VAD factory:

import { ProcessorParameter } from "@ai-coustics/livekit-plugin";

processor.getContext().setParameter(ProcessorParameter.EnhancementLevel, 0.8);
vad.setParameters({
  sensitivity: 0.5,
  speechHoldDuration: 0.25,
  minimumSpeechDuration: 0.05,
});

SDK VAD parameter durations (speechHoldDuration and minimumSpeechDuration) are specified in seconds. The VAD constructor options prefixPaddingDuration and maxBufferedSpeech are specified in milliseconds. See the Node.js SDK reference and VAD guide for parameter ranges, model support, and further details.

Set AIC_SDK_LICENSE or pass licenseKey to the constructor. Create a new Processor for each concurrent room; RoomIO closes it with the input stream.

Models must be provisioned explicitly. This package does not support npx livekit-agents download-files.

版本与发布记录

@ai-coustics/livekit-plugin 共发布 3 个版本,首次发布于 2026/08/12;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.0latest2026/10/1128 天前
0.2.02026/09/151 个月前
0.1.02026/08/122 个月前

关于 @ai-coustics/livekit-plugin 的常见问题

@ai-coustics/livekit-plugin 是什么?

Deprecated: use @ai-coustics/livekit-extras. ai-coustics noise cancellation and VAD for LiveKit Agents

如何安装 @ai-coustics/livekit-plugin?

在项目目录运行 npm install @ai-coustics/livekit-plugin,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@livekit/agents(>=1.0.43 <2)、@livekit/rtc-node(^0.13.24 || ^1.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ai-coustics/livekit-plugin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ai-coustics/livekit-plugin 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ai-coustics/livekit-plugin 可以商用吗?

@ai-coustics/livekit-plugin 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@ai-coustics/livekit-plugin 的下载量有多少?

根据 npm 官方下载统计,@ai-coustics/livekit-plugin 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,268 次,日均约 142 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ai-coustics/livekit-plugin 还在维护吗?

最新版本 0.3.0 发布于 2026/10/11(28 天前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/08/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。