← Examples

Button Layout TS Source

A single button — click to talk, click again to disconnect. No panel, no transcript.

Code

import { init } from '@deepgram/agent-widget';

init({
  tokenFactory: () => fetch('/api/token').then(r => r.json()).then(d => d.token),
  agent: {
    listen: { provider: { type: 'deepgram', version: 'v1', model: 'nova-3' } },
    think:  { provider: { type: 'open_ai', model: 'gpt-4o-mini' } },
    speak:  { provider: { type: 'deepgram', model: 'aura-2-thalia-en' } },
  },
  layout: 'button',
  containerId: 'agent-btn',
});

Click the button above to start a voice conversation