Documentation Index
Fetch the complete documentation index at: https://docs.spatius.ai/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Download the latest AvatarKit.xcframework, unzip, and drag it into your Xcode project. Set Embed & Sign in your target’s Frameworks, Libraries, and Embedded Content.AvatarSDK
Main initialization and configuration interface for AvatarKit.Type Properties
appID
appID
configuration
configuration
sessionToken
sessionToken
userID
userID
supportsCurrentDevice
supportsCurrentDevice
version
version
Type Methods
initialize(appID:configuration:)
initialize(appID:configuration:)
appID: The app identifierconfiguration: The configuration for AvatarKit
benchmark()
benchmark()
AvatarManager
Manage avatar asset loading, caching, and retrieval.Type Properties
shared
shared
Instance Methods
load(id:onProgress:)
load(id:onProgress:)
id: The avatar identifieronProgress: Optional progress callback
Avatar instance.cancelLoading(id:)
cancelLoading(id:)
id: The avatar identifier
cancelAllLoading()
cancelAllLoading()
retrieve(id:)
retrieve(id:)
id: The avatar identifier
Avatar if available, otherwise nil.derive(assetPath:)
derive(assetPath:)
assetPath: The path to the avatar asset
Avatar instance.clear(id:)
clear(id:)
id: The avatar identifier to clear
clearAll()
clearAll()
clearLRU(keepCount:)
clearLRU(keepCount:)
keepCount: Number of most recently used avatars to keep
getCacheSize(id:)
getCacheSize(id:)
id: The avatar identifier
getAllCacheSize()
getAllCacheSize()
AvatarController
The main controller for managing avatar driving service connections and interactions.Instance Properties
onFirstRendering
onFirstRendering
onConnectionState
onConnectionState
onConversationState
onConversationState
onError
onError
start()
start()
close()
close()
pauseRendering()
pauseRendering()
resumeRendering()
resumeRendering()
isRendering
isRendering
interrupt()
interrupt()
send(_:end:)
send(_:end:)
data: The audio data to sendend: Whether this is the end of the audio stream
yield(_:end:audioFormat:)
yield(_:end:audioFormat:)
data: The audio dataend: Whether this is the end of the audio streamaudioFormat: The audio format (optional)
yield(_:conversationID:)
yield(_:conversationID:)
animations: Array of animation dataconversationID: The conversation identifier
pointCount
pointCount
volume
volume
AvatarView
A UIView subclass for rendering avatars.Initializers
init(avatar:)
init(avatar:)
avatar: The avatar to display
Instance Properties
controller
controller
contentTransform
contentTransform
isOpaque
isOpaque
Avatar
Represents an avatar instance.| Instance Property | Type | Description |
|---|---|---|
id | String | The avatar identifier. |
isFromCache | Bool | Whether the instance of avatar is from cache. |
Configuration
Configuration for AvatarKit.Initializers
init(environment:audioFormat:drivingServiceMode:logLevel:)
init(environment:audioFormat:drivingServiceMode:logLevel:)
environment: The environment to useaudioFormat: The audio format configurationdrivingServiceMode: The driving service modelogLevel: The log level
| Instance Property | Type | Description |
|---|---|---|
environment | Environment | Environment for AvatarKit. |
audioFormat | AudioFormat | Audio format for AvatarKit. |
drivingServiceMode | DrivingServiceMode | Driving service mode for AvatarKit. |
logLevel | LogLevel | Log level for AvatarKit. |
Environment
Environments for AvatarKit.| Case | Description |
|---|---|
intl | International environment. |
cn | China environment. |
AudioFormat
Audio format configuration for AvatarKit.Initializers
init(sampleRate:)
init(sampleRate:)
sampleRate: The audio sample rate in Hz
| Instance Property | Type | Description |
|---|---|---|
sampleRate | Int | The audio sample rate in Hz. |
channelCount | Int | The number of audio channels. Fixed to 1 for mono. |
DrivingServiceMode
Driving service modes for AvatarKit.| Case | Description |
|---|---|
sdk | The SDK handles driving service internally. |
host | The host application handles driving service. |
LogLevel
Log levels for AvatarKit.| Case | Description |
|---|---|
all | Log all messages. |
warning | Log warnings and errors only. |
error | Log errors only. |
off | Disable logging. |
ConnectionState
Connection states for AvatarKit.| Case | Description |
|---|---|
connecting | The connection is being established. |
connected | The connection is active. |
disconnected | The connection has been closed. |
failed(Error) | The connection failed with an error. |
ConversationState
Conversation states for AvatarKit.| Case | Description |
|---|---|
idle | No active conversation. |
playing | The avatar is playing audio/animation. |
paused | The conversation is paused. |
Transform
Transform for avatar content rendering.Initializers
init(x:y:scale:)
init(x:y:scale:)
x: The x-axis translationy: The y-axis translationscale: The scale factor
| Type Property | Type | Description |
|---|---|---|
identity | Transform | The identity transform. |
| Instance Property | Type | Description |
|---|---|---|
x | Float | The x-axis translation. |
y | Float | The y-axis translation. |
scale | Float | The scale factor. |
AvatarError
Avatar errors for AvatarKit.| Case | Description |
|---|---|
appIDUnrecognized | The app ID is not recognized. |
avatarIDUnrecognized | The avatar ID is not recognized. |
avatarAssetMissing | The avatar asset is missing. |
failedToDownloadAvatarAssets | Failed to download avatar assets. |
failedToFetchAvatarMetadata | Failed to fetch avatar metadata. |
sessionTokenExpired | The session token has expired. |
sessionTokenInvalid | The session token is invalid. |
| Instance Property | Type | Description |
|---|---|---|
errorDescription | String? | A localized description of the error. |
failureReason | String? | The reason for the failure. |

