AWS Transcribe
Streaming speech-to-text from Amazon Transcribe with AWSTranscribeSTTService, over Transcribe's WebSocket API.
Overview
AWSTranscribeSTTService streams the user's audio to Amazon Transcribe and emits interim and
final transcripts. It connects to Transcribe's WebSocket API with a SigV4-presigned URL and sends
audio as event-stream AudioEvent messages, as upstream does.
Upstream page
Pipecat's documentation for the same service.
Source
packages/aws/src/stt.ts and utils.ts.
Transcribe docs
Streaming over WebSocket, languages and partial-result stabilization.
Installation
bun add @pipedog/awsimport { AWSTranscribeSTTService } from "@pipedog/aws/stt";Prerequisites
-
An IAM identity allowed
transcribe:StartStreamTranscriptionWebSocket. -
Keys, in this order of precedence:
awsAccessKeyId,apiKey(the secret access key) andawsSessionToken.- The
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_SESSION_TOKENenvironment variables. - A
credentialsProviderfunction, called for every connection, so each URL is signed with current keys.
The region comes from
region, elseAWS_REGION, elseus-east-1.
AWSTranscribeSTTService
Configuration
Prop
Type
Settings
Runtime-updatable settings, passed as settings: new AWSTranscribeSTTService.Settings({...}).
Transcribe binds them to the connection, so changing one reconnects.
| Setting | Type | Default | Description |
|---|---|---|---|
language | Language | Language.EN | Transcription language, mapped to a Transcribe code (en-US, es-ES, …). |
partialResultsStability | "high" | "medium" | "low" | "high" | Stability of interim results: "high" is fastest, "low" most accurate. |
model | string | null | null | Not used by Transcribe. |
Usage
import { AWSTranscribeSTTService } from "@pipedog/aws/stt";
import { STTUpdateSettingsFrame } from "@pipedog/core/frames/frames";
import { Language } from "@pipedog/core/transcriptions/language";
const stt = new AWSTranscribeSTTService({
// Or leave these out to read AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
// AWS_SESSION_TOKEN and AWS_REGION from the environment.
awsAccessKeyId: process.env.AWS_ACCESS_KEY_ID,
apiKey: process.env.AWS_SECRET_ACCESS_KEY,
region: "us-east-1",
sampleRate: 16000,
settings: new AWSTranscribeSTTService.Settings({
language: Language.EN_US,
partialResultsStability: "medium",
}),
});Change the language mid-call with an STTUpdateSettingsFrame:
// Queue it on the worker, or push it from a processor upstream of the service.
// Transcribe binds the language to the connection, so this reconnects.
const update = new STTUpdateSettingsFrame({
delta: new AWSTranscribeSTTService.Settings({ language: Language.ES_ES }),
});Event handlers
| Event | Description |
|---|---|
on_connected | The WebSocket to Transcribe is open. |
on_disconnected | The WebSocket to Transcribe closed. |
on_connection_error | Connecting failed. Receives the error message. |
Notes
- Emits
InterimTranscriptionFrames for partial results and aTranscriptionFramefor each final result. - Transcribe accepts 8000 or 16000 Hz PCM. Another
sampleRate(or pipeline rate) is replaced by 16000 Hz on connect, with a warning. - Partial-result stabilization is always on;
partialResultsStabilitysets its level. - On disconnect the service sends upstream's end-of-stream message before closing the socket.
- A 401 or 403 from Transcribe is reported as a connectivity error, as upstream does.
Runtime notes
| 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/aws/package.json: ✅ means the compat smoke test passes on that runtime.
- Runs on Bun, Node, Deno and Cloudflare Workers. The URL is presigned with SigV4 on WebCrypto,
and the socket is the global
WebSocket(opened throughfetchon Workers). - Only the
Originhandshake header is sent; the runtime'sWebSocketsets the others. - There is no default AWS credential chain (profiles, IMDS, ECS roles, SSO). Use keys, the
environment, or
credentialsProvider. endpointUrlreplaceswss://transcribestreaming.<region>.amazonaws.com:8443, for a proxy or a local fake. The URL is still signed for the AWS host.- Not ported: the deprecated
languageconstructor option. Usesettings.language.
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).