PyAI Omni API
The flagship: build an AI voice agent with one WebSocket (`GET /v1/omni`) and one `configure` frame, nothing to pre-create. This group also holds the optional browser-token mint and the post-call records.
The flagship: build an AI voice agent with one WebSocket (`GET /v1/omni`) and one `configure` frame, nothing to pre-create. This group also holds the optional browser-token mint and the post-call records.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/pyai-com:pyai-com-omni-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: PyAI Omni API
version: 2.14.0
description: 'Telephony-native Voice AI behind one bearer key:
- **Hear**, speech-to-text · `POST /v1/audio/transcriptions` (streaming + batch)
- **Speak**, text-to-speech · `POST /v1/audio/speech`, `GET /v1/voices`
- **Clone**, custom voices from a short clip · `/v1/voice/clones`
- **Cast**, auto-directed expressive voiceovers · `/v1/cast`
- **Dub**, asynchronous audio and video dubbing · `POST /v1/dub` (guide)
- **Cue configuration frames (reserved)**; Hear streams skip knowledge-base retrieval by default
- **Omni**, full-duplex agentic voice (speech-to-speech, grounded in your knowledge bases + tools) · `/v1/omni`
- **Knowledge Bases**, hosted grounding for Omni: create bases, add documents (file, URL, or text), crawl a public website, bind to agents or org defaults · `/v1/knowledgebases`
- **AMD API**, answering-machine detection: know *who or what* answered a call (human, voicemail, IVR, iPhone/Google screening, dead number) with the reason it decided · `wss …/v1/amd/stream` (Twilio Media Streams drop-in), `POST /v1/amd/config`, `GET /v1/amd/calls/{id}`
- **Agents Beta**, the live console feature to create, configure, test, and connect Omni voice agents without code. Beta features and limits may change. ## 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. Create a key in the console (it is shown once) and send it as a bearer token:
```
Authorization: Bearer pyai_live_... ```
Keys are environment-scoped: `pyai_live_...` (production) and `pyai_test_...` (sandbox). `POST /v1/sandbox/keys` creates an instant, short-lived test key without login or billing. Account signup also creates a sandbox key. Live keys consume prepaid credit; phone verification may unlock promotional credit under graduated-signup rules, but credit is not guaranteed at signup. Keys are self-validating signed tokens: they work on every PyAI surface the instant they are created, no activation or propagation delay. Treat them as opaque strings (up to 512 chars) and never parse their contents. Keep long-lived keys on trusted servers. For Omni browsers, mint an origin-locked short-lived token on your backend with POST /v1/omni/sessions; never expose a live or test API key in browser code. Offer the protocol marker and session token:
```
Sec-WebSocket-Protocol: pyai.v1, pyai-key. ```
(server-side clients may instead append `?api_key=...` to the URL). Your key is authenticated on the upgrade and never reaches the model. ## Quickstart, Hear (speech-to-text)
```
curl https://api.pyai.com/v1/audio/transcriptions \
-H "Authorization: Bearer $PYAI_API_KEY" \
-F file=@audio.wav -F model=pyai-hear
# -> { "text": "..." }
```
## Quickstart, Speak (text-to-speech)
```
curl https://api.pyai.com/v1/audio/speech \
-H "Authorization: Bearer $PYAI_API_KEY" \
-H "Content-Type: application/json" \
-d ''{"model":"pyai-speak","input":"Hello from PyAI.","voice":"voice_abc"}'' \
--output speech.wav
```
`voice` is a stock voice id from `GET /v1/voices` (the curated prebuilt catalog with personas and avatars) or a cloned voice id from `/v1/voice/clones`. Omit it to use the platform default voice (`stock_dorit_en_us`).'
contact:
name: PyAI
url: https://pyai.com
servers:
- url: https://api.pyai.com
description: Production
security:
- apiKey: []
- xApiKey: []
tags:
- name: Omni
description: 'The flagship: build an AI voice agent with one WebSocket (`GET /v1/omni`) and one `configure` frame, nothing to pre-create. This group also holds the optional browser-token mint and the post-call records.'
paths:
/omni-frames.json:
get:
tags:
- Omni
operationId: getOmniFrameContract
summary: Read the machine-readable Omni frame contract
description: Public AsyncAPI 3.0 JSON generated from the canonical Omni protocol source, including binary tags, control payloads and SDK integration notes. No key required.
security: []
responses:
'200':
description: Omni AsyncAPI document
content:
application/json:
schema:
type: object
required:
- asyncapi
- info
- channels
- components
additionalProperties: true
properties:
asyncapi:
type: string
const: 3.0.0
info:
type: object
channels:
type: object
components:
type: object
/v1/omni/calls:
get:
tags:
- Omni
summary: List Omni call records
description: Recent Omni realtime sessions for this org, newest first. Each record has one stable, opaque PyAI call identifier plus recording and summary availability. Use that same `call_id` for detail, recording, transcript, and summary reads. Requires the `omni:read` scope. Filter by `session_label` (the opaque tag you passed on the connect URL).
operationId: listOmniCalls
parameters:
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
- name: cursor
in: query
required: false
schema:
type: string
description: Pass the previous page's `next_cursor`.
- name: session_label
in: query
required: false
schema:
type: string
description: Only calls connected with this opaque session tag.
responses:
'200':
description: Paginated Omni call list
content:
application/json:
schema:
$ref: '#/components/schemas/OmniCallList'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/omni/calls/{call_id}:
get:
tags:
- Omni
summary: Get an Omni call record
description: 'Full record for one Omni session, addressed by the stable opaque PyAI `call_id` returned by the list: transcript (inline or via `transcript_url`), recording availability, and `summary` when generated. Recording bytes are retrieved from the dedicated recording sub-resource. Requires `omni:read`.'
operationId: getOmniCall
parameters:
- name: call_id
in: path
required: true
schema:
$ref: '#/components/schemas/OmniCallId'
responses:
'200':
description: Omni call detail
content:
application/json:
schema:
$ref: '#/components/schemas/OmniCall'
'404':
$ref: '#/components/responses/NotFound'
/v1/omni/calls/{call_id}/recording:
get:
tags:
- Omni
summary: Download an Omni call recording
description: 'Fetch the call''s audio recording, when one exists (recording is off by default). Requires `omni:read`.
By default the endpoint streams audio bytes from the tenant-scoped PyAI resource (`Content-Type` reflects the stored format, e.g. `audio/wav`). Pass `?response=url` to receive the canonical authenticated PyAI resource URL as JSON. Storage locations, raw recording URLs, and internal source identifiers are never returned.
`404` if there is no recording for the call.'
operationId: getOmniCallRecording
parameters:
- name: call_id
in: path
required: true
schema:
$ref: '#/components/schemas/OmniCallId'
- name: response
in: query
required: false
schema:
type: string
enum:
- url
description: Set to `url` to return the canonical authenticated PyAI recording resource as JSON.
responses:
'200':
description: The canonical PyAI resource as JSON (`?response=url`), or the audio bytes streamed inline.
content:
application/json:
schema:
$ref: '#/components/schemas/OmniCallRecording'
application/octet-stream:
schema:
type: string
format: binary
'404':
$ref: '#/components/responses/NotFound'
/v1/omni/calls/{call_id}/summary:
get:
tags:
- Omni
summary: Get an Omni call summary
description: The structured post-call summary, when one was generated. `404` if there is no summary for the call. Requires `omni:read`.
operationId: getOmniCallSummary
parameters:
- name: call_id
in: path
required: true
schema:
$ref: '#/components/schemas/OmniCallId'
responses:
'200':
description: Call summary
content:
application/json:
schema:
$ref: '#/components/schemas/OmniCallSummary'
'404':
$ref: '#/components/responses/NotFound'
/v1/omni/calls/{call_id}/transcript:
get:
tags:
- Omni
summary: Get an Omni call transcript
description: The full conversation transcript for the call. Resolves whether the transcript is stored inline or offloaded to an external URL, the response is always the transcript document itself. `404` if no transcript exists (e.g. the call failed before any speech, or the engine has not yet pushed the record). Requires `omni:read`.
operationId: getOmniCallTranscript
parameters:
- name: call_id
in: path
required: true
schema:
$ref: '#/components/schemas/OmniCallId'
responses:
'200':
description: Call transcript
content:
application/json:
schema:
$ref: '#/components/schemas/OmniCallTranscript'
'404':
$ref: '#/components/responses/NotFound'
/v1/omni/sessions:
post:
tags:
- Omni
summary: Mint an ephemeral Omni session token
description: '**Required for custom browser clients.** Trusted server-side apps, telephony, and backend agents connect to `wss /v1/omni` directly with their API key (see "Open an Omni voice-agent session"). Use this only when a browser or other untrusted client must open an Omni session without holding your secret key.
It mints a short-lived, origin-locked token the browser can use to open an Omni realtime session, the public/private split for realtime. Call this from your server with your secret key (which must hold `omni:session`); never ship the secret key to a page. The returned `token` carries only `omni:session`, is limited to one concurrent session, is locked to the `allowed_origins` you supply, and expires after `ttl_seconds` (default 60s, max 600s). Use it as the WebSocket subprotocol `pyai-key.`, offered after the `pyai.v1` marker, against the returned `url`. See the Omni browser guide for the full flow.
Only an active server API key for the exact authenticated project can mint. Browser session/publishable tokens cannot delegate or renew tokens. A positive per-key monthly spending cap returns HTTP 403 `key_budget_delegation_unsupported`: child tokens do not share the parent''s spend counter. Do not remove a spending cap to bypass this error; retain the bounded server-side workflow or establish an approved application-level budget. Token expiry limits admission, not the duration or spend of an established session. Token responses are not cacheable.'
operationId: createOmniSession
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- allowed_origins
properties:
allowed_origins:
type: array
items:
type: string
format: uri
minItems: 1
description: Browser origins (scheme://host[:port]) the token may connect from. Required and non-empty, a browser token must be origin-locked. `*` is not allowed.
example:
- https://acme.com
ttl_seconds:
type: integer
minimum: 1
maximum: 600
default: 60
description: Token lifetime in seconds. Keep it short; a leaked token is worth seconds, not minutes.
session_label:
type: string
description: Optional opaque tag echoed back to your `kb_endpoint` and recorded on the call.
responses:
'201':
description: Minted session token
content:
application/json:
schema:
$ref: '#/components/schemas/OmniSession'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
/v1/omni:
get:
tags:
- Omni
summary: Open an Omni voice-agent session (WebSocket)
description: '**This is the primary way to build an AI voice agent on PyAI.** Open this WebSocket, send one `configure` frame (voice, persona, knowledge endpoint, tools), then stream PCM16 audio both ways. There is nothing to create first: the session is authorized by your key''s org, and the whole agent travels in the `configure` frame.
Connect with `wss://api.pyai.com/v1/omni?format=pcm16&rate=24000` (`rate=16000` or `rate=8000` for telephony; use `rate=8000` for an 8 kHz G.711/Twilio leg so the only conversion is μ-law companding, no resampling, see the Telephony audio reference). Every binary frame starts with a one-byte kind: send audio as `0x01 || pcm16_bytes` and control JSON as `0x03 || utf8_json`. Server audio uses the same `0x01` prefix. Untagged PCM is not audio and is ignored.
Requires the `omni:session` scope (or the `omni:*` wildcard). The optional `session_label` is an opaque tag echoed to your own knowledge endpoint so you can branch per session; any value in your org''s namespace is accepted (PyAI stores no per-agent state).
**Auth (trusted servers):** send the key as the subprotocol, after the `pyai.v1` marker: `Sec-WebSocket-Protocol: pyai.v1, pyai-key.` (legacy server clients may use `?api_key=` instead). PyAI echoes only the marker, so your key is never reflected in the 101. **Browser apps:** never send a long-lived key to the browser. Your authenticated backend must mint a short-lived origin-locked token with `POST /v1/omni/sessions` first and use that token as the subprotocol.
See the Omni wire protocol reference for the frame catalog and close codes.
The configured acknowledgement reports voice_instruct_supported for the selected synthesis path. Current Omni routes support neutral delivery only and report false. Unsupported custom voice_instruct values return unsupported_voice_instruct before applying configure. Omit the field to retain the session value, or send an empty string to reset a saved custom instruction to neutral. A missing capability field on an older engine means unknown. A voice_capabilities event reports capability changes after synthesis fallback.
Function calling transports: hosted catalog tools (enable by name), server tools registered with `POST /v1/tools` and bound to the agent, or client-loop tools on this socket (`tool_call` / `tool_result`). An inline `endpoint` or `webhook_url` on `configure.tools[]` is rejected with `{event:"error", code:"unsupported_tool_transport"}` and the configure is not applied.'
operationId: openOmni
parameters:
- name: session_label
in: query
required: false
schema:
type: string
description: Optional opaque tag for this session, echoed to your own kb_endpoint so you can branch per session. The session is authorized by your key's org (PyAI stores no per-agent state); any value in your org's namespace is accepted. Must be safe as a header value (no control chars, ≤256 chars). Omit it entirely if you don't need per-session correlation.
- name: format
in: query
required: false
schema:
type: string
enum:
- pcm16
default: pcm16
description: Audio sample format for both directions.
- name: rate
in: query
required: false
schema:
type: integer
enum:
- 8000
- 16000
- 24000
default: 24000
description: Caller-input sample rate in Hz. Use `24000` for browser/WebRTC, `16000` for wideband input, or `8000` for telephony. Agent output is 24 kHz for both 24 kHz and 16 kHz input sessions; 8 kHz sessions receive 8 kHz output. Read `hello.audio_out`, which is authoritative.
- name: api_key
in: query
required: false
schema:
type: string
format: password
maxLength: 512
description: Intentional server-side WebSocket auth option. Prefer the `pyai.v1, pyai-key.<API_KEY>` subprotocol pair in browsers so the key is not placed in a URL.
responses:
'101':
description: Switching Protocols, the Omni WebSocket is open.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
components:
responses:
RateLimited:
description: 'Too many requests or too many concurrent realtime sessions; see Retry-After header (`code: rate_limit_exceeded | concurrency_limit_exceeded | daily_cap_exceeded`)'
headers:
Retry-After:
schema:
type: integer
description: Seconds to wait.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Forbidden:
description: 'Key lacks the required scope or the origin is not allow-listed (`code: forbidden | origin_not_allowed`)'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Invalid request (bad field, unsupported value)
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
NotFound:
description: 'Resource not found (`code: not_found`)'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
Unauthorized:
description: 'Missing or invalid API key (`code: unauthorized`)'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
ErrorCode:
type: string
description: Stable, machine-readable error code. Branch on this rather than the human `message`.
enum:
- invalid_request_error
- invalid_session_label
- unauthorized
- forbidden
- origin_not_allowed
- credit_exhausted
- key_budget_exceeded
- child_budget_exceeded
- insufficient_quota
- rate_limit_exceeded
- concurrency_limit_exceeded
- daily_cap_exceeded
OmniCallTranscript:
type: object
properties:
object:
type: string
example: omni.call.transcript
call_id:
$ref: '#/components/schemas/OmniCallId'
transcript:
type: object
required:
- turns
description: Canonical transcript document.
properties:
turns:
type: array
items:
type: object
required:
- role
- text
properties:
role:
type: string
enum:
- user
- assistant
text:
type: string
start_ms:
type: integer
minimum: 0
end_ms:
type: integer
minimum: 0
additionalProperties: false
additionalProperties: false
OmniCallListItem:
type: object
properties:
object:
type: string
example: omni.call
call_id:
$ref: '#/components/schemas/OmniCallId'
session_label:
type: string
nullable: true
description: The opaque tag passed on the connect URL, if any.
external_id:
type: string
nullable: true
description: Customer-supplied correlation id echoed from the call's `meta` (the engine carries `configure.meta` into the ingest). Use it to join a call to your own record; null when none was set.
status:
type: string
enum:
- completed
- failed
duration_s:
type: number
nullable: true
language:
type: string
enum:
- en
- fr
- es
- de
- hi
- zh
- it
- pt
- ja
- ko
x-staged-language-ids:
- ht
- zh-CN
- ar-MSA
- ar-Gulf
description: Language the session was served in. Call history also retains languages used in private qualification; record recognition does not enable those languages for public agent configuration. Older records render the default, `en`.
voice_tier:
type: string
enum:
- standard
- natural
description: Voice tier served for the session. English `en1` sessions report `natural` while that tier is active; Standard voices report `standard`. Both are included in the Omni base rate with no voice-tier add-on. Inspect the configured acknowledgement and call record rather than inferring the served tier from the requested alias.
has_recording:
type: boolean
has_summary:
type: boolean
started_at:
type: integer
nullable: true
description: Unix ms when the session started.
created_at:
type: integer
description: Unix ms when the record was written.
OmniSession:
type: object
properties:
object:
type: string
example: omni.session
token:
type: string
description: The ephemeral session token. Offer it as the WebSocket subprotocol `pyai-key.<token>` after the `pyai.v1` marker. Short-lived and origin-locked; safe to hand to the browser.
example: pyai_live_sess_a1B2…
expires_at:
type: integer
description: Token expiry, Unix epoch milliseconds.
url:
type: string
description: The Omni realtime WebSocket URL to connect to.
example: wss://api.pyai.com/v1/omni?format=pcm16&rate=24000
session_label:
type: string
description: Echoed back when supplied on the request.
nullable: true
OmniCallSummary:
type: object
properties:
object:
type: string
example: omni.call.summary
call_id:
$ref: '#/components/schemas/OmniCallId'
summary:
type: object
description: The structured post-call summary document.
Problem:
type: object
description: RFC 7807 problem+json returned by the control plane (request-validation and resource errors such as 400/404/409). The stable code is the last path segment of `type`.
required:
- title
- status
properties:
type:
type: string
description: Problem type URI; ends with the stable code.
title:
type: string
status:
type: integer
detail:
type: string
request_id:
type: string
OmniCall:
allOf:
- $ref: '#/components/schemas/OmniCallListItem'
- type: object
properties:
transcript:
type: object
nullable: true
description: Inline transcript document; omitted in favor of transcript_url when offloaded.
transcript_url:
type: string
description: Signed URL to the transcript when it was offloaded instead of inlined.
summary:
type: object
description: Structured post-call summary, when generated.
recording_result:
type: object
required:
- status
properties:
status:
type: string
enum:
- success
- intentionally_disabled
- failed
reason:
type: string
enum:
- recording_not_requested
- recording_not_finalized
additionalProperties: false
description: Provider-neutral recording outcome, present only after durable media or an explicit terminal receipt. Omitted while upload is pending or the recording outcome is unknown. Internal source and storage details are never returned.
error:
type: string
enum:
- call_failed
description: Normalized failure reason, present when status is failed.
Error:
type: object
description: OpenAI-compatible error envelope returned by the gateway data plane (401/402/403/429). Control-plane request/resource errors use Problem (application/problem+json) instead.
required:
- error
properties:
error:
type: object
required:
- message
properties:
message:
type: string
description: Human-readable explanation.
type:
type: string
description: Error category, e.g. rate_limit_error.
code:
$ref: '#/components/schemas/ErrorCode'
param:
type: string
nullable: true
description: Offending parameter when applicable, else null.
OmniCallId:
type: string
pattern: ^ocl_[A-Za-z0-9]{20}$
example: ocl_7Hk2Qm9Zs4Wp8Lc3Nv6R
description: Stable opaque PyAI-owned call identifier. Use it unchanged across every Omni call sub-resource.
OmniCallList:
type: object
properties:
object:
type: string
example: list
data:
type: array
items:
$ref: '#/components/schemas/OmniCallListItem'
has_more:
type: boolean
next_cursor:
type: string
nullable: true
OmniCallRecording:
type: object
properties:
object:
type: string
example: omni.call.recording
call_id:
$ref: '#/components/schemas/OmniCallId'
url:
type: string
format: uri
description: Canonical authenticated PyAI endpoint for the recording audio.
securitySchemes:
interpretationUpload:
type: http
scheme: bearer
description: Short-lived write-only upload_capability returned by POST /v1/audio/interpretations/recordings. Never use it for reads.
sessionCookie:
type: apiKey
in: cookie
name: pyai_session
description: Console session cookie. PyAI-admin routes also require the configured platform-admin email allowlist.
apiKey:
type: http
scheme: bearer
description: 'Use `Authorization: Bearer pyai_live_...` (or `pyai_test_...`).'
xApiKey:
type: apiKey
in: header
name: x-api-key
description: Header alias for bearer auth on HTTP endpoints. WebSocket auth uses the subprotocol pair `pyai.v1, pyai-key.<API_KEY>`.
x-pyai-agent-notes:
guide: https://pyai.com/agents/speech-calling.md
omni_frames: https://api.pyai.com/omni-frames.json
discovery: Inspect live operation schemas; preserve IDs and required Idempotency-Key headers. SDK-first for realtime. Never infer a simulated PSTN call endpoint.