# PyAI API > Telephony-native Voice AI behind one bearer key. Products: Hear > (speech-to-text), Speak (text-to-speech), Clone (custom voices), Omni (agentic > full-duplex voice grounded in your knowledge bases and tools), and the AMD API > (answering-machine detection: human vs voicemail/IVR/screening/dead-number, in > a fraction of the dead-air dwell, with the reason); Agents Beta is the live > no-code console path for managed Omni agents. OpenAI-compatible REST at https://api.pyai.com/v1. Keys > are self-validating signed tokens that work on every surface the instant they > are created, treat them as opaque strings and never parse them. ## Connect through MCP Use https://api.pyai.com/mcp with browser OAuth. Setup: https://pyai.com/mcp. Agent guide: https://pyai.com/mcp-agent-guide.md. Call get_started, whoami and discover_tools. ## Start here - Speech and calling decision tree: https://pyai.com/agents/speech-calling.md - Omni frame contract: https://api.pyai.com/omni-frames.json (AsyncAPI JSON with SDK notes). - Machine status: https://status.pyai.com/status.json - OpenAPI spec: https://api.pyai.com/openapi.json (machine-readable contract, source of truth). - Docs: https://docs.pyai.com (quickstart, guides, and the generated API reference). ## Choose the job - Telephony transcription: Hear, not Recap. Recorded audio: https://docs.pyai.com/guides/hear-overview and https://docs.pyai.com/guides/async-transcription-jobs. Live phone audio: https://docs.pyai.com/guides/streaming-stt. Decode G.711 to PCM16 at 8 kHz before streaming; streaming partials are revisable. Check the guide before requesting word timestamps or speaker labels. - Streaming TTS for a phone application: Speak POST /v1/audio/speech with stream:true and response_format:g711_ulaw (8 kHz mono), or PCM at a supported sample rate. Consume chunks with backpressure; do not wait for arrayBuffer(). MP3/Opus are buffered. No Calling tool or carrier account is needed to generate audio bytes. Guide: https://docs.pyai.com/guides/speak-overview. Runnable one-request example: https://github.com/atomsai/pyai-examples/tree/main/speak-telephony-formats. - LiveKit / Pipecat: keep your existing transport, LLM, tools and turn policy; add Hear and Speak. Follow the framework guides below. Downloadable starters exercise speech adapters, not complete room or microphone agents. - Voice agents: Omni runs the conversation over one WebSocket; saved Agents profiles are optional. Guide: https://docs.pyai.com/guides/omni-overview. Browser token broker example: https://github.com/atomsai/pyai-examples/tree/main/omni-browser-widget. Provision telephony only when the user actually requests a carrier call or number. - Dubbing: Dub translates an existing recording asynchronously. Read https://api.pyai.com/healthz/dub for independent source_langs and target_langs before choosing languages. Submit once, retain the job ID, poll until done or error, then download. Runnable API workflow: https://docs.pyai.com/guides/dub-overview. Do not infer language support from Speak voices or assume English-to-Hindi only. - Examples index: https://github.com/atomsai/pyai-examples. SDK downloads: https://pyai.com/sdks.md. ## CLI for engineers and coding agents - CLI setup and authentication: https://docs.pyai.com/guides/cli. Handbook: https://pyai.com/cli.md. Agent guide: https://pyai.com/cli-agent-guide.md. - Use pyai login for browser sign-in; unattended clients use an authorized server-side PYAI_API_KEY. Inspect the saved project before running usage commands. - Offline discovery: pyai schema --json, pyai recipes, pyai init voice-project --template agent. Live API discovery: pyai schema --openapi --json. The installed CLI schema is authoritative for that executable; https://pyai.com/cli-schema.json describes the published source snapshot. ## Agent frameworks - LiveKit Agents (Python): https://docs.pyai.com/guides/livekit-agents. Pinned install, compatibility and downloadable TTS adapter starter: https://pyai.com/sdks/livekit.md. - Pipecat (Python): https://docs.pyai.com/guides/pipecat. Pinned install, compatibility and downloadable text-to-WAV pipeline: https://pyai.com/sdks/pipecat.md. - Both packages are available on public PyPI and use the normal `PYAI_API_KEY` plus Hear and Speak scopes. ## Identity, billing and authentication - Before any generation or transcription, call GET /v1/me (MCP: whoami). Verify org_id, project_id, environment, scopes, limits and billing/credit context against the intended project. Do not infer identity or free usage from a key prefix or tool name. Stop on a mismatch or unknown budget; never switch to a live project automatically. - Test usage has enforced limits; live usage is billed. Current meters and rates: https://pyai.com/pricing. Agree a bounded input/request count before generating, and do not retry uncertain billable submissions blindly. - Header: `Authorization: Bearer pyai_live_...` (alias `x-api-key`). - Environments: `pyai_live_...` (production), `pyai_test_...` (sandbox). - WebSocket: use the official SDK for subprotocol auth. Omni browsers use short-lived origin-locked session tokens minted with POST /v1/omni/sessions by an authenticated backend; pass the pyai.v1 and pyai-key. subprotocol pair. Never expose long-lived keys or query-string credentials. Hear browser clients require a backend proxy; Omni tokens do not authorize Hear. - Keys are opaque (<=512 chars). Do not parse or decode. No activation/propagation delay. ## Endpoints - POST /v1/audio/transcriptions, speech-to-text, Hear (scope hear:transcribe). - GET /v1/audio/transcriptions/stream?protocol=pyai-hear-v1, streaming speech-to-text over WebSocket with eager partials (scope hear:stream). pyai-hear-v1 is the only protocol. Force a final with the JSON frame {"type":"commit"}. Cue grounding fields are reserved but not active on the serving route. - GET/PUT /v1/hear/vocabulary, organization-owned custom vocabulary with separate batch and hear_stream activation (scope hear:configure). - POST /v1/audio/speech, text-to-speech, Speak (scope speak:synthesize). - GET /v1/voices, GET /v1/voices/{id}, voice catalog (any active key). - GET/POST /v1/voice/clones, voice cloning (scope speak:clone). - GET/POST /v1/cast/*, expressive voiceover direction, previews, and renders (scope cast:render). - POST /v1/dub; GET /v1/dub/jobs/{job_id}[/{audio|video}], asynchronous dubbing (scope dub:render). Read /healthz/dub for supported input and output languages; poll until done or error. - GET /v1/models, model catalog (any active key). - POST/GET /v1/transcription/jobs, async batch STT (scopes hear:transcribe + transcribe:jobs). - Realtime WebSocket, Omni: wss://api.pyai.com/v1/omni?session_label=