Skip to main content
POST
Mint an ephemeral Omni session token

Authorizations

Authorization
string
header
required

Use Authorization: Bearer pyai_live_... (or pyai_test_...).

Body

application/json
allowed_origins
string<uri>[]
required

Browser origins (scheme://host[:port]) the token may connect from. Required and non-empty, a browser token must be origin-locked. * is not allowed.

Minimum array length: 1
Example:
ttl_seconds
integer
default:60

Token lifetime in seconds. Keep it short; a leaked token is worth seconds, not minutes.

Required range: 1 <= x <= 600
session_label
string

Optional opaque tag echoed back to your kb_endpoint and recorded on the call.

Response

Minted session token

object
string
Example:

"omni.session"

token
string

The ephemeral session token. Use as the WebSocket subprotocol pyai-key.<token>. Short-lived and origin-locked; safe to hand to the browser.

Example:

"pyai_live_sess_a1B2…"

expires_at
integer

Token expiry, Unix epoch milliseconds.

url
string

The Omni realtime WebSocket URL to connect to.

Example:

"wss://api.pyai.com/v1/omni?format=pcm16&rate=24000"

session_label
string | null

Echoed back when supplied on the request.