
在项目里想做一个真正实时的语音转文字系统,一般只有两条路。
一是上云端 API:延迟低、断句好,但贵,而且隐私敏感场景根本不敢用。
二是本地跑 Whisper:虽然免费,但延迟高、断句不自然。
结果这两年大家几乎都在问同一个问题:
有没有可能在本地就做出云端级别的实时 ASR 体验?
我最近在 GitHub 上挖到一个宝:WhisperLiveKit。

它不是简单的 Whisper 包装,而是一套专门为本地流式语音识别优化的全栈解决方案,真正把 Whisper 流式延迟高的痛点给干碎了。

GitHub:https://github.com/QuentinFuxa/WhisperLiveKit

WhisperLiveKit 是一个开源的 Python 工具包,使用 pip 命令即可一键安装。
pip install whisperlivekit安装成功后,命令行就会有 wlk 命令可使用。
启动转录服务器
wlk --model base --language en然后打开浏览器并访问http://localhost:8000。开始说话,即可实时观看你的话语!
wlk 支持各种参数启动,部署参数如下:

Python API集成
import asyncio
from contextlib import asynccontextmanager
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from fastapi.responses import HTMLResponse
from whisperlivekit import AudioProcessor, TranscriptionEngine, parse_args
transcription_engine = None
@asynccontextmanager
async def lifespan(app: FastAPI):
global transcription_engine
transcription_engine = TranscriptionEngine(model="medium", diarization=True, lan="en")
yield
app = FastAPI(lifespan=lifespan)
async def handle_websocket_results(websocket: WebSocket, results_generator):
async for response in results_generator:
await websocket.send_json(response)
await websocket.send_json({"type": "ready_to_stop"})
@app.websocket("/asr")
async def websocket_endpoint(websocket: WebSocket):
global transcription_engine
# Create a new AudioProcessor for each connection, passing the shared engine
audio_processor = AudioProcessor(transcription_engine=transcription_engine)
results_generator = await audio_processor.create_tasks()
results_task = asyncio.create_task(handle_websocket_results(websocket, results_generator))
await websocket.accept()
while True:
message = await websocket.receive_bytes()
await audio_processor.process_audio(message) WhisperLiveKit 是我见过的开源项目中,将 Whisper 模型工程化落地做的非常优秀的项目之一。
它没有去卷“谁的模型分更高”,而是踏踏实实解决了“怎么让模型在实际业务中跑得顺畅”的问题。
VAD 截断、流式传输、后端加速,这三板斧直接把本地语音识别的门槛降到了地板上。
如果你受够了云厂商按分钟计费的账单,或者受够了本地部署时的卡顿和延迟,WhisperLiveKit 绝对值得你投入时间去尝试。
开源地址:https://github.com/QuentinFuxa/WhisperLiveKit

如果本文对您有帮助,也请帮忙点个 赞👍 + 在看 哈!❤️
在看你就赞赞我!
