Getting Started

Get up and running with rtAV in just a few minutes. This guide will walk you through creating your first real-time AI avatar session.

Prerequisites

  • An rtAV account (sign up at platform.rtav.io/signup)
  • An API key (available in your dashboard after signup)
  • Node.js 18+ or Python 3.8+ (depending on your preferred SDK)

Step 1: Get Your API Key

  1. Sign up for an account at platform.rtav.io/signup
  2. Navigate to your dashboard at platform.rtav.io
  3. Go to the API Keys section
  4. Create a new API key and copy it securely

Step 2: Install the SDK

JavaScript/TypeScript

npm install @rtav/sdk

Python

pip install rtav-sdk

Step 3: Create Your First Session

JavaScript Example

import { RTAVClient } from '@rtav/sdk';

const client = new RTAVClient({
  apiKey: 'your-api-key-here'
});

// Create a new session
const session = await client.sessions.create({
  model: 'gpt-4',
  voice: 'alloy',
  // Optional: upload custom face image
  faceImage: 'https://example.com/face.jpg'
});

// Connect to the session
await session.connect();

// Send a message
await session.sendMessage('Hello, how are you?');

// Listen for responses
session.on('response', (audio, video) => {
  // Handle audio and video streams
  console.log('Received response');
});

// End the session when done
await session.end();

Python Example

from rtav import RTAVClient

client = RTAVClient(api_key='your-api-key-here')

# Create a new session
session = client.sessions.create(
    model='gpt-4',
    voice='alloy',
    # Optional: upload custom face image
    face_image='https://example.com/face.jpg'
)

# Connect to the session
session.connect()

# Send a message
session.send_message('Hello, how are you?')

# Listen for responses
@session.on_response
def handle_response(audio, video):
    # Handle audio and video streams
    print('Received response')

# End the session when done
session.end()

Step 4: Handle Audio and Video

rtAV streams both audio and video responses. You can handle them separately or together:

  • Audio: Use Web Audio API or your preferred audio library to play the audio stream
  • Video: Display the video stream in a video element or canvas
  • Synchronization: The SDK handles audio-video synchronization automatically

Next Steps

Need Help?

If you run into any issues, check out our support page or reach out to our team.