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:
- Core SDK (
@teamduality/heygen-typescript-sdk
) - Streaming SDK (
@teamduality/og-streaming-sdk
) - 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
- Initialize the SDK with your API key
- Create videos or start streaming sessions
- Handle responses with full TypeScript support
- 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'
})