/** * Type-safe Avatar vendor classes. * * Avatar vendors provide visual representation for voice agents. * Different vendors have specific audio sample rate requirements. */ import type { AvatarConfig } from "../types.mjs"; import type { AkoolSampleRate, HeyGenSampleRate, LiveAvatarSampleRate } from "./base.mjs"; import { BaseAvatar } from "./base.mjs"; /** * Constructor options for HeyGen Avatar. /** * Constructor options for LiveAvatar. */ export interface LiveAvatarAvatarOptions { /** LiveAvatar API key */ apiKey: string; /** Video quality: "low" (360p), "medium" (480p), or "high" (720p) */ quality: "low" | "medium" | "high"; /** RTC UID for the avatar (must be unique in the channel) */ agoraUid: string; /** Avatar ConvoAI token. Omit to auto-generate at session start. */ agoraToken?: string; /** HeyGen avatar ID */ avatarId?: string; /** Whether to disable idle timeout (default: false) */ disableIdleTimeout?: boolean; /** Idle timeout in seconds (default: 120, only applies if disableIdleTimeout is false) */ activityIdleTimeout?: number; /** Enable avatar (default: true) */ enable?: boolean; /** Additional vendor-specific parameters */ additionalParams?: Record; } /** * Constructor options for Akool Avatar. */ export interface AkoolAvatarOptions { /** Akool API key */ apiKey: string; /** Akool avatar ID */ avatarId?: string; /** Enable avatar (default: true) */ enable?: boolean; /** Additional vendor-specific parameters */ additionalParams?: Record; } /** * Akool Avatar vendor. * * ⚠️ IMPORTANT: Akool avatars ONLY support audio with a sample rate of 16,000 Hz. * You must configure your TTS with a 16kHz sample rate or the request will fail. * * @example * ```typescript * import { Agent, AkoolAvatar, ElevenLabsTTS } from 'agora-agents'; * * const avatar = new AkoolAvatar({ * apiKey: process.env.AKOOL_API_KEY, * avatarId: 'avatar-id', * }); * * // TTS must declare sampleRate: 16000 so withAvatar() enforces the match at compile time. * const tts = new ElevenLabsTTS({ * key: process.env.ELEVENLABS_API_KEY, * modelId: 'eleven_flash_v2_5', * voiceId: 'voice-id', * baseUrl: 'wss://api.elevenlabs.io/v1', * sampleRate: 16000, // Required for Akool * }); * * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' }); * const agent = new Agent({ client }) * .withTts(tts) * .withAvatar(avatar); * ``` * * @see https://docs.agora.io/en/conversational-ai/models/avatar/akool */ export declare class AkoolAvatar extends BaseAvatar { private readonly options; /** * Akool avatars require TTS sample rate of 16,000 Hz. */ readonly requiredSampleRate: 16000; constructor(options: AkoolAvatarOptions); toConfig(): AvatarConfig; } /** * LiveAvatar avatar vendor (formerly HeyGen). * * ⚠️ IMPORTANT: LiveAvatar ONLY supports audio with a sample rate of 24,000 Hz. * You must configure your TTS with a 24kHz sample rate or the request will fail. * * @example * ```typescript * import { Agent, LiveAvatarAvatar, ElevenLabsTTS } from 'agora-agents'; * * const avatar = new LiveAvatarAvatar({ * apiKey: process.env.LIVEAVATAR_API_KEY, * quality: 'high', * agoraUid: '12345', * avatarId: 'avatar-id', * }); * * const tts = new ElevenLabsTTS({ * key: process.env.ELEVENLABS_API_KEY, * modelId: 'eleven_flash_v2_5', * voiceId: 'voice-id', * baseUrl: 'wss://api.elevenlabs.io/v1', * sampleRate: 24000, // Required for LiveAvatar * }); * * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' }); * const agent = new Agent({ client }) * .withTts(tts) * .withAvatar(avatar); * ``` * * @see https://docs.agora.io/en/conversational-ai/models/avatar/overview */ export declare class LiveAvatarAvatar extends BaseAvatar { private readonly options; /** * LiveAvatar requires TTS sample rate of 24,000 Hz. */ readonly requiredSampleRate: 24000; constructor(options: LiveAvatarAvatarOptions); toConfig(): AvatarConfig; } /** * @deprecated HeyGen has been renamed to LiveAvatar. Use {@link LiveAvatarAvatarOptions} instead. */ export type HeyGenAvatarOptions = LiveAvatarAvatarOptions; /** * HeyGen Avatar vendor. * * @deprecated HeyGen has been renamed to LiveAvatar. Use {@link LiveAvatarAvatar} instead. * This class emits `vendor: "heygen"` for backward compatibility. New deployments * should use `LiveAvatarAvatar` which emits `vendor: "liveavatar"`. */ export declare class HeyGenAvatar extends BaseAvatar { private readonly options; readonly requiredSampleRate: 24000; constructor(options: HeyGenAvatarOptions); toConfig(): AvatarConfig; } /** * Constructor options for Anam Avatar. */ export interface AnamAvatarOptions { /** Anam API key */ apiKey: string; /** Anam avatar ID */ avatarId?: string; /** Enable avatar (default: true) */ enable?: boolean; /** Additional vendor-specific parameters */ additionalParams?: Record; } /** * Anam Avatar vendor (Beta). * * @example * ```typescript * import { Agent, AnamAvatar } from 'agora-agents'; * * const avatar = new AnamAvatar({ * apiKey: process.env.ANAM_API_KEY, * avatarId: 'avatar-id', * }); * * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' }); * const agent = new Agent({ client }) * .withAvatar(avatar); * ``` * * @see https://docs.agora.io/en/conversational-ai/models/avatar/overview */ export declare class AnamAvatar extends BaseAvatar { private readonly options; /** * Anam does not enforce a specific TTS sample rate. Consult Anam documentation * for the sample rate supported by your chosen persona. */ readonly requiredSampleRate: number; constructor(options: AnamAvatarOptions); toConfig(): AvatarConfig; } /** * Constructor options for Generic Avatar. */ export interface GenericAvatarOptions { /** Avatar provider API key */ apiKey: string; /** Avatar provider API base URL */ apiBaseUrl: string; /** Avatar ID */ avatarId: string; /** RTC UID for the avatar video publisher (must be unique in the channel) */ agoraUid: string; /** Agora App ID. Omit to use the session app ID at start. */ agoraAppId?: string; /** Agora channel. Omit to use the session channel at start. */ agoraChannel?: string; /** Avatar ConvoAI token. Omit to auto-generate at session start. */ agoraToken?: string; /** Enable avatar (default: true) */ enable?: boolean; /** Additional vendor-specific parameters */ additionalParams?: Record; } /** * Generic Avatar vendor (Beta). * * Generic avatars use a custom avatar provider while still publishing video * into the Agora channel. AgentKit fills `agora_appid`, `agora_channel`, and * `agora_token` at session start when they are omitted. * * @see https://docs.agora.io/en/conversational-ai/models/avatar/generic */ export declare class GenericAvatar extends BaseAvatar { private readonly options; /** * Generic avatars do not enforce a specific TTS sample rate. */ readonly requiredSampleRate: number; constructor(options: GenericAvatarOptions); toConfig(): AvatarConfig; }