API Reference
Complete reference for all types, interfaces, and exports in thegetpatter package.
Patter Class
Constructor
Instance Methods
Carriers
Twilio
Telnyx
Engines
OpenAIRealtime
OpenAIRealtime2
OpenAIRealtime2Adapter and speaks the GA session.update wire shape (output_modalities, nested audio.{input,output}, session.type = "realtime"). GA session config pins turn_detection.create_response: false and interrupt_response: false so Patter owns response creation and barge-in cancellation. See OpenAIRealtime2.
ElevenLabsConvAI
STT classes
apiKey?: string and falls back to the provider’s standard env var. See the STT page for full constructor signatures.
TTS classes
apiKey?: string and falls back to the provider’s standard env var. See the TTS page for full constructor signatures.
LLM classes
apiKey?: string and falls back to the provider’s standard env var (GoogleLLM prefers GEMINI_API_KEY, falls back to GOOGLE_API_KEY). Pass an instance via phone.agent({ llm }) for pipeline mode. llm is mutually exclusive with onMessage on serve() and is ignored when engine is set. See the LLM page for full constructor signatures.
Tunnels
tunnel: true on new Patter(...) or phone.serve(...) is shorthand for new CloudflareTunnel().
Tools & Guardrails
Tool
handler or webhookUrl must be provided.
Guardrail
Interfaces
AgentOptions
provider is a closed string literal — only 'openai_realtime', 'elevenlabs_convai', or 'pipeline' are valid. It is normally derived from engine / stt + tts and rarely set by hand.
ServeOptions
localRecording enables carrier-neutral SDK-side recording: an interleaved stereo WAV (left = caller, right = agent, PCM16 16 kHz) written incrementally per call. Pass a directory string to choose the output directory. The final path is surfaced as recording_path in the onCallEnd payload. Independent of the carrier-side recording flag. See Local Recording.
LocalCallOptions
ToolDefinition
IncomingMessage
CallControl
CallMetrics / CostBreakdown / LatencyBreakdown / TurnMetrics / ProviderPricing
See Metrics for the full shapes.Error Classes
All errors extendPatterError, which extends the native Error class.
ErrorCode
Every Patter exception carries a stable, machine-readablecode property. Branch on the code instead of class-name strings:
const object plus value-union type (not a TS enum) so it is tree-shakeable and compatible with verbatimModuleSyntax. Mirrored byte-for-byte by the Python ErrorCode StrEnum.
Top-level exports
getpatter.
