Web SDK

@glytos/web puts a live voice conversation in your page. It handles the microphone, the WebRTC connection and the transcript stream.

npm install @glytos/web

The two-step flow

The SDK never sees your API key. Your server mints a short-lived web-call token; the page uses it.

On your server, mint a token naming the agent, and return it to your page:

import { Glytos } from '@glytos/node';

const glytos = new Glytos({ apiKey: process.env.GLYTOS_API_KEY! });
const { token } = await glytos.calls.webToken({ workflow_uuid: agentUuid });

In the page, start the call with it:

import { GlytosWebCall } from '@glytos/web';

const call = new GlytosWebCall({
  token,
  onTranscript: message => console.log(message.role, message.content),
  onStatus: status => console.log(status),
});

await call.start();

Mint the token on your server. Putting an API key in the page hands anyone who views source the ability to spend your credit.

Ending a call

await call.stop();

Requirements

The page must be served over HTTPS - browsers only grant microphone access on a secure origin - and the user must grant microphone permission when prompted.

Web SDK · Glytos Docs