Migrate to attach() + guard()
Thevoicegateway.LLM("openai/gpt-4o") / STT(...) / TTS(...) factories are
deprecated. They still work and still meter, but they emit a
DeprecationWarning and will be removed in a future release. This guide moves you
to the framework-neutral shape: native providers + attach(), plus
guard() where you had fallback or limits.
Why the change
- No more double-count. The old factories and
attach()both subscribed to the same metrics events, so usingvoicegateway.LLM()together withattach(session)counted every call twice.attach()is now the single meter, so this class of bug is gone. - Bring-your-own-keys, native providers. You construct native
livekit.plugins.*orpipecat.services.*providers with your own keys and settings, exactly as the framework documents them. VoiceGateway observes and (optionally) controls them instead of re-homing their configuration. - Framework-neutral. The same
attach()/guard()surface works on both LiveKit and Pipecat, andimport voicegatewaypulls neither framework.
The mapping
| Old | New |
|---|---|
voicegateway.LLM("openai/gpt-4o") | native openai.LLM(model="gpt-4o") + attach(session) |
voicegateway.STT("deepgram/nova-3") | native deepgram.STT(model="nova-3") + attach(session) |
voicegateway.TTS("cartesia/sonic-3") | native cartesia.TTS(model="sonic-3") + attach(session) |
a factory with fallback=[...] | voicegateway.guard(provider, fallback=[...]) |
| per-project daily budget / rate limits | voicegateway.guard(provider, budget="$5.00/day", rate_limit="60/min") |
attach(), control moves to
guard(). Metering happens once (in attach) regardless of how many providers
you guard.
LiveKit
Before:Pipecat
The old factories were LiveKit-only. On Pipecat you construct nativepipecat.services.* and observe them the same way. Enable Pipecat’s metrics so
there is usage for attach() to record:
Install the right extra
The factories pulledlivekit implicitly. Now install the extra for the
framework you run:
Silencing the warning during migration
While you migrate, the deprecated factories keep working. If aDeprecationWarning breaks a strict test run, filter it narrowly until you have
moved that call site over:
See also
- attach(): the single meter.
- guard(): fallback, rate limits, and spend caps.
- Frameworks and extras: the framework-neutral core and extras.