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:
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.
