Patter Patter v0.5.5
Open-source · MIT

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.

Or call our agent yourself — +1 (920) 7-PATTER US number · standard carrier rates apply
main.py Live call · 00:14
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)
+1 (415) 555-0142 · San Francisco, CA
caller

Hi, I'd like to book an appointment for next Tuesday.

agent

Tuesday's wide open. Morning or afternoon?

caller

Late morning if possible.

agent

Got it — 11:15 it is.

TTFA · 412 ms STT · Deepgram TTS · ElevenLabs
Built to slot into

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

371 lines
 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
main.py · partial + webhook signing, retry, recording…

With Patter SDK

Just the agent.

4 lines
app.ts
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 });
app.ts 367 lines saved

Build

What you can build.

A small, fast, opinionated set of primitives. Inbound, outbound, end-to-end voice, pipeline mode — same handler.

01 / Inbound & Outbound

One handler, both directions.

Receive incoming calls and place outbound dials with the same agent code. Native scheduling, voicemail detection, DTMF.

↘ Inbound↗ Outbound
02 / Latency

<500 ms time-to-first-audio.

Native 16 kHz streaming, frame-level buffering, first-flush optimization. Sub-500 ms TTFA on Realtime mode.

0 ms412 ms1 s
03 / Architectures

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.

OpenAI Realtimeend-to-end
Pipeline · DG → 4o → ELcomposable
04 / Tools

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): …
05 / Guardrails

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.

barge-in transfer record DTMF
06 / Dev loop

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.

patter dev
→ 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.

01
Live metrics

Total calls, costs, latency, and active calls — streamed live.

02
Call history

Browse every call with full details, transcript, and per-stage cost.

03
Export & filter

Export to CSV or JSON with date filters for reporting and evals.

04
Per-segment cost

STT, LLM, TTS, carrier — see exactly what each call cost you.

Patter
dashboard · v0.5.5
3 live · 12 today +1 555 000 1234

Calls

Real-time view of every call routed through this Patter instance.

1h24h7dAll
Total calls
128
↑ 14% vs yesterday
Avg latency p95
512ms
↑ 38 ms vs yesterday
Spend (24h)
$8.42
saved $1.20 from cache
Active now
3
2 inbound · 1 outbound

Recent calls

streaming · SSE
StatusFrom → ToCarrierDurationP95 latencyCost
live+1 415 555 0182 → +1 555 000 1234Twilio01:42
488ms
$0.06
live+44 20 7555 0144 → +1 555 000 1234Telnyx00:37
372ms
$0.02
live+1 555 000 1234 → +1 212 555 0167Twilio02:18
744ms
$0.09
ended+1 718 555 0123 → +1 555 000 1234Twilio04:02
540ms
$0.18
ended+1 305 555 0188 → +1 555 000 1234Telnyx01:23
418ms
$0.04
no answer+1 555 000 1234 → +1 415 555 0173Twilio00:00$0.00
ended+1 408 555 0199 → +1 555 000 1234Twilio03:11
502ms
$0.13
Latency · last 24h
P50 total
412ms
P95 total
512ms
STT avg
122ms
LLM avg
218ms
TTS avg
128ms
Network
42ms

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.

The Patter Stack Patter Stack — Agent / Patter / Telephony 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.

27+
provider integrations across the voice stack
3
voice modes — Realtime, Pipeline, Hybrid
2
SDKs — Python & TypeScript at parity
LLM text generation
Pick a model, swap it tomorrow.
OpenAI Anthropic Google Gemini Groq Cerebras
STT speech-to-text
Six transcribers, one interface.
Deepgram AssemblyAI Cartesia Soniox Speechmatics Whisper
TTS text-to-speech
Voices, hot-swappable mid-call.
ElevenLabs OpenAI Cartesia LMNT Rime Telnyx
Realtime all-in-one voice
End-to-end engines.
OpenAI Realtime Gemini Live Ultravox ElevenLabs ConvAI
Telephony phone carriers
BYO carrier, BYO number.
Twilio Telnyx · beta
Audio VAD & suppression
Cleaner audio, sharper turns.
Silero VAD Krisp DeepFilterNet
  • 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.

40+ features · growing every release

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.

License
MIT
Tests
1,766 ✓
Stars
Releases
weekly

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
Fully supported ~ Partial · behind hosted dashboard Not supported

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.

01 / Support

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 sec
02 / Reminders

Appointment reminders.

Outbound calls confirm, reschedule, or cancel. Natural conversation, not a robot script.

↓ 60%+ no-shows
03 / Sales

Lead qualification.

Agents call leads, qualify with natural conversation, sync to your CRM. Same handler, both directions.

↑ 3x SDR throughput
04 / Research

Surveys & feedback.

Run NPS and customer surveys at scale through natural voice. Transcripts ready for analysis.

↑ 4x response rate

Try 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.