<!-- Markdown representation of https://www.getpatter.com/ -->
> Open-source SDK for voice AI. Connect any AI agent to phone calls in 4 lines of code — pip install getpatter or npm install getpatter. Python & TypeScript, MIT licensed, sub-500ms latency.

Canonical URL: https://www.getpatter.com/
Site map: https://www.getpatter.com/sitemap.xml · Overview for LLMs: https://www.getpatter.com/llms.txt · Developer resources: https://www.getpatter.com/developers

---
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](tel:+19207728837) US number · standard carrier rates apply

main.py Live call · 00:14

```python
from getpatter import Patter, Twilio, OpenAIRealtime
# Bind a Twilio number to a Patter instance
phone = Patter(carrier=Twilio(), phone_number="+15550001234")
# Wire up the agent with prompt + engine
agent = phone.agent(engine=OpenAIRealtime(), system_prompt="Be a friendly receptionist.")
# Spawn a Cloudflare tunnel and start handling calls
await 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

Twilio Telnyx OpenAI Realtime ElevenLabs Deepgram Anthropic Cartesia

Twilio Telnyx OpenAI Realtime ElevenLabs Deepgram Anthropic Cartesia

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

```python
import asyncio, websockets, json
from twilio.rest import Client
from twilio.twiml.voice_response import VoiceResponse
from fastapi import FastAPI, WebSocket
import deepgram, httpx, audioop

app = FastAPI()
twilio = Client("SID", "TOKEN")

# Start outbound call with TwiML
call = twilio.calls.create(
 to="+1...", from_="+1...",
 url="https://your-server.com/twiml",
)

# Serve TwiML to connect media stream
@app.route("/twiml")
async def twiml():
 resp = VoiceResponse()
 connect = resp.connect()
 connect.stream(url="wss://your-server.com/ws")
 return str(resp)

# Handle WebSocket audio stream
@app.websocket("/ws")
async def ws_handler(ws: WebSocket):
 await ws.accept()
 dg = deepgram.DeepgramClient("DG_KEY")
 dg_ws = dg.listen.live.v("1")
 # Transcode mulaw 8kHz → PCM 16kHz
 # Process STT transcripts
 # Send text to OpenAI / your LLM
 # Stream response to ElevenLabs TTS
 # Resample 24kHz → 8kHz mulaw
 # Stream audio back over WebSocket
 # Handle barge-in, call state, errors...
 # ... 60+ more lines of boilerplate
```

main.py · partial + webhook signing, retry, recording…

With Patter SDK

### Just the agent.

4 lines

app.ts

```typescript
import { Patter, Twilio, OpenAIRealtime } from "getpatter";
// Bind a Twilio number to a Patter instance
const phone = new Patter({ carrier: new Twilio(), phoneNumber: "+15550001234" });
// Wire up the agent with prompt + engine
const agent = phone.agent({ engine: new OpenAIRealtime(), systemPrompt: "Be a friendly receptionist." });
// Spawn a Cloudflare tunnel and start handling calls
await 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 ms 412 ms 1 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 Realtime end-to-end

Pipeline · DG → 4o → EL composable

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.

1h 24h 7d All

Total calls

128

↑ 14% vs yesterday

Avg latency p95

512 ms

↑ 38 ms vs yesterday

Spend (24h)

$8.42

saved $1.20 from cache

Active now

3

2 inbound · 1 outbound

#### Recent calls

streaming · SSE

| 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

P50 total

412 ms

P95 total

512 ms

STT avg

122 ms

LLM avg

218 ms

TTS avg

128 ms

Network

42 ms

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

[View on GitHub →](https://github.com/PatterAI/Patter) [Read the docs →](https://docs.getpatter.com)

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.

[Get a demo →](https://www.getpatter.com/book-call) [View on GitHub](https://github.com/PatterAI/Patter) [Read the docs](https://docs.getpatter.com)

Or call us right now

+1 (920) 7-PATTER

US number · standard carrier rates apply · routes to a Patter agent running on this exact SDK

---

Engine OpenAI Realtime 2

TTFA 412 ms
