Example · Plain HTML / JavaScript

<!doctype html>
<html lang="id">
<head>
  <meta charset="utf-8" />
  <title>Demo Vonip</title>
</head>
<body>
  <button id="voice">🎙 AI Voice</button>
  <audio id="out" controls></audio>

  <script src="https://sdk.vonip.ai/v1/vonip.js"></script>
  <script>
    Vonip.init({ apiKey: "pk_test_xxx" });

    document.getElementById("voice").onclick = () => {
      Vonip.open({ mode: "voice" });
    };

    Vonip.on("generated", (d) => {
      document.getElementById("out").src = d.audioUrl;
    });

    Vonip.on("error", (e) => {
      alert(e.message); // pesan sudah ramah-user
    });
  </script>
</body>
</html>