Skip to main content
The SDK handles microphone capture, audio playback, transcripts, and client-side tools. It talks to /calls/create (saved agent) or /calls/inline (config in the request) and connects you to the returned WebSocket.

Basic use

Where the API key goes

OmniaSession sends your API key directly to the Omnia API with X-API-Key. Constructed in a browser with a production key, that key is visible to anyone who opens devtools.For anything public-facing, run the SDK behind your own server: point baseUrl at an endpoint you control that injects the key and forwards to api.omnia-voice.com. The SDK ships a minimal proxy under proxy/ as a starting point.Using it directly in the browser is reasonable for internal tools, prototypes, and demos — just not with a key that can spend real credits.
string
required
Your API key.
string
default:"https://api.omnia-voice.com"
Point this at your own proxy to keep the key server-side.
boolean
default:"true"
Stream the user’s own speech as they talk, arriving with isFinal: false.
AudioContext
Supply your own, if you already manage one.

Joining a call

joinCall resolves to { callId } and accepts either shape:
Inline needs no saved agent — useful when the persona is generated per user. See Inline calls.

Controlling the call

method
Inject text as though the user had spoken it. Pass deferResponse: true to add context without prompting an immediate reply — useful for feeding in facts mid-call.
method
Send a structured message. Must include a type, and the encoded payload must stay under 1024 bytes.

Client tools

Register a handler and the agent can call it during the conversation:
The SDK matches invocations to results for you — no invocation IDs to track. See Client tools.

Events

React

Requirements

Microphone access needs a secure context — HTTPS or localhost. It will not work on a plain-HTTP staging domain.

Troubleshooting

Once denied, the browser will not ask again — the user must clear it in site settings. Ask for permission on a click; requesting it on page load is denied far more often, because the user has no idea what it is for yet.
Confirm the agent is ACTIVE and the workspace has credits — an out-of-credit workspace fails at call creation with 402. WebSocket URLs are short-lived and single-use, so never cache one.
Usually the tool description, not the wiring — the model decides from that text alone. Also check the name passed to registerTool matches the tool’s modelToolName exactly.
Browsers block autoplaying audio until the user interacts with the page. Start the call from a real click.

Inline calls

Configure an agent per call, with no saved record.

Raw WebSocket

Skip the SDK and speak the protocol.