Skip to content
All migration guides
Voice agents

Switch from OpenAI Realtime to PyAI Omni

Keep the realtime mental model. Move phone-agent economics to PyAI.

Omni gives OpenAI-style realtime integration with a phone-agent-specific engine and a flat $0.05/min price. Use the native /v1/omni WebSocket or the OpenAI-compatible /v1/realtime alias, then add Trace, Recap, and the Agents feature as calls move into production.

Try the migration

A browser Omni voice agent in one <script> tag, scaffold the runnable example in one command, no clone:

Terminal
npm create pyai-app@latest omni-browser-widget

Why teams move from OpenAI Realtime

Flat minute pricing

Omni is $0.05/min all-in, so production phone calls are easy to model before they scale.

Built for telephony

Turn-taking, barge-in, and 8 kHz call audio are first-class instead of adapted from a general model API.

Production call layer

Trace, Recap, KB Context, and the Agents feature sit on the same account and billing model.

Before and after

Before - OpenAI Realtime
const ws = new WebSocket(
  "wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview",
  ["realtime", "openai-insecure-api-key." + openaiKey],
);
After - PyAI Omni
const ws = new WebSocket(
  "wss://api.pyai.com/v1/realtime?model=pyai-omni-realtime&agent_id=front_desk",
  ["pyai-key." + pyaiKey],
);
ws.onmessage = (e) => playAudioFrame(e.data);

Migration checklist

1

Swap the connection

Change the base URL or WebSocket URL, pass a PyAI key, and keep the old client where the API shape is compatible.

2

Map models, voices, and formats

Use the table below to replace model ids, voice ids, response formats, sample rates, and auth headers without rewriting the product flow.

3

Replay customer traffic

Run real prompts, recordings, and phone-call samples through both systems. Compare latency, quality, completion rate, and all-in cost.

4

Launch with guardrails

Start on free credits or test keys, add usage alerts, then enable Trace, Recap, or the Agents feature when calls need production review.

If the system you are leaving already uses OpenAI-compatible transcription, speech, or realtime APIs, start with the smallest compatible swap: base URL, key, model, and voice. The real test is whether PyAI improves cost, latency, and caller outcomes on your own traffic.

What maps to what

OpenAI RealtimePyAI
wss://api.openai.com/v1/realtimewss://api.pyai.com/v1/realtime?model=pyai-omni-realtime&agent_id=<id>
Authorization: Bearer OPENAI_API_KEYSubprotocol pyai-key.<key> or Authorization: Bearer pyai_live_...
Model-specific audio/token pricing$0.05/min all-in Omni pricing
Session instructionsagent_id + your KB endpoint + tools

Good to know

  • For new integrations, use the native URL wss://api.pyai.com/v1/omni?agent_id=<id>&format=pcm16&rate=24000.
  • format and rate are load-bearing on the native Omni URL.
  • Trace can scan production calls at $0.05/min or as part of an enterprise package.
  • Scaffold a working browser voice agent with npm create pyai-app@latest omni-browser-widget (github.com/atomsai/pyai-examples).

FAQ

Is the API identical?

Use the OpenAI-compatible realtime alias for migration, or the native Omni URL for new builds. Some event details differ, so verify with the docs before production.

Why switch if I already use OpenAI?

PyAI is narrower: phone-agent latency, telephony audio, predictable per-minute pricing, and call compliance tooling.

Move your realtime voice agent to $0.05/min.

Start free with $50 in credits, no card.

Agents is live in beta. Sandbox keys have daily limits and never touch billing.