Skip to content

init()

Initializes the SDK and starts the avatar connection.

Usage

js
await SDK.init(options);

InitOption

ParameterTypeRequiredDefaultDescription
sdk_keystringYes-SDK authentication key
avatar_idstringYes-Avatar ID
log_levelLogLevelNo"debug"Log level
languageLanguageCodeNo"ko_kr"Language code (TTS voice + subtitles)
enable_microphonebooleanNotrueEnable microphone (for STT)
auto_sendbooleanNofalsefalse (Push to Send): manually control via startListening/endListening. true (Auto Send): STT always active, server VAD detects speech and triggers automatic response. Auto Send only works with avatars that support it — verify support before use.
stt_onlybooleanNofalseSTT-only mode. When true, the avatar does not respond and only STT results are returned. When false, STT results are returned and the avatar responds based on them.

LogLevel

Controls the log level output to the browser console. Only logs at or above the set level are displayed.

ValueOutput RangeUse Case
"debug"debug, info, warn, errorDetailed debugging during development (default)
"info"info, warn, errorView only key events (connection complete, initialization, etc.)
"warn"warn, errorView only potential issues
"error"errorErrors only
"silent"NoneCompletely disable console output

LanguageCode

Specifies the TTS voice and subtitle language for the avatar.

ValueLanguage
"ko_kr"Korean (default)
"en_us"English
"ja_jp"Japanese
"id_id"Indonesian

Connection Flow

Error Handling

On failure, the SDK performs internal cleanup, resets to IDLE, and throws an Error.

js
try {
  await SDK.init(options);
} catch (error) {
  // error.message contains the failure reason
  // "Failed to connect: ..."           -> SDK key validation or WebSocket connection failure
  // "Failed to connect streaming: ..." -> Streaming connection failure
  console.error(error.message);
}
  • If called while init/destroy is already in progress, it waits for the previous operation to complete before executing (Mutex serialization).