Give your AI agent
a phone number
The open-source SDK for voice AI. Connect any agent to real phone calls in 4 lines of code. Python and TypeScript, MIT licensed, sub-500 ms latency.
1from getpatter import Patter, Twilio, OpenAIRealtime 2# Bind a Twilio number to a Patter instance 3phone = Patter(carrier=Twilio(), phone_number="+15550001234") 4# Wire up the agent with prompt + engine 5agent = phone.agent(engine=OpenAIRealtime(), system_prompt="Be a friendly receptionist.") 6# Spawn a Cloudflare tunnel and start handling calls 7await phone.serve(agent, tunnel=True)
Hi, I'd like to book an appointment for next Tuesday.
Tuesday's wide open. Morning or afternoon?
Late morning if possible.
Got it — 11:15 it is.
Features
Voice AI in 4 lines of code.
Connect your agent to real phone calls without the telephony headache. Compare what you'd hand-write against what Patter does for you.
Without Patter
Roll your own pipeline
1import asyncio, websockets, json 2from twilio.rest import Client 3from twilio.twiml.voice_response import VoiceResponse 4from fastapi import FastAPI, WebSocket 5import deepgram, httpx, audioop 6 7app = FastAPI() 8twilio = Client("SID", "TOKEN") 9 10# Start outbound call with TwiML 11call = twilio.calls.create( 12 to="+1...", from_="+1...", 13 url="https://your-server.com/twiml", 14) 15 16# Serve TwiML to connect media stream 17@app.route("/twiml") 18async def twiml(): 19 resp = VoiceResponse() 20 connect = resp.connect() 21 connect.stream(url="wss://your-server.com/ws") 22 return str(resp) 23 24# Handle WebSocket audio stream 25@app.websocket("/ws") 26async def ws_handler(ws: WebSocket): 27 await ws.accept() 28 dg = deepgram.DeepgramClient("DG_KEY") 29 dg_ws = dg.listen.live.v("1") 30 # Transcode mulaw 8kHz → PCM 16kHz 31 # Process STT transcripts 32 # Send text to OpenAI / your LLM 33 # Stream response to ElevenLabs TTS 34 # Resample 24kHz → 8kHz mulaw 35 # Stream audio back over WebSocket 36 # Handle barge-in, call state, errors... 37 # ... 60+ more lines of boilerplate
With Patter SDK
Just the agent.
1import { Patter, Twilio, OpenAIRealtime } from "getpatter"; 2// Bind a Twilio number to a Patter instance 3const phone = new Patter({ carrier: new Twilio(), phoneNumber: "+15550001234" }); 4// Wire up the agent with prompt + engine 5const agent = phone.agent({ engine: new OpenAIRealtime(), systemPrompt: "Be a friendly receptionist." }); 6// Spawn a Cloudflare tunnel and start handling calls 7await phone.serve({ agent, tunnel: true });
Build
What you can build.
A small, fast, opinionated set of primitives. Inbound, outbound, end-to-end voice, pipeline mode — same handler.
One handler, both directions.
Receive incoming calls and place outbound dials with the same agent code. Native scheduling, voicemail detection, DTMF.
<500 ms time-to-first-audio.
Native 16 kHz streaming, frame-level buffering, first-flush optimization. Sub-500 ms TTFA on Realtime mode.
Two voice modes.
End-to-end engines (OpenAI Realtime, ElevenLabs ConvAI) for the lowest latency, or a pluggable pipeline with 6 STTs, 5 LLMs, 5 TTSs.
Function calls, on the phone.
Point Patter at any function that returns a string. Agents can search a database, hit your API, or transfer to a human, mid-call.
@phone.tool async def book_appt(date: str): …Barge-in, transfer, recording.
Production safeguards out of the box. Interruptions land cleanly. Transfer to a human warm or cold. Record both sides to disk or S3.
Tunnel, test, ship.
tunnel: true spawns a Cloudflare tunnel and points your number at it. Terminal test mode lets you simulate a call from your shell.
→ tunnel: https://abc.trycloudflare.com
→ ready · listening for calls
Inspect
Monitor every call in real time.
A built-in dashboard streams call metrics, transcripts, and per-segment cost — STT, LLM, TTS, audio — without leaving your machine.
Live metrics
Total calls, costs, latency, and active calls — streamed live.
Call history
Browse every call with full details, transcript, and per-stage cost.
Export & filter
Export to CSV or JSON with date filters for reporting and evals.
Per-segment cost
STT, LLM, TTS, carrier — see exactly what each call cost you.
Calls
Real-time view of every call routed through this Patter instance.
Recent calls
| Status | From → To | Carrier | Duration | P95 latency | Cost |
|---|---|---|---|---|---|
| live | +1 415 555 0182 → +1 555 000 1234 | Twilio | 01:42 | 488ms | $0.06 |
| live | +44 20 7555 0144 → +1 555 000 1234 | Telnyx | 00:37 | 372ms | $0.02 |
| live | +1 555 000 1234 → +1 212 555 0167 | Twilio | 02:18 | 744ms | $0.09 |
| ended | +1 718 555 0123 → +1 555 000 1234 | Twilio | 04:02 | 540ms | $0.18 |
| ended | +1 305 555 0188 → +1 555 000 1234 | Telnyx | 01:23 | 418ms | $0.04 |
| no answer | +1 555 000 1234 → +1 415 555 0173 | Twilio | 00:00 | — | $0.00 |
| ended | +1 408 555 0199 → +1 555 000 1234 | Twilio | 03:11 | 502ms | $0.13 |
Latency · last 24h
Ship
Build your voice agent on top of Patter.
You build the agent — we connect the phones.
Telephony, audio streaming, and carrier routing are taken care of. You write the prompt, the tools, and the logic.
Any LLM, any voice.
OpenAI, Anthropic, Groq, Cerebras, Google for LLM. 6 STTs and 5 TTSs. Provider-agnostic — startups and enterprises ship faster without lock-in.
Production ready from day one.
Call recording, transfer, DTMF, voicemail detection, barge-in, automatic retries — all built in, zero extra infrastructure.
3 layers
Customize
Fully customizable based on your needs.
Every layer of the stack is pluggable. Match latency, quality, cost, and compliance — without vendor lock-in.
Pick a model, swap it tomorrow.
Six transcribers, one interface.
Voices, hot-swappable mid-call.
End-to-end engines.
BYO carrier, BYO number.
Cleaner audio, sharper turns.
- LLM fallback chain. Automatic provider failover, mid-call.
- Terminal test mode. Simulate a call from your shell.
- Built-in Cloudflare tunnel. Public webhook in 3 seconds.
- Pipeline hooks. Middleware on STT, LLM, and TTS stages.
- Scheduled outbound. Cron and one-off scheduling, from the SDK.
- Eval harness. Regression testing with LLM-as-judge.
- Built-in dashboard. Real-time metrics, history, CSV/JSON export.
- 1,766 tests. Run them yourself; no telemetry, no lock-in.
Offering
100% open source, self-hosted.
Run Patter on your own infrastructure with your own provider keys. Full control, no lock-in — free under the MIT license.
From npm install to first call: ~5 minutes.
Permissive MIT license. No usage caps. No telemetry. The same SDK that runs in our examples runs in your production.
README · top of file
$ npm install getpatter # or: pip install getpatter $ export TWILIO_ACCOUNT_SID=AC... $ export TWILIO_AUTH_TOKEN=... $ export OPENAI_API_KEY=sk-... $ npx patter dev app.ts # tunnel up · https://abc.trycloudflare.com # ready · listening for calls on +1 555 000 1234 $ npx patter call --to +15558675309 → dialing... ringing... connected. → TTFA: 386ms · STT: deepgram · TTS: elevenlabs
Compare
No marketing math.
An open-source SDK between hosted platforms and self-hosted frameworks. Side-by-side with Vapi, Retell, LiveKit Agents, and Pipecat — what Patter does, what it doesn't, what you're choosing.
| Patter | Vapi | Retell | LiveKit Agents | Pipecat | |
|---|---|---|---|---|---|
| Architecture | Embedded SDK | Hosted platform | Hosted platform | SDK + server | Framework |
| Self-hosted, zero vendor infra | ✓ | — | — | ✓ | ✓ |
| TypeScript + Python parity | ✓ | ~ | ~ | ✓ | — |
| Per-segment cost dashboard | ✓ | ~ | ~ | — | — |
| Built-in Cloudflare tunnel | ✓ | — | — | — | — |
| End-to-end Realtime engines | ✓ | ✓ | ~ | ✓ | ✓ |
| License | MIT | Closed platform | Closed platform | Apache 2.0 | BSD-2 |
What you can build
Any voice workflow, powered by your agent.
Start building with Patter and see what's possible. The starter templates ship as standalone repos.
Customer support, 24/7.
AI phone agents handle tier-1 support around the clock. Route the messy ones to humans, mid-call.
↓ 70% answered < 30 secAppointment reminders.
Outbound calls confirm, reschedule, or cancel. Natural conversation, not a robot script.
↓ 60%+ no-showsLead qualification.
Agents call leads, qualify with natural conversation, sync to your CRM. Same handler, both directions.
↑ 3x SDR throughputSurveys & feedback.
Run NPS and customer surveys at scale through natural voice. Transcripts ready for analysis.
↑ 4x response rateTry it. Then ship it.
Call our agent. Read the four-line quickstart. Star the repo. Or hop on a 20-minute call with us — we'll help you wire your first agent.
Telnyx
OpenAI Realtime