Mint an ephemeral Omni session token
Most integrations do not need this endpoint. 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 ONE 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.<token>, offered after the pyai.v1 marker, against the returned url. See the Omni browser guide for the full flow.
Request
- Base URL: https://api.pyai.com
- URL: https://api.pyai.com/v1/omni/sessions
- Auth: one of:
- HTTP bearer
- API key in header x-api-key
Request body
Example request
{
"allowed_origins": [
"https://acme.com"
]
}Response
Minted session token
Example response
{
"object": "omni.session",
"token": "pyai_live_sess_a1B2…",
"url": "wss://api.pyai.com/v1/omni?format=pcm16&rate=24000"
}Changes
No recorded changes to this operation across all 1 revision of this API.