Client

The typed client: chat, leads, and escalation, with no UI attached.

Browser or server Embed key in the browser, integration key on the server dev · https://api.dev.oprag.ai

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.

TypeScript
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
});
NamespaceMethodCovered on
chatask, streamChat
leadscreateLeads
conversationsescalateConversations

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