Blog
Guides for voice agents in TypeScript
Guides for building voice agents in TypeScript: speech-to-text, text-to-speech, phone calls, agent frameworks, and tests without a microphone.
How to add voice to your AI agent in TypeScript
Put speech-to-text in front of your agent and text-to-speech behind it, or use one speech-to-speech model. This post shows both setups in TypeScript, plus hanging up and prompts written for the ear.
Speech-to-text in Node.js: Whisper, a cloud API, or the browser
Compare three places to run speech-to-text for a Node.js app: Whisper on your own machine, a cloud API, and the browser's Web Speech API, with the trade-offs and code for each.
OpenAI Realtime API in TypeScript, with examples
Use the OpenAI Realtime API from TypeScript with openai() from VoiceAI SDK: open a session, let the model answer by voice, put your own agent in the loop, and answer phone calls.
Build a Twilio voice agent in TypeScript
Answer a Twilio call with TwiML, connect its media stream to a voice session, and let a model hold the conversation and hang up, all from a TypeScript server you run.
How to choose a speech-to-text API for a voice agent
What to check before you pick a speech-to-text API for a voice agent: streaming, turn detection, phone audio, language, speaker labels and where audio goes, and how to compare candidates on your own recordings.
Run Whisper and Piper locally from TypeScript
Transcribe with whisper.cpp and speak with Piper on your own machine from TypeScript, with no account and no audio leaving the host, using local() from VoiceAI SDK.
Barge-in: letting callers interrupt a voice agent
How barge-in works in a voice agent: hearing the caller during a reply, stopping playback, cancelling the model, and picking up the conversation, with TypeScript examples for each step.
Testing voice agents without a microphone
Test a voice agent's replies, silence handling, errors and cleanup in memory with mock(), then check real recordings with local(), with no microphone and no API keys in CI.
Streaming text-to-speech: start speaking before the reply is done
Stream a model's reply into text-to-speech so the first words play while the rest is still being written, and play the audio in chunks as it arrives, with TypeScript examples.