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"warn"Log level
languageLanguageCodeNo"ko_kr"Language code used for TTS voice, subtitles, and STT recognition
enable_microphonebooleanNotrueWhether to use microphone input for STT. When true, the browser microphone permission is requested during init(), and the microphone is active and transmitting audio from the moment the connection is established. Initialize with false if you do not use voice input. When false, no permission is requested.
auto_sendbooleanNofalsefalse (Push-to-Send): control speech recognition via startListening/endListening. true (Auto Send): STT stays active, and server voice activity detection (VAD) detects speech segments to request responses automatically.
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.

Calling startListening(), endListening(), or cancelListening() while enable_microphone is false does not raise an error. The signals are still sent to the server, but no audio is delivered.

Even if the microphone cannot be acquired, the session stays alive and only a warning is logged.

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
"info"info, warn, errorView only key events (connection complete, initialization, etc.)
"warn"warn, errorView only potential issues (default)
"error"errorErrors only
"silent"NoneCompletely disable console output

LanguageCode ​

Specifies the avatar's TTS voice and subtitle language, and the user's STT recognition language.

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

Connection Flow ​

Error Handling ​

If initialization fails, the SDK releases its internal connection resources, returns to the IDLE state, and then 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
  // "Init failed: ..."                 -> Initialization failure at another stage
  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).