PyAI Interpretation API
Live speech translation between two human call participants.
Operations 10
POST
/auth/interpretation-recordings/{recording_id}/complete
Save transcripts and finalize a call archive
#
Live speech translation between two human call participants.
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-interpretation-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 Interpretation 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: Interpretation
description: Live speech translation between two human call participants.
paths:
/v1/audio/interpretations/stream:
get:
tags:
- Interpretation
operationId: connectInterpretation
summary: Open a two-person live interpretation session
description: 'Connect over WebSocket with a live key holding `interpret:session`. Server clients use Bearer authentication; browsers use an origin-locked token from the session mint and offer `pyai.v1`, then `pyai-key.` as subprotocols. Credentials are never accepted in the URL.
After `hello`, send `session.start` with `external_call_id`, `sample_rate:16000`, and `legs.customer` and `legs.agent`, each containing `participant_id`, `language` and `voice`. Choose any two different supported languages; read `hello.languages` for each language code and accepted/default voices, and `hello.synthetic_audio_tested_pairs` for the narrow completed synthetic audio checks. Equal languages are rejected before recognition opens. Audio is mono PCM16 little endian, base64 encoded in JSON `audio.append` with `leg`, current `epoch`, zero-based increasing `sequence` and `audio`. Each frame is at most 200ms.
Available languages: Arabic (ar), Bengali (bn), English (en), French (fr), German (de), Gujarati (gu), Hindi (hi), Italian (it), Japanese (ja), Kannada (kn), Korean (ko), Mandarin Chinese (zh), Portuguese (pt), Punjabi (pa), Russian (ru), Spanish (es), Telugu (te), Urdu (ur). Hindi/English and Punjabi/English have completed synthetic audio checks; other pairs are available to try and have not yet completed those checks. Availability does not establish human translation quality, accent coverage or ten-call capacity.
Stable translated phrases produce `translation.committed`, `audio.chunk` and `audio.completed` before the speaker finishes. Source `transcript.committed` fragments have independent character offsets; `source_context_id` attributes both ledgers to a stream context without implying word alignment. `input.commit` optionally ends the current source context; it is not required to start translated speech.
Provide separate dry participant input legs. The listener input is gated during translated playback. Report actual playback with `playback.report` (`utterance_id`, `target_epoch`, `status`, `played_samples`); cancellation does not prove playback stopped. When `hello.playback_statuses` advertises `playing`, report only carrier-confirmed advancing prefixes with `status: playing`. Prefix progress keeps the listener gate closed and never completes an utterance or resets its 45-second hard deadline. Respect `input.gated` and `input.resumed`, and physically clear playback before a required `playback.cleared` acknowledgement after a transfer. `leg.replace` preserves epoch/revision fencing. Close with `session.end`.
Billing is connected session time for both directions together, including silence, under `interpret.minutes`. Rejected upgrades are not billed. The stream itself does not persist call history. Explicitly create a call archive using POST /v1/audio/interpretations/recordings and upload the bridge transcript/audio to retrieve it through /v1/audio/interpretations/calls. It does not integrate a PBX automatically.'
responses:
'101':
description: Authenticated interpretation WebSocket; only pyai.v1 is echoed.
'401':
$ref: '#/components/responses/Unauthorized'
'402':
description: Insufficient available credit.
'403':
$ref: '#/components/responses/Forbidden'
'429':
description: Rate or concurrent session limit reached.
/v1/audio/interpretations/sessions:
post:
tags:
- Interpretation
operationId: createInterpretationSession
summary: Mint a browser interpretation token
description: Call from your server with a live secret key holding interpret:session. The token carries only that scope, one concurrent session and the exact allowed origins, with a default lifetime of 60 seconds (maximum 600). Credit and concurrency checks still apply at connect. A browser token cannot mint another token. A parent key with a monthly spending limit cannot delegate browser sessions; its limit continues to apply to direct server connections.
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- allowed_origins
properties:
allowed_origins:
type: array
minItems: 1
maxItems: 20
items:
type: string
format: uri
ttl_seconds:
type: integer
minimum: 1
maximum: 600
default: 60
responses:
'201':
description: Origin-locked browser capability
content:
application/json:
schema:
type: object
required:
- object
- token
- url
- expires_at
- project_id
- billing
properties:
object:
type: string
enum:
- interpretation.session
token:
type: string
url:
type: string
const: wss://api.pyai.com/v1/audio/interpretations/stream
expires_at:
type: integer
description: Unix milliseconds.
project_id:
type: string
billing:
type: string
enum:
- credits
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
/v1/audio/interpretations/recordings:
post:
tags:
- Interpretation
operationId: createInterpretationRecording
summary: Create a customer call archive
description: Requires a live server key with interpret:write. Explicitly opt in before capture. No carrier credentials or provider choice is accepted. The returned write-only capability uploads audio and transcript/events for this record; it cannot read history. Upload within 20 minutes. Each archive is bounded to 10 minutes, 2,000 events and 38,400,044 bytes per stereo WAV; at most 50 archives/project/day. POST is not automatically retried and does not open a speech session or create carrier calls. capture_format none stores transcript/events without audio. Retain id alongside your application's call ID. Client-supplied artifacts are distinct from authoritative speech usage and carrier playback receipts.
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- languages
properties:
languages:
type: array
minItems: 2
maxItems: 2
items:
type: string
external_call_id:
type: string
minLength: 1
maxLength: 200
capture_format:
type: string
enum:
- party-v1
- none
default: party-v1
responses:
'201':
description: Created archive and short-lived write capability
content:
application/json:
schema:
type: object
required:
- object
- id
- upload_capability
- upload_until
- upload_url
- complete_url
- call_url
- limits
properties:
object:
type: string
const: interpretation.recording
id:
type: string
upload_capability:
type: string
upload_until:
type: integer
description: Unix milliseconds
capture_format:
type: string
enum:
- party-v1
- none
upload_url:
type: string
format: uri
complete_url:
type: string
format: uri
call_url:
type: string
format: uri
limits:
type: object
properties:
duration_ms:
type: integer
events:
type: integer
audio_bytes_per_perspective:
type: integer
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
description: Project archive allowance exhausted
/auth/interpretation-recordings/{recording_id}/audio:
post:
tags:
- Interpretation
operationId: uploadInterpretationRecordingAudio
summary: Upload one party recording
security:
- interpretationUpload: []
description: 'Use only the write-only upload_capability returned by archive creation, not your API key. Upload an immutable stereo 16 kHz PCM16 WAV: left original speech, right translated speech sent to this party. party-v1 requires both perspectives before complete. Maximum 38,400,044 bytes per file. Retry identical bytes on 429 with Retry-After; changed bytes conflict. The capability is record-bound, expires in 20 minutes and cannot read recordings.'
parameters:
- in: path
name: recording_id
required: true
schema:
type: string
- in: query
name: perspective
required: true
schema:
type: string
enum:
- customer
- agent
requestBody:
required: true
content:
audio/wav:
schema:
type: string
format: binary
responses:
'200':
description: Immutable audio received
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'413':
description: Audio exceeds the archive limit
'429':
description: Upload admission busy; retry identical bytes
/auth/interpretation-recordings/{recording_id}/complete:
post:
tags:
- Interpretation
operationId: completeInterpretationRecording
summary: Save transcripts and finalize a call archive
security:
- interpretationUpload: []
description: Use the archive's write-only upload_capability. First save events with audio_pending:true before uploading audio. Then omit audio_pending to finalize after both party files exist; transcript-only archives need no audio. Mark audio_failed:true after a failed capture so it cannot appear complete. Existing ready artifacts remain immutable. This does not close or bill the translation session.
parameters:
- in: path
name: recording_id
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- duration_ms
- events
properties:
duration_ms:
type: integer
minimum: 1
maximum: 600000
room_id:
type: string
maxLength: 200
events:
type: array
maxItems: 2000
items:
type: object
additionalProperties: true
audio_pending:
type: boolean
const: true
audio_failed:
type: boolean
const: true
responses:
'200':
description: Archive checkpoint or final status
content:
application/json:
schema:
type: object
properties:
id:
type: string
status:
type: string
enum:
- recording
- ready
- incomplete
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
/v1/audio/interpretations/calls:
get:
tags:
- Interpretation
operationId: listInterpretationCalls
summary: List saved Translation calls
description: Requires interpret:read on a live server key. Results are confined to the key's project, newest first, 50/page. Call archives are opt-in; opening the live stream alone does not create a saved record. Uploading/expired/incomplete records remain visible with truthful status. No browser session token or Console login is accepted.
parameters:
- in: query
name: cursor
schema:
type: string
description: Opaque next_cursor from the previous page
responses:
'200':
description: Project call page
content:
application/json:
schema:
type: object
properties:
object:
type: string
const: list
data:
type: array
items:
$ref: '#/components/schemas/InterpretationCall'
limit:
type: integer
const: 50
has_more:
type: boolean
next_cursor:
type:
- string
- 'null'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
/v1/audio/interpretations/calls/{call_id}:
get:
tags:
- Interpretation
operationId: getInterpretationCall
summary: Read a saved Translation call
description: Requires interpret:read; only the key's project is searched.
parameters:
- in: path
name: call_id
required: true
schema:
type: string
responses:
'200':
description: Saved call, artifact availability and combined captions
content:
application/json:
schema:
$ref: '#/components/schemas/InterpretationCall'
'404':
$ref: '#/components/responses/NotFound'
/v1/audio/interpretations/calls/{call_id}/transcript:
get:
tags:
- Interpretation
operationId: getInterpretationTranscript
summary: Read original and translated transcripts
description: Requires interpret:read. captions contains the display ledger with raw_text retained. events preserves uploaded source/translation offsets, participant IDs, source contexts and epochs; a context association is not word alignment.
parameters:
- in: path
name: call_id
required: true
schema:
type: string
responses:
'200':
description: Original/translated captions and transcript events
content:
application/json:
schema:
type: object
properties:
object:
type: string
const: interpretation.transcript
call_id:
type: string
captions:
type: array
items:
type: object
additionalProperties: true
events:
type: array
items:
type: object
additionalProperties: true
'404':
$ref: '#/components/responses/NotFound'
/v1/audio/interpretations/calls/{call_id}/events:
get:
tags:
- Interpretation
operationId: getInterpretationEvents
summary: Read Translation call and transfer events
description: Requires interpret:read. Uploaded append-order events include transcript, translation, playback, cancellation and replacement-agent transfer evidence. These are client-supplied artifacts, not an authoritative billing ledger.
parameters:
- in: path
name: call_id
required: true
schema:
type: string
responses:
'200':
description: Bounded call-event ledger
content:
application/json:
schema:
type: object
properties:
object:
type: string
const: list
call_id:
type: string
data:
type: array
items:
type: object
additionalProperties: true
'404':
$ref: '#/components/responses/NotFound'
/v1/audio/interpretations/calls/{call_id}/recording:
get:
tags:
- Interpretation
operationId: getInterpretationRecording
summary: Play or download a Translation recording
description: Requires interpret:read. Pass perspective=customer or agent for party-v1 archives. Each stereo WAV has original speech in the left channel and translated speech sent to that party in the right; sending audio does not prove it was heard. Range requests support seeking. Proxy this response through your authenticated backend for browser playback; do not place a secret API key in a URL. Both party files must be complete before publication. Audio remains unavailable for transcript-only/incomplete records.
parameters:
- in: path
name: call_id
required: true
schema:
type: string
- in: query
name: perspective
schema:
type: string
enum:
- customer
- agent
- in: query
name: download
schema:
type: string
enum:
- '1'
- in: header
name: Range
schema:
type: string
responses:
'200':
description: Private audio
content:
audio/wav:
schema:
type: string
format: binary
audio/webm:
schema:
type: string
format: binary
'206':
description: Audio byte range
'404':
$ref: '#/components/responses/NotFound'
'409':
description: Audio is not ready or was not recorded
'416':
description: Invalid byte range
components:
responses:
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
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
InterpretationCall:
type: object
required:
- object
- id
- status
- languages
- created_at
- captions
- capture
properties:
object:
type: string
const: interpretation.call
id:
type: string
external_call_id:
type: string
room_id:
type: string
provider:
type: string
languages:
type: array
items:
type: string
status:
type: string
enum:
- recording
- ready
- incomplete
created_at:
type: integer
description: Unix milliseconds
ended_at:
type: integer
duration_ms:
type: integer
capture_format:
type: string
enum:
- party-v1
- none
audio:
type:
- object
- 'null'
additionalProperties: true
perspectives:
type: object
additionalProperties:
type: object
additionalProperties: true
captions:
type: array
items:
type: object
additionalProperties: true
capture:
type: string
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.
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.