Documentation Index
Fetch the complete documentation index at: https://patter-06b046ce-feat-observability-otel-attrs-0-6-1.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
TypeScript Quickstart
Patter connects an AI agent to a real phone number in four lines of TypeScript. This page walks you end-to-end: install, credentials, the four lines, and your first call.Prerequisites
- Node.js 18+
- A Twilio or Telnyx account with a phone number you own
- An AI provider key — OpenAI for the default Realtime engine, or any supported STT/TTS pair for pipeline mode
Step 1 — Install
Step 2 — Set environment variables
Each carrier and engine reads its credentials from the environment by default. The four-line quickstart below works as-is once these are set.| Variable | Purpose |
|---|---|
TWILIO_ACCOUNT_SID | Account SID from the Twilio console. Starts with AC. |
TWILIO_AUTH_TOKEN | Auth token paired with the SID. Keep it secret. |
OPENAI_API_KEY | Used by OpenAIRealtime, WhisperSTT, and OpenAITTS. |
TELNYX_API_KEY and TELNYX_CONNECTION_ID (plus optional TELNYX_PUBLIC_KEY for webhook signature verification) and use new Telnyx() in place of new Twilio(). See the Carrier page for all supported env vars.
Step 3 — The four-line quickstart
Createmain.ts:
main.ts
firstMessage:
- Import — the three primitives you need: the client, a carrier, and an engine. All three read credentials from environment variables by default, so no keys appear in source.
new Patter({...})— build the client and bind it to your phone number.new Twilio()(ornew Telnyx()) carries the carrier credentials; swap it to change providers.phone.agent({...})— describe the agent: the engine (OpenAI Realtime by default), the system prompt, and the first message it speaks on answer.await phone.serve({ agent, tunnel: true })— start the embedded server.tunnel: truespawns a Cloudflare tunnel and points your Twilio number at it automatically, so the agent is reachable from the PSTN without any additional DNS or firewall work.
tunnel: true is the dev shorthand. In production replace it with a stable webhook URL via the constructor:new Patter({ ..., tunnel: new StaticTunnel({ hostname: "agent.example.com" }) }). See Tunneling.Step 4 — Run it
Step 5 — Call the number
Pick up your phone, dial your Twilio number, and the agent will answer with"Hello! How can I help?". Start talking.
Using a different engine
OpenAI Realtime is the default. To switch engines, pass a different instance:new ElevenLabsConvAI() reads ELEVENLABS_API_KEY and ELEVENLABS_AGENT_ID from the environment.
For the STT + LLM + TTS pipeline mode, pick each stage independently:
new AnthropicLLM() for new OpenAILLM(), new GroqLLM(), new CerebrasLLM(), or new GoogleLLM() — tool calling works across all five. Need fully custom LLM logic? Drop llm and pass onMessage to serve() instead.
What’s next
Configuration
Every constructor option in one place.
Agents
Customize voice, model, tools, and guardrails.
STT providers
Deepgram, Whisper, Cartesia, Soniox, AssemblyAI.
TTS providers
ElevenLabs, OpenAI, Cartesia, Rime, LMNT.
Tools
Give your agent function-calling superpowers.

