Skip to main content

From a key to working audio

PyAI Hear transcribes audio, Speak synthesizes speech, and Omni runs a complete voice-agent conversation. Start with your existing language or framework.

Get a key

Create a key in PyAI Console. For a bounded test, you can also request a sandbox key:
Keep the returned api_key private. Sandbox keys expire and have usage and concurrency limits. Store your key as PYAI_API_KEY in a local .env file excluded from Git, or in your deployment’s secret store. Never put a live key in client-side JavaScript or paste it into a coding-agent prompt.

Make a first call

With PYAI_API_KEY exported in your shell, save a speech file:
Transcribe a recording you are authorized to process:
Omitting the Hear language hint enables automatic detection. Use the language support table to select a voice and confirm coverage.

Download a complete starter

Every starter includes the entry point, dependencies, .env.example, and run instructions. These download URLs do not require access to an internal repo. Python and TypeScript exercise Speak and optionally Hear. The LiveKit starter tests its TTS adapter without a room; the Pipecat starter runs a text-to-audio pipeline. Their detailed guides cover conversational agents. Twilio requires your phone number, auth token, and a public HTTPS server or tunnel.

Connect a coding agent

Install Node.js 22+ and your chosen coding agent first. These commands register PyAI’s local stdio MCP server; they do not create a production key. Claude Code:
Codex:
Cursor: merge this entry into .cursor/mcp.json, preserving existing servers:
Open your client’s MCP tools view, enable the server if prompted, and ask it to call get_started. For a sandbox test, ask it to call create_sandbox_key once and then list_voices. Tool execution follows your coding agent’s permissions. Paste this task into your agent:

Install the Markdown skill (optional)

Codex, from your project directory:
Claude Code, from your project directory:
Review the downloaded skill before using it; rerunning replaces that PyAI skill file. For other tools, attach the Markdown or give the agent its public URL. Setup references: Codex MCP, Codex skills, Cursor MCP, and Claude Code MCP.

Streaming and production

Consume audio chunks immediately; reuse clients and cancel interrupted streams. Use PCM, WAV or G.711 for streaming. MP3 and Opus are buffered. First received bytes and speaker playback latency are different measurements. For long recordings use async jobs. For callbacks read webhooks. Before deployment, follow production readiness. The OpenAPI contract and documentation index provide the complete API.