Speechmatics
Realtime speech-to-text with Speechmatics, with diarization and server-side turn detection.
Overview
SpeechmaticsSTTService speaks Speechmatics' Agent STT WebSocket protocol (/v2/agent). pipedog implements the protocol directly (src/agent_stt.ts) instead of depending on the Python-only speechmatics-rt SDK.
Installation
bun add @pipedog/speechmaticsPrerequisites
- A Speechmatics API key, passed as
apiKeyor read fromSPEECHMATICS_API_KEY.baseUrldefaults towss://eu2.rt.speechmatics.com/v2/agent(orSPEECHMATICS_RT_URL).
SpeechmaticsSTTService
Configuration
Prop
Type
Settings
Runtime-updatable settings, passed as settings: new SpeechmaticsSTTService.Settings({...}). Settings you leave out keep their defaults.
| Setting | Default | Description |
|---|---|---|
model | "linden-1" | Speechmatics model. |
language, domain | Language and domain. | |
turnDetectionMode | EXTERNAL | VAD hands turn detection to the server. |
speakerActiveFormat | "{text}" | Template with {speaker_id}, {text}, {ts}, {lang}. Applies live. |
enableDiarization, speakerSensitivity, maxSpeakers, preferCurrentSpeaker, knownSpeakers | Diarization. | |
additionalVocab, enablePartials, emitSentences, punctuationOverrides, transcriptFilteringConfig | Transcript shaping. |
Changing any setting other than speakerActiveFormat reconnects.
Usage
import { Language } from "@pipedog/core/transcriptions/language";
import { SpeechmaticsSTTService, TurnDetectionMode } from "@pipedog/speechmatics/stt";
const stt = new SpeechmaticsSTTService({
apiKey: process.env.SPEECHMATICS_API_KEY ?? "",
settings: new SpeechmaticsSTTService.Settings({
language: Language.EN,
turnDetectionMode: TurnDetectionMode.EXTERNAL,
enableDiarization: true,
speakerActiveFormat: "@{speaker_id}: {text}",
}),
});Notes
- Event:
on_speakers_result. - A refused handshake status is hidden by the standard
WebSocketon Bun, Node and Deno, so an invalid key is retried 3 times and then reported as a permanent failure.
Runtimes
| Runtime | Works | What it needs |
|---|---|---|
| Bun | ✅ yes | Nothing. |
| Node.js | ✅ yes | Nothing. |
| Deno | ✅ yes | Nothing. |
| Cloudflare Workers | ✅ yes | Nothing. |
Generated from pipecat.runtimes and pipecat.compat in packages/speechmatics/package.json: ✅ means the compat smoke test passes on that runtime.
The service uses fetch and the global WebSocket (through core's websocketConnect, which sends the auth header on the handshake on Cloudflare Workers too). Pass no SDK; nothing is Node-only.
pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.
Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).