Skip to main content
The voice widget host API v1 lets a website button control the same session as the embedded widget. Install the generated Web Widget snippet and initialize it once before adding host controls.
Feature-detect every method. Older deployed embeds may not include this API; the reviewed source does not verify which embed version your website serves.

Methods

Use window.VoiceWidget only after confirming the required methods exist. For example, attach these handlers to your own Start and End buttons after installing the generated embed:
Define the buttons and fallback message in your website. Do not await a network operation before calling start() from the activation handler, and do not queue automatic starts on page load. An ending state can persist while a pending browser microphone permission request resolves; script cannot dismiss that permission UI.

Events

Transcript updates may be partial. GPT Live deltas use a stable local identity and final: false; do not infer a final event where the provider does not supply one. Render visitor/agent text as text, not executable HTML. The state contract does not distinguish listening, thinking, and speaking. Present active honestly. Error codes include not_ready, unavailable, gesture_required, microphone_denied, microphone_unavailable, connection_failed, and configuration_failed. Use the API’s events for your host display and remove listeners when the host surface is destroyed. Keep a usable fallback when the API or voice runtime is unavailable. Do not create a second voice runtime or call widget session HTTP endpoints directly; the existing widget owns consent, microphone cleanup, session finalization, and credit accounting.