Zum Inhalt springen

Voice Embed

Diese Seite ist noch nicht auf Deutsch verfügbar. Sie sehen die englische Fassung.

“Our agent in your app”: a small browser SDK plus a server call that lets your backend start a voice, voice+text, or text-only session with one of your web agents, without the browser ever holding a secret key.

The console’s own widget today uses a console-hosted session endpoint authenticated with a publishable key. Voice Embed will move that onto a versioned, documented Service API endpoint and add a server-minted, short-lived client secret for apps that have their own backend — so a page embedding the widget never needs a long-lived credential in client-side code.

  1. Your backend, holding your project’s secret API key, requests a short-lived client secret for one specific web agent and mode.
  2. Your backend hands that client secret to the browser (however your app already gets data to its frontend).
  3. The browser calls NaironVoice.connect({ clientSecret }), which exchanges the secret — over a request that carries the page’s real browser Origin — for a session, and starts emitting connection/state/transcript events.

Two request shapes are being reconciled into this one flow: the Service API’s /v1/web-sessions (server-side, secret-key, returns a session token directly — the shape a backend-only integration can already use today) and a browser-facing client-secret exchange for pages that want the browser to connect directly. Both will keep working; the exchange step above is additive on top of what’s already documented.

  • Add the web widget to your site with one script tag and a publishable key.
  • Build your own client with an API web agent: its page shows the session request, made with a publishable key from an allowed origin.
  • Start sessions from your backend with a secret key through the Service API’s /v1/web-sessions.

Voice Embed is the planned, installable SDK packaging of the same capability.

// draft — not published, names and shapes may change
import { connect } from "@nairon/voice-embed";
const session = await connect({
clientSecret: "nrn_ws_...",
mode: "WEB_FULL", // or "WEB_TEXT"
});
session.on("connected", () => {});
session.on("agent_state", (state) => {}); // connecting | listening | thinking | speaking
session.on("transcript", (turn) => {});
session.on("error", (err) => {});
session.sendText("Hello");
session.mute(true);
session.end();

No @nairon/voice-embed package exists on npm yet, no Voice Embed endpoint answers requests today, and this preview implies no pricing change.

  • The exact embed mechanic (inline script vs. iframe vs. this SDK) and how far its styling can be customized.
  • Whether a session-ended webhook ships in the first version or a later one.
  • How a session is scoped to a specific project/flow beyond the web agent it targets.

The SDK described here is not live; this page will be replaced with the real reference once it ships.