Skip to main content

Engines

An engine is an end-to-end speech-to-speech runtime. Pass an engine instance to phone.agent(engine=...) and Patter wires the audio stream straight through to the provider — no separate STT or TTS is needed. Patter ships several engine classes:
  • OpenAIRealtime — OpenAI’s Realtime API (v1-beta family, gpt-realtime-mini / gpt-realtime / gpt-4o-*-realtime-preview)
  • OpenAIRealtime2 — OpenAI’s GA Realtime API (gpt-realtime-2), separate marker because the GA endpoint speaks a different session.update wire shape
  • ElevenLabsConvAI — ElevenLabs Conversational AI
  • XaiRealtime — xAI Grok Voice Agent (OpenAI-GA-compatible)
Each class ships as both a flat alias (from getpatter import OpenAIRealtime) and a namespaced class (from getpatter.engines import openaiopenai.Realtime()). They are equivalent. If you need full control over STT, LLM, and TTS independently, use pipeline mode instead and omit engine=.

OpenAIRealtime

OpenAI’s Realtime API — the lowest-latency option.
Telephony audio. Over Twilio/Telnyx the OpenAIRealtime engine routes through the same GA-compatible adapter as OpenAIRealtime2: it negotiates PCM-16-LE @ 24 kHz with OpenAI and transcodes to/from the carrier’s mulaw 8 kHz internally. Current OpenAI Realtime models return PCM16 @ 24 kHz regardless of a legacy g711_ulaw request, so Patter standardises on PCM and converts on the carrier leg — you don’t configure anything.

Supported model identifiers

The model argument accepts any OpenAI Realtime model ID. Common values: Pricing is auto-resolved per model — see Metrics. For reasoning_effort, transcription model, and the full configuration surface, see OpenAI Realtime — full reference. Namespaced form:

OpenAIRealtime2

Marker class that selects the GA Realtime API (gpt-realtime-2). The GA endpoint speaks a different session.update wire shape than the v1-beta family (no OpenAI-Beta: realtime=v1 header, session.type: "realtime", nested audio.{input,output} with MIME types, output_modalities instead of modalities), so OpenAIRealtime2 dispatches to a separate adapter (OpenAIRealtime2Adapter).
Namespaced form:
PCM transport: the GA endpoint accepts only PCM-16-LE at >=24 kHz. Patter transcodes inbound mulaw 8 kHz → PCM 24 kHz and outbound PCM 24 kHz → mulaw 8 kHz transparently on the carrier side; you don’t need to configure anything.

ElevenLabsConvAI

ElevenLabs Conversational AI — premium voice quality using a managed agent configured in the ElevenLabs dashboard.
Namespaced form:

XaiRealtime

xAI’s Grok Voice Agent — an OpenAI-Realtime-GA-compatible speech-to-speech engine with on-by-default reasoning and server-side tools (web_search, x_search, mcp, file_search).
Namespaced form:
For the full session-option surface — VAD tuning, language hint, keyterms, pronunciation replacements, session resumption, and server-side tools — see xAI Realtime — full reference.
Beta — spec-validated, not yet live-call-validated.

What’s Next

LLM

Compare engine mode with pipeline mode.

STT

STT for pipeline mode.

TTS

TTS for pipeline mode.