The widget is fully self-contained. The script loads everything it needs
(React, ReactDOM, and the LiveKit browser client) from the CDN at runtime,
so it works on a plain HTML page with no build step and no dependencies of
your own.
Quick start
Paste this before the closing</body> tag of any page, replacing the agent UID and public key with your own:
Complete working page
Full HTML example
Full HTML example
Attributes
assistant-id and public-api-key are marked required because you should
always set them, not because the widget errors without them — it silently
falls back to demo values instead.Display types
- floating
- fixed
The default. The widget renders as a compact launcher that stays
collapsed until the visitor clicks it, then expands into the call panel.
Best for adding a call option to an existing page without changing the
layout.
Using it in React
The widget is a plain custom element, so it works in React — but it needs one extra step that plain HTML does not.window.OpenMicWidget.init() re-scans the whole page. If you render
several widgets, mount them together rather than one at a time, or an
already-initialized widget can be rendered twice.TypeScript
openmic-widget is not a known JSX element, so declare it once:
Load the widget from the CDN script above in every environment, React
included. It ships as a browser bundle rather than an ES module, so there is
no component to import and no package to add to your dependencies.
Requirements and limitations
Testing on localhost
Testing on localhost
The widget does not work when served from
localhost or
127.0.0.1. On those hostnames it tries to load its stylesheet from a
relative path that does not exist in your project. The stylesheet fails,
initialization aborts before the widget renders, and the console shows
Failed to initialize.To test locally, serve the page on a hostname that is not localhost —
your machine’s LAN IP (http://192.168.1.x:3000) works, as does any
tunnelling tool that gives you a public hostname. Deployed sites are
unaffected.Browser and permissions
Browser and permissions
Requires a modern browser (Chrome 60+, Firefox 55+, Safari 12+, Edge
79+) with WebRTC and microphone support. Browsers only grant microphone
access on secure origins, so the page must be served over HTTPS in
production. The visitor sees a permission prompt on the first call.
What the script loads
What the script loads
If they are not already present on the page, the widget loads React 18,
ReactDOM 18, and
livekit-client from unpkg.com, plus its own
stylesheet. If your site sets a Content Security Policy, allow
unpkg.com for script-src and style-src, and the OpenMic API and
LiveKit hosts for connect-src.Pages that already run React are fine — the widget reuses the React
already on the page and otherwise loads its own copy.Pinning a version
Pinning a version
The snippets above use
@latest, which always serves the newest
release. For production you may prefer to pin an exact version so a new
release cannot change behaviour without you: