Skip to content

PyAI Omni

Realtime speech-to-speech API

Build voice agents that listen, respond as people speak and handle interruptions. Omni brings speech, reasoning and tool calls together over one WebSocket.

Working in a visual builder? Explore PyAI Agents.
PyAI in motionInteractive example

APPOINTMENT BOOKING

A conversation that keeps moving.

THE CALLER
“Could I book an appointment for Thursday?”
THE AGENT

“Of course. Would morning or afternoon work better?”

Omni · speech + reasoning + tools
Now see the actual product.Console tour · sample data

Illustrative workflow; no live call.

Natural, interruptible conversations
Your knowledge and actions
Built for phone, web and app

A live conversation

Say hello.
Eva is listening.

Try the PyAI voice agent in your browser. Ask a question, interrupt naturally and experience Omni for yourself.

Or call +1 (252) 888-7924

Starts only when you choose. Microphone access is required for a browser call. Calls may be recorded.

Talk to Eva in the browser, same Omni agent as the demo line.

Microphone options

Keep your phone close, or use earbuds with a microphone. Hold to talk keeps the mic off between presses; nearby voices may still come through while you speak.

On iPhone, during the call, open Control Center → app controls → Mic Mode → Voice Isolation, if available. See Apple’s guide (opens in a new tab)

Start a call to check the settings your browser reports.

Live voice demo, powered by Omni

From exploring to building

Set up an
Omni API session.

Choose the instructions, language and voice. The SDK example updates with your configuration, ready to use in your application. Get an API key

Configure your voice agent. Take the code.

Set the conversation style, language and voice. Copy the configured example, or open Agents to build and test visually.

Describe how your agent should respond. No saved agent is created by this example.

A matching voice is selected for each language. More voices are available in the console.

wss://api.pyai.com/v1/omni · PCM16 / 24 kHz

// Server-side Node.js example. Install: npm install @pyai/sdk ws
import PyAI from "@pyai/sdk";
import WebSocket from "ws";
import { readFile, writeFile } from "node:fs/promises";
import { setTimeout as delay } from "node:timers/promises";

const configure = {
  "voice_id": "stock_amelia_en_gb",
  "persona": "You are a helpful support agent. Keep answers concise, ask one question at a time, and explain clearly when you do not know the answer.",
  "language": "en"
};

// Supply raw 24 kHz PCM16 mono audio, at most 20 seconds.
const caller = await readFile("caller.pcm");
if (!caller.length || caller.length % 2 || caller.length > 24000 * 2 * 20)
  throw new Error("Use nonempty raw 24 kHz PCM16 mono audio, at most 20 seconds.");
const pyai = new PyAI({ apiKey: process.env.PYAI_API_KEY, baseURL: "https://api.pyai.com" });
const chunks = [];
let configured = false, closed = false, failure;
const session = pyai.omni.connect({
  rate: 24000, configure, webSocket: WebSocket,
  onConfigured: (frame) => {
    if (frame.language_fallback || frame.language_active !== configure.language)
      failure = new Error("Requested language is unavailable.");
    else configured = true;
  },
  onHello: (frame) => console.log("Output audio:", frame.audio_out),
  onAudio: (chunk) => chunks.push(Buffer.from(chunk)),
  onError: () => { failure = new Error("Omni session failed."); },
  onClose: () => { closed = true; },
});
try {
  const deadline = Date.now() + 5000;
  while (!configured && !failure && !closed && Date.now() < deadline) await delay(20);
  if (!configured || failure || closed) throw failure ?? new Error("Configuration timed out.");
  const silence = Buffer.alloc(960); // 20 ms, sent by the same paced loop.
  const start = performance.now();
  for (let offset = 0; offset < caller.length + 24000 * 2 * 10; offset += 960) {
    if (failure || closed) break;
    const chunk = offset < caller.length ? caller.subarray(offset, offset + 960) : silence;
    session.sendAudio(chunk);
    await delay(Math.max(0, start + ((offset + chunk.length) / 48) - performance.now()));
  }
  if (failure) throw failure;
} finally { session.close(); }
if (!chunks.length) throw new Error("No reply audio was received.");
await writeFile("reply.pcm", Buffer.concat(chunks));
// Bounded capture only; the 10-second listening window can truncate a long reply.
// This example saves audio. In an app, clear the player queue on onBargeIn.

