Skip to main content
PyAI is telephony-native Voice AI behind one API key: Agents, voice agents built through UI or API and run on the Omni realtime endpoint; Hear for speech-to-text; Speak for text-to-speech; Clone for a custom voice from a short clip; Cast for expressive voice rendering; AMD for answering-machine detection; and Trace for compliance guardrails. The REST API is OpenAI-compatible at https://api.pyai.com/v1. For a saved agent you can manage in both the UI and code, start with Build and run Agents or Create agents via API. The direct Omni examples below remain useful when you want inline session configuration without a saved profile.

Step 1, get a key

Fastest: an instant sandbox key, no signup, email, or card. It works immediately, skips the credit gate, and is bounded by daily caps:
Verify it in 5 seconds (GET /v1/me echoes the org, scopes, and credit posture your key resolves to):
A working sandbox key returns JSON like this. Read scopes before you call a product. A sandbox mint includes Hear, Speak, Clone, Omni, Cast, AMD, Dub, Recap, and Trace. It does not include voice design or hosted knowledge-base management.
Install an SDK if you want retries and multipart handled for you:
See SDKs for when to use the SDK vs raw HTTP. For production: create an account and mint a pyai_live_ key in the console. Live usage is billed against prepaid credit; see the pricing page for current terms. HTTP auth accepts Authorization: Bearer <key> or the header alias x-api-key: <key>.
Fastest start: scaffold a complete, runnable example in one command, no clone, no setup ceremony.
Browse them all at github.com/atomsai/pyai-examples.

Step 2, pick what you’re building

Not sure which surface? Start at Choose your path.

AI voice agent (Omni)

Replace the speech-to-text, LLM, text-to-speech, VAD, and turn-detection cascade with one WebSocket.

Speech To Text (Hear)

Choose one-file, live-streaming, or timestamped async transcription.

Text To Speech (Speak)

Choose a voice, delivery mode, output format, and sample rate.

Clone a voice

Enroll a consented voice from a short clip and use it on Speak or Omni.

Expressive voice (Cast)

Direct, preview, and render expressive multi-line speech.

Answering-machine detection (AMD)

Know who or what answered, human, voicemail, IVR, screening, with the reason. Twilio drop-in.

Call summaries and actions (Recap)

Turn completed transcripts into notes, action items, talk ratio, signals, and fields.

Compliance guardrails (Trace)

Rule packs (TCPA, HIPAA, PII) and scorecards for eligible calls.

No code: Agents Live Beta

Configure, test, and connect an Omni voice agent from the console.

AI voice agent (Omni)

Omni is the complete voice agent behind one realtime endpoint. It hears, reasons, calls tools, grounds answers in your knowledge, and speaks back. Your app streams audio to one WebSocket instead of operating separate speech-to-text, LLM, text-to-speech, VAD, turn-detection, and interruption components. Connect and confirm that your key can configure a session:
Success is a control frame within about two seconds:
That proves authentication, framing, and configuration. To stream microphone audio and play the reply, continue with the browser tutorial. Start with the Omni overview, follow the browser tutorial, or configure and test an agent without code in the console. For every frame and event, use the wire protocol reference.
If you are updating an older Omni integration, follow the Omni endpoint migration guide before changing your client.

Speech-to-text (Hear)

One POST transcribes a file:
Expected response:
Need live partials (voice bots, captions, agent assist)? Stream over WebSocket instead. PyAI Hear’s first partial measured about 200 ms in-region: streaming STT guide. For large backlogs, the async batch jobs guide covers timestamped recordings, speaker labels, SRT/VTT, signed webhooks, and retention.

Text-to-speech (Speak)

voice is a stock voice id from GET /v1/voices (the curated prebuilt catalog with personas and avatars) or a cloned voice id from Clone. Omit it and Speak uses the default stock voice, stock_dorit_en_us. Send voice explicitly in production code so a change to the default can never change how your app sounds. pyai-speak is the canonical model. OpenAI’s tts-1 and tts-1-hd model names remain accepted for compatibility. The preset names alloy, echo, fable, onyx, nova, and shimmer also remain drop-in aliases for PyAI stock voices. See the Speak guide for the voice catalog, streaming vs buffered delivery, output formats, sample rates, and telephony.

Clone a voice

Enroll a consented English reference clip, poll until status is ready, then pass the returned voice_id to Speak or Omni:
Expected enroll response:
There is no GET-by-id for clones. Poll GET /v1/voice/clones (or pyai.clones.get in the SDK, which filters that list) until status is ready or failed. Then pass that id as voice on Speak or Omni. If the first render answers 409 voice_propagating, wait the Retry-After seconds and send the same request again — do not re-enroll. Clone requires the speak:clone scope. Signup keys and sandbox mint keys both include it. The Clone guide covers clip quality, polling, Omni use, and why a clip gets rejected.

Expressive voice rendering (Cast)

Cast lives only under /v1/cast/* and requires cast:render. Preview one line without a console project:
Success is a WAV file. If the voice is not on Cast, you get 422 unsupported_voice. Refresh GET /v1/cast/capabilities and pick an id from voices[]. The Cast guide covers direction, capabilities, and long-form render jobs.

Answering-machine detection (AMD)

Already on Twilio? Point a Media Stream at wss://api.pyai.com/v1/amd/stream and get answered_by (human, voicemail, ivr, screening, …) plus the reason it decided, in a fraction of the dead-air dwell. Set the operating-point dial and webhook once:
A mid-call decision looks like this:
Sandbox keys already include the AMD scopes. AMD records usage for answered calls; see the pricing page for current terms. Full walkthrough: AMD guide.

Compliance guardrails (Trace)

Trace scans eligible calls against built-in rule packs (TCPA, HIPAA, PII, brand-voice) and your own rules, then gives each scanned call a scorecard with plain-English findings. Turn it on for your org (or one agent) with one PUT:
Modes: warn logs only (never blocks), modify redacts PII / injects disclosures, block suppresses, human_handoff escalates. Always fail-open. Then read your exposure dashboard and per-call evidence:
Trace needs a key with the trace:configure / trace:read scopes. It’s in beta and must be enabled for your organization. Your console shows current terms and any promotional treatment; see the pricing page. Full walkthrough: Trace guide.

Call summaries and actions (Recap)

Sandbox keys include Recap scopes and mint with Recap enabled. Submit speaker-labelled utterances, then read the typed record:
POST returns 202 with status: "pending". Poll GET until status is complete. A finished record looks like this:
Full walkthrough: Recap guide.
Prefer the official SDKs. They handle auth, retries, idempotency, and realtime: npm install @pyai/sdk or pip install pyai-sdk.

Next steps

Use-case build guides

Build your own Gong, a voice dictation app, an AI receptionist, or call-center QA, step by step.

Build a browser voice agent

Mic → Omni → speakers in ~10 minutes, all client-side.

Agent greeting messages

Set an opening line on an agent profile in the console, spoken at turn 0.

Omni tools & function calling

Give your agent real actions: order lookups, bookings, transfers.

AMD guide

Twilio Media Streams drop-in, tuning, and webhooks.

SDKs

Official Python and TypeScript clients, plus LiveKit and Pipecat.

Authentication

Keys, environments, rotation, revocation.

Production readiness

Regions, languages, live-key billing, reconnect behavior, limits, and retention.

Pricing

Current rates, included usage, and plan availability.

Errors & limits

Error codes, rate limits, idempotency.

API reference

Full request/response schemas, right here in the docs.

Runnable examples

Copy-paste apps, OpenAI drop-in, voice cloning, telephony, call analytics. npm create pyai-app@latest.