Skip to main content

TypeScript SDK

The Patter TypeScript SDK lets you connect AI voice agents to phone numbers in minutes. Run everything locally with full control over your infrastructure — no external platform required.

Installation

npm install getpatter

Requirements

  • Node.js 18 or higher
  • An account with at least one telephony provider (Twilio or Telnyx)
  • An AI provider key (OpenAI, ElevenLabs, or Deepgram)

Minimal Example

import { Patter } from "getpatter";

const phone = new Patter({
  mode: "local",
  twilioSid: process.env.TWILIO_SID,
  twilioToken: process.env.TWILIO_TOKEN,
  openaiKey: process.env.OPENAI_KEY,
  phoneNumber: "+15550001234",
  webhookUrl: "abc.ngrok.io",
});

const agent = phone.agent({
  systemPrompt: "You are a friendly receptionist for Acme Corp.",
  firstMessage: "Hello! Thanks for calling Acme Corp. How can I help you?",
});

await phone.serve({ agent });

SDK Mode

Patter runs in local mode, embedding an Express server and all provider adapters directly in your application:
ModeUse CaseRequirements
LocalSelf-hosted, full controlTelephony + AI provider keys
Local mode includes an embedded Express server and all provider adapters. Use it when you want full control over your infrastructure.

What’s Next

Quickstart

Step-by-step guide to your first voice agent.

Configuration

All constructor parameters and mode options.

Agents

Configure voice, model, tools, and guardrails.

Providers

OpenAI Realtime, ElevenLabs, and custom pipelines.

Tools

Function calling and webhook integrations.

Events

React to call lifecycle events in real time.