Client
The typed client: chat, leads, and escalation, with no UI attached.
createClient returns the same calls the widget makes internally. Use it when you are building your own chat UI, or calling oprag from a server.
import { createClient } from "@oprag/sdk";
const oprag = createClient({
apiUrl: "https://api.dev.oprag.ai",
apiKey: import.meta.env.PUBLIC_OPRAG_EMBED_KEY, // embed key in the browser
}); | Namespace | Method | Covered on |
|---|---|---|
chat | ask, stream | Chat |
leads | create | Leads |
conversations | escalate | Conversations |
What it throws
Every method rejects with OpragError when the API refuses the request. Network failures and aborts propagate unchanged, so an AbortError stays distinguishable from a 429. See errors.
Ready to ship?
Get started free