- Lightweight ~100-150kb gzipped bundle
- Responsive design (desktop popup, mobile fullscreen)
- Two display modes: floating launcher or inline embed
- Session persistence across page reloads
Deployment Options
Cloud Deployment (Recommended)
For Onyx Cloud users, the widget is served from Onyx’s CDN. Add the following to your website:Self-Hosted Deployment
For self-hosted Onyx instances, build and host the widget yourself. The widget lives in thewidget/ directory of the Onyx repository and uses the repository’s Bun
workspace.
1
Install dependencies
Clone the Onyx repository and run this once at the repository root:
2
Obtain a widget API key
In the Onyx admin panel, open Settings > Service Accounts (
/admin/service-accounts)
and create a service account for the widget. Copy its API key.
3
Configure environment (optional)
For builds with baked-in configuration, create a
.env file in widget/ and set your backend URL and API key:4
Build the widget
Run the build from For self-hosted deployment (config baked into bundle):
widget/.For cloud-style deployment (config via HTML attributes):5
Deploy the bundle
Upload
dist/onyx-widget.js to your CDN or web server.Customer Embed Code
After deployment, provide customers with the embed code: Cloud-style (attributes required):Configuration Reference
Required Attributes
HTML attributes take priority over values baked into a self-hosted build.
backend-url
- Onyx Cloud: Use
https://cloud.onyx.app/api - Self-hosted: Use your Onyx instance URL (e.g.,
https://onyx.yourcompany.com/api)
Optional Attributes
include-citations
include-citations is a boolean flag. Its presence turns citations on,
so include-citations="false" also turns them on. Omit the attribute to turn citations off.
Authentication
The widget runs in the browser, so the visitor can read any credential in the page. Pick one of two modes.API key
All visitors share one service account. Use a limited-scope API key (see below). This mode works on Onyx Cloud and on self-hosted Onyx.JWT passthrough (self-hosted only)
The host page supplies the visitor’s own identity-provider (IdP) token. Each visitor acts as their own Onyx user, with their own document permissions and usage attribution. No shared secret goes in the page. Use this when the host page already signs the visitor in with the same IdP as Onyx. JWT passthrough works on self-hosted Onyx only. It does not work on Onyx Cloud.1
Configure Onyx to trust the IdP
Set these environment variables on the API server:Onyx accepts RS256 tokens only. Set
JWT_EXPECTED_AUDIENCE;
without it Onyx accepts any token the IdP signed for any application.
Onyx creates an Onyx user on the first request from a new email,
so limit sign-ups with the invite list or VALID_EMAIL_DOMAINS.2
Set tokenProvider on the widget
tokenProvider is a JavaScript property, not an HTML attribute. Drop the api-key attribute.tokenProvider before every request. Return a string, or a promise that resolves to one.
Return a token that is valid now; your function owns expiry. When both are set,
tokenProvider takes precedence over api-key.API Key Security
Browser Support
- Chrome/Edge 90+ (Chromium)
- Firefox 90+
- Safari 15+
- Mobile Safari (iOS 15+)
- Mobile Chrome (Android)