Skip to main content

AssemblyAI STT

Streaming speech-to-text via AssemblyAI’s Universal Streaming v3 API. Ported from LiveKit Agents (Apache 2.0) — uses ws, no vendor SDK required.

Install

npm install getpatter

Usage

Use the public STT class either namespaced or flat — both read from ASSEMBLYAI_API_KEY when apiKey is omitted.
// Namespaced import
import * as assemblyai from "getpatter/stt/assemblyai";

const stt = new assemblyai.STT();                     // reads ASSEMBLYAI_API_KEY
const stt = new assemblyai.STT({ apiKey: "aa_..." });

// Flat alias (equivalent)
import { AssemblyAISTT } from "getpatter";

const stt = new AssemblyAISTT();
Plug it into an agent:
// npx tsx example.ts
import { Patter, Twilio, AssemblyAISTT, ElevenLabsTTS } from "getpatter";

const phone = new Patter({ carrier: new Twilio(), phoneNumber: "+15550001234" });

const agent = phone.agent({
  stt: new AssemblyAISTT(),                           // ASSEMBLYAI_API_KEY from env
  tts: new ElevenLabsTTS({ voiceId: "rachel" }),      // ELEVENLABS_API_KEY from env
  systemPrompt: "You are a helpful assistant.",
});

await phone.serve({ agent });
For Twilio (mulaw 8 kHz) use AssemblyAISTT.forTwilio("aa_...").