Install

Add the SDK with npm, or load the widget from the CDN with no build step.

Browser or server No key needed to install dev · https://api.dev.oprag.ai

npm

Shell
npm install @oprag/sdk

ESM-only, Node 18 or newer. Runtime and types are both bundled — there are no peer dependencies to install alongside it.

The two entries

TypeScript
import { mountWidget } from "@oprag/sdk/widget"; // browser only
import { createClient, citationDisplayLabel } from "@oprag/sdk"; // browser or server

Keeping the widget behind its own entry is what lets a backend import @oprag/sdk without pulling DOM code into its bundle.

CDN

For a site with no bundler, the hosted script mounts the same widget implementation:

HTML
<script
  src="https://cdn.oprag.ai/widget.js"
  data-project="YOUR_PROJECT_ID"
  data-embed-key="embed_live_..."
  data-api-url="https://api.dev.oprag.ai"
></script>

Choose npm when you need TypeScript, tree-shaking, programmatic open() and sendMessage(), or a chat UI of your own.

Ready to ship?

Get started free