ProjectHow It Works

How It Works

Overview

The HeyGen TypeScript SDK provides a type-safe interface to HeyGen’s AI video generation and interactive avatar services. It consists of three main packages:

  1. Core SDK (@teamduality/heygen-typescript-sdk)
  2. Streaming SDK (@teamduality/og-streaming-sdk)
  3. Demo Application (@teamduality/og-next-demo)

Architecture

The SDK is built with a modular architecture:

  • Core SDK handles all base API interactions
  • Streaming SDK extends core functionality for real-time avatar interactions
  • Demo app showcases integration patterns

Integration Flow

  1. Initialize the SDK with your API key
  2. Create videos or start streaming sessions
  3. Handle responses with full TypeScript support
  4. Manage resources and cleanup

Code Example

Currently we’re utilizing the original streaming SDK. Check out our roadmap for more information on how we’re planning to expand on this.

import { HeygenSDK } from '@teamduality/heygen-typescript-sdk'
import { StreamingAvatar } from '@teamduality/og-streaming-sdk'
 
// Initialize core SDK
const sdk = new HeygenSDK('your_api_key')
 
// Create a streaming avatar
const avatar = new StreamingAvatar({
  token: 'your_token'
})
 
// Start an interactive session
await avatar.createStartAvatar({
  quality: 'medium',
  avatarName: 'your_avatar'
})

MIT 2025 © Team Duality