A stunning real-time AI avatar conversation application powered by LiveKit, Akool, and OpenAI. Features a modern, responsive UI with glassmorphism design and seamless video streaming.
- π€ AI-Powered Avatar - Interactive conversations with Akool's realistic avatars
- ποΈ Voice Conversations - Real-time voice chat using OpenAI Realtime API
- π¨ Beautiful Modern UI - Glassmorphism design with gradient effects
- π± Fully Responsive - Works seamlessly on desktop, tablet, and mobile
- π₯ Multi-Participant - Support for multiple participants in the room
- β‘ Real-Time Communication - Low-latency video/audio streaming via LiveKit
- π₯ Akool Avatar LiveKit Demo
- β¨ Features
- π Table of Contents
- π Prerequisites
- π Quick Start
- π¨ What You'll Experience
- π Project Structure
- π§ Configuration
- π Troubleshooting
- π Additional Resources
- π Security Notes
- π Production Deployment
- π€ Contributing
- π License
- π Acknowledgments
- π¬ Support
Before you begin, you'll need to set up several accounts and install necessary tools.
- Visit LiveKit Cloud
- Click "Sign Up" and create your account
- Confirm your email address
- After signing in, you'll see the dashboard
- Click "Create Project" or "New Project"
- Give your project a name (e.g., "akool-avatar-demo")
- Choose a region closest to you for best performance
- Click "Create"
- In your project dashboard, navigate to Settings β API Keys
- You'll see your credentials:
- WebSocket URL:
wss://your-project.livekit.cloud(orws://localhost:7880for local) - API Key: Starts with
API... - API Secret: Long secret string
- WebSocket URL:
- Important: Keep these credentials secure! Never commit them to public repositories
π‘ Tip: For local development, you can optionally run a local LiveKit server. See LiveKit Server Setup for details.
The LiveKit CLI is useful for testing and debugging:
macOS:
brew install livekitLinux:
curl -sSL https://get.livekit.io/cli | bashWindows: Download from LiveKit Releases
Verify Installation:
livekit-cli --versionRun Local Server (Optional):
livekit-server --devThis starts a local LiveKit server with default credentials:
- URL:
ws://localhost:7880 - API Key:
devkey - API Secret:
secret
- Visit Akool.com
- Sign up for an account
- Complete the verification process
- Navigate to the API section in your dashboard
- Go to API Settings or Developer Settings
- Generate or copy your:
- Client ID
- Client Secret
- API URL: Usually
https://api.akool.com
- Note your available Avatar IDs - you'll need one for the agent
π Note: Akool may require account approval for API access. Contact their support if needed.
- Visit OpenAI Platform
- Sign up or sign in
- Add a payment method (required for API access)
- Navigate to API Keys
- Click "Create new secret key"
- Give it a name (e.g., "livekit-avatar")
- Copy the key immediately - you won't be able to see it again!
- Store it securely
β οΈ Important: The OpenAI Realtime API requires a paid account with credits.
The client requires Node.js 18+ (LTS version recommended).
macOS:
# Using Homebrew
brew install node
# Or download from nodejs.orgLinux (Ubuntu/Debian):
# Using NodeSource
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejsWindows: Download the installer from nodejs.org
node --version # Should show v18.x.x or higher
npm --version # Should show 9.x.x or higherThe agent requires Python 3.13+.
macOS:
# Using Homebrew
brew install [email protected]
# Or download from python.orgLinux (Ubuntu/Debian):
sudo apt update
sudo apt install python3.13 python3.13-venv python3-pipWindows: Download from python.org
Verify Installation:
python3 --version # Should show 3.13.x or higheruv is a blazingly fast Python package manager that replaces pip and virtualenv.
macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"Verify Installation:
uv --versionAdd to PATH (if needed):
After installation, you may need to restart your terminal or add uv to your PATH:
# Add to ~/.zshrc or ~/.bashrc
export PATH="$HOME/.cargo/bin:$PATH"git clone <your-repo-url>
cd livekit-demoCreate a .env file in the project root:
cp .env.example .envEdit .env and add your credentials:
# LiveKit Configuration
LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secret
LIVEKIT_ROOM=akool-demo-room
# Akool Configuration
AKOOL_CLIENT_ID=your_akool_client_id
AKOOL_CLIENT_SECRET=your_akool_client_secret
AKOOL_API_URL=https://api.akool.com
# OpenAI Configuration
OPENAI_API_KEY=sk-your_openai_api_keyPython Dependencies:
First, create a virtual environment (optional but recommended):
# Create a virtual environment with uv
uv venv
# Activate the virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activateThen install dependencies:
uv syncπ‘ Note:
uv syncwill automatically create a virtual environment if one doesn't exist, but creating it explicitly gives you more control.
Client Dependencies:
cd client
npm install
cd ..Option A: Using the Start Script (Easiest)
Run everything with a single command:
bash start.shThis automatically starts the main server (token server + agent).
Option B: Single Command (Main Server)
The main server automatically spawns the agent:
uv run main.pyThis starts:
- Token server on
http://localhost:5050 - LiveKit agent automatically
Option C: Separate Processes (Development)
Terminal 1 - Token Server:
uv run token_server.pyTerminal 2 - Agent:
uv run agent.py devStart the Client:
In a new terminal:
cd client
npm run devVisit http://localhost:5173
Click "Join Avatar Session" to connect!
- Stunning purple/blue gradient background
- Glassmorphism card with smooth animations
- One-click connection to avatar session
- Real-time error handling
- Featured Avatar Display: Large, centered video of the Akool avatar
- Connection Status: Live indicator showing connection state
- Participant Grid: Other room participants shown below
- Easy Controls: Leave button to exit the session
- Speak naturally - the avatar responds in real-time
- See your microphone input visualized
- Watch the avatar's lip-sync and expressions
- Smooth, low-latency communication
livekit-demo/
βββ agent.py # LiveKit agent with Akool integration
βββ main.py # Main server (token + agent spawning)
βββ token_server.py # Standalone token server (alternative)
βββ pyproject.toml # Python dependencies
βββ .env.example # Environment variables template
βββ client/ # React frontend
β βββ src/
β β βββ App.tsx # Main React component
β β βββ App.css # Custom styles
β β βββ main.tsx # Entry point
β βββ package.json # Node dependencies
β βββ vite.config.ts # Vite configuration
βββ livekit-plugins-akool/ # Custom Akool plugin
Edit agent.py line 34:
avatar_config=akool.AvatarConfig(
avatar_id="your_preferred_avatar_id" # Change this
),Edit agent.py line 21:
voice="alloy", # Options: alloy, echo, fable, onyx, nova, shimmerEdit client/src/App.tsx to change the gradient colors, borders, and effects.
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Restart terminal or source your profile
source ~/.zshrc # or ~/.bashrc# Install specific Python version with uv
uv python install 3.13- Check your
LIVEKIT_URLin.env - Verify API credentials are correct
- Ensure LiveKit server is running (local or cloud)
- Check firewall/network settings
- Verify Akool credentials in
.env - Check that the avatar_id in
agent.pyis valid - Look for errors in the agent console
- Ensure you have API access enabled
- Allow microphone permissions in your browser
- Use HTTPS for production (required for getUserMedia)
- Try Chrome/Edge for best WebRTC support
- Check browser console for errors
# Check if uv is working
uv --version
# Check Python version
uv run python --version
# Check for errors in .env file
cat .env- LiveKit Documentation: docs.livekit.io
- LiveKit Agents Guide: docs.livekit.io/agents
- Akool Documentation: akool.com/docs
- OpenAI Realtime API: platform.openai.com/docs
- React Documentation: react.dev
- Vite Documentation: vitejs.dev
For more detailed information, see:
QUICKSTART.md- Quick start guideREADME_SETUP.md- Detailed setup and featuresIMPLEMENTATION_SUMMARY.md- Technical implementation details
- Never commit
.envfiles to version control - Use environment variables for all sensitive credentials
- Rotate API keys regularly
- Use HTTPS in production
- Implement rate limiting for production deployments
- Validate all user inputs on the server side
For production deployment:
- Use HTTPS: Required for browser media access
- Environment Variables: Use proper secrets management
- Process Manager: Use PM2, systemd, or Docker for the agent
- CDN: Serve static assets via CDN
- Monitoring: Set up logging and monitoring
- Load Balancing: Scale horizontally if needed
Example with PM2:
# Install PM2
npm install -g pm2
# Start server
pm2 start main.py --interpreter uv
# Start client build
cd client && npm run buildContributions are welcome! Please feel free to submit a Pull Request.
This project is provided as-is for demonstration purposes. Check individual library licenses for production use.
- LiveKit - Real-time communication infrastructure
- Akool - AI avatar technology
- OpenAI - AI conversation capabilities
- React - UI framework
- Tailwind CSS - Styling framework
For issues and questions:
- Check the Troubleshooting section
- Review the detailed guides in the documentation folder
- Open an issue in the repository
Built with β€οΈ using LiveKit, Akool, and OpenAI
π Now go build something amazing!