Skip to main content

Constructor

Two overloads:
Pass a DOM element as the first argument to render the avatar into it on init(). Omit it and the avatar isn’t rendered until you call attachDOMNode().
HTMLElement
Optional first positional argument. When passed, the avatar renders into this element on init(). Without it, call attachDOMNode() before rendering becomes visible.

Config

string
required
Per-session token from POST /api/v1/sessions. Must be minted on your backend.
boolean
default:"false"
Requests microphone access and routes the user’s voice into the conversation engine. Required for voice-to-voice flows (OpenAI Realtime, Cartesia).
boolean
default:"!audioSource"
Starts the session with the microphone muted. Defaults to the opposite of audioSource — voice-to-voice sessions start unmuted, text-echo sessions start muted.
boolean
default:"true"
Joins the avatar room as soon as init() resolves. Set to false if you need a manual gap between init and join — then call join() yourself.
boolean
default:"false"
Fetches the SDK runtime bundle eagerly. Reduces first-interaction latency at the cost of an extra network request on page load.
boolean
default:"false"
Opens the stream connection before init() completes. Trades a small amount of bandwidth for faster time-to-first-frame.
boolean
default:"false"
Keeps the local SDK state alive during user inactivity. With the default (false), the SDK tears down its local Daily call object after 5 minutes idle and emits the idle event. The backend session terminates separately via user_absent_timeout.
string
default:"https://api.avaturn.live"
Override the API host. Rarely needed — when set, expose both ${apiHost}/api/v1 and ${apiHost}/_sdk/v0 (see Under the hood).