npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@krutai/ai-live-conversation

v0.1.0

Published

AI Live Conversation - Real-time voice conversation with Gemini Live

Readme

@krutai/ai-live-conversation

AI Live Conversation is a premium React library for building real-time voice experiences with Gemini Live, powered by KrutAI. It provides a seamless, secure, and highly customizable way to integrate low-latency AI conversations into your web applications.

Key Features

  • 🎙️ Real-time Voice: Low-latency, full-duplex audio conversation.
  • 🔐 Secure by Design: Support for server-side token/URL generation to keep your API keys safe.
  • Premium UI: Beautiful, modern built-in UI with glassmorphism and smooth animations.
  • 🛠️ Extremely Customizable: Completely override any part of the UI while keeping the underlying logic.
  • 📝 Live Transcripts: Get real-time text transcripts of the conversation.

Installation

npm install @krutai/ai-live-conversation

Quick Start

1. Recommended: Secure Server-Side Integration

To keep your API key secure, initialize the connection on your server and pass the generated WebSocket URL to the client.

Server-side (e.g., Next.js API Route or Server Action):

import { liveConversation } from '@krutai/ai-live-conversation';

export async function getLiveDetails() {
  const ai = new liveConversation({
    apiKey: process.env.KRUTAI_API_KEY, // Never expose this to the browser
    serverUrl: 'https://api.krut.ai', // Optional: defaults to http://localhost:8000
  });

  // Validate and connect
  await ai.initialize();

  // Generate a secure connection URL
  const details = await ai.getLiveConnection({
    instructions: 'You are a helpful travel assistant.',
    voice: 'Aoede', // Puck, Aoede, Charon, Fenrir, Kore
  });

  return details.url;
}

Client-side:

"use client";

import { LiveConversation } from '@krutai/ai-live-conversation';

export default function App({ wsUrl }: { wsUrl: string }) {
  return (
    <div className="h-screen w-full flex items-center justify-center p-4">
      <div className="w-full max-w-2xl h-[600px]">
        <LiveConversation 
          url={wsUrl} 
          onTranscriptUpdate={(text) => console.log('Live:', text)}
        />
      </div>
    </div>
  );
}

2. Simple Client-Side Usage

For quick testing or internal tools, you can pass the API key directly.

import { LiveConversation } from '@krutai/ai-live-conversation';

function MyAssistant() {
  return (
    <LiveConversation 
      apiKey="your-api-key"
      prompt="You are a helpful assistant."
      aiVoice="Puck"
    />
  );
}

API Reference

LiveConversation Component Props

| Prop | Type | Description | | ---- | ---- | ----------- | | url | string | The WebSocket URL (generated via server-side SDK). | | apiKey | string | KrutAI API key (if not using url). | | serverUrl | string | KrutAI Server URL (defaults to http://localhost:8000). | | prompt | string | System instructions for the AI behavior. | | aiVoice | string | Voice selection (Puck, Aoede, Charon, Fenrir, Kore). | | onTranscriptUpdate | (text: string) => void | Callback for real-time transcripts. | | onConnectionStatusChange| (status: string) => void | Status updates: disconnected, connecting, connected, error. | | onApiKeyValidationError| (error: string) => void | Callback triggered when API key validation fails. | | onAudioStream | (base64: string) => void | Raw audio data stream from the AI. | | customRender | object | UI customization hooks (see below). |

UI Customization

You can inject your own components for any part of the interface:

<LiveConversation
  url={url}
  customRender={{
    // Wrap the entire component
    container: (children) => <div className="custom-box">{children}</div>,
    
    // Replace the status badge
    statusIndicator: ({ status }) => <div>Status: {status}</div>,
    
    // Replace the control buttons
    controls: ({ isConnected, isMuted, onConnect, onDisconnect, onToggleMute }) => (
      <div className="custom-toolbar">
        <button onClick={isConnected ? onDisconnect : onConnect}>
          {isConnected ? 'End' : 'Start'}
        </button>
      </div>
    ),
    
    // Replace the transcript view
    transcriptDisplay: (text) => <p className="italic text-gray-500">{text}</p>
  }}
/>

Advanced: Server-Side SDK (liveConversation)

The liveConversation class provides helper methods for secure initialization.

| Method | Description | | ------ | ----------- | | constructor(config) | Takes apiKey, serverUrl, and validateOnInit (boolean, defaults to true). | | initialize() | Validates the API key against the server. | | getLiveConnection(options) | Returns { url, room, participant, ... } for the client. |

Supported Voices

  • Puck: Friendly, energetic male voice.
  • Aoede: Calm, professional female voice.
  • Charon: Deep, authoritative male voice.
  • Fenrir: Warm, approachable male voice.
  • Kore: Bright, youthful female voice.

License

MIT © KrutAI