Server-side SDK example; supplies audio from a file. Use the Playground for a microphone conversation.

Copy the code to use these settings, or open Agents to configure and test your agent.

Omni uses its native realtime protocol. The official SDK handles the connection and audio framing. Read the integration guide ↗

From an idea to a conversation

Meet your new
voice workspace.

Omni powers the conversation. Agents gives you a place to configure, save and test it. See how the two come together in the actual PyAI Console.

Product tour
Actual Console UI · sample workspaceAria Natural · PyAI Speak

PyAI / realtime Playground

PyAI Console realtime Playground with sample agent settings ready for a test conversation
Actual Console UI · sample setup. This capture does not show a live inference session.

03 / Put it to work

One agent.
Your kind of connection.

Use the visual builder or integrate directly. Agents stores your profile; Omni runs each realtime conversation. Start where it fits your team.

Add a voice assistant to your website

In Agents, open Website & phone. Add your exact HTTPS website origins, choose the launcher and publish. Paste the generated script into a site you can edit; visitors need no phone number.

Publish a website widget

On the phone

Connect your agent to managed telephony or bring your carrier. Omni supports native 8 kHz phone audio and conversational interruption.

Explore Telephony

In your application

Use a saved profile through the Agents API, or configure a direct Omni session with the official SDK.

Read the API workflow

A little more detail

Good questions.
Clear answers.

Check current rates and your project’s effective limits before starting sessions. Live usage can incur charges; managed telephony is billed separately.

What is the Omni API?

Omni is PyAI's realtime speech-to-speech API for conversational voice agents. It takes caller audio and streams spoken responses over one WebSocket, with support for interruptions, knowledge retrieval and tool calls. Configure the voice, instructions and tools per session. Managed PyAI Telephony handles phone controls such as transfers and hangups.

Do I need a saved Agent to use Omni?

No. Connect directly to Omni with the official SDK and configure the voice, instructions and tools for each session. Use PyAI Agents when you want to save that setup, test it in the console and deploy it to a website or phone line.

Does Omni support tool / function calling?

Yes, three ways. Enable prebuilt hosted tools by name with zero setup (knowledge search, web search, weather, currency, unit conversion, math, date/time, geocoding, news). Register your own as a server tool and Omni calls your signed webhook from a network-isolated executor, which works on phone calls, since your code never has to be on the socket. Or run tools client-side in a browser app. Omni's brain fills the arguments from the conversation, calls the tool mid-call, and speaks the result, with sensible timeouts and fail-open behavior so audio never stalls. Your endpoints and secrets never touch the model. Live call control (transfer to a human, send DTMF, play hold, hang up) runs in your telephony transport today and is handled for you on managed Telephony.

How does knowledge-base grounding work?

Connect a knowledge source so Omni can retrieve relevant facts during a conversation. If you use your own endpoint, you host the source and return the relevant excerpts for Omni to use in its answer.

Can Omni use my own voice, with emotion?

Yes. Use any expressive stock voice, or bring your own: voice cloning enrollment and prompt-to-voice design are free. Drop the resulting voice_id into the configure frame and Omni speaks with it: emotion-aware, in the voice that fits your brand and language.

How is Omni different from a separate STT, LLM and TTS pipeline?

Omni brings speech recognition, reasoning and speech generation into one realtime session. A separate pipeline connects individual services for transcription, reasoning and speech synthesis. If you already have conversation logic in your app, use Hear for transcription or Speak for spoken output.

I'm already on another provider, how hard is the switch?

REST speech calls keep their OpenAI-compatible shape. Realtime agents need a wire adapter because Omni uses a binary kind-byte protocol rather than OpenAI Realtime JSON events. Start with the native Omni protocol guide and verify audio and control framing before production.

Why does telephony / 8 kHz matter?

Phone lines carry 8 kHz narrowband audio, far less detail than studio sound. Models trained on clean wideband audio lose accuracy on real calls. Omni is built for narrowband, so it stays accurate on the lines you actually run on.

Which realtime URL should I use?

Use wss://api.pyai.com/v1/omni?session_label=<label>&format=pcm16&rate=24000. Omni uses its documented native kind-byte framing; REST transcription and speech keep their OpenAI-compatible shapes.

Your next conversation starts here

Give your idea
a voice.

Want a hand with setup? Build with AtomsAI ↗ · Optional implementation services, scoped separately.