What is Direct Mode for Web?
Direct Mode for Web is the simplest way to put a Spatius avatar in a browser app.@spatius/avatarkit connects directly to Motion Server, sends avatar speech audio, and renders motion locally — no agent worker or relay backend needed beyond a Session Token endpoint.
When to use
- You have or generate avatar speech audio in the browser — your own TTS output, prerecorded clips, or agent audio fetched server-side.
- You want the smallest backend footprint: a single Session Token endpoint.
- You want the client to own rendering and don’t need backend-controlled audio or transport.
Run the demo
Web SDK quickstart
One quickstart with bundled sample audio plus optional realtime conversation.
Multi-framework reference
React, Vue, vanilla JavaScript, and Next.js reference clients.
Install
- pnpm
- npm
- yarn
Build tool configuration
- Vite
- Next.js
Add the official plugin to
vite.config.ts:vite.config.ts
What the plugin handles
What the plugin handles
- Dev server: serves
.wasmfiles with the correct MIME type - Build: copies WASM files to
dist/assets/ - Cloudflare Pages: generates a
_headersfile - Vite options: configures
optimizeDeps,assetsInclude,assetsInlineLimit
Manual Vite configuration (without the plugin)
Manual Vite configuration (without the plugin)
vite.config.ts
Minimum integration
The smallest end-to-end flow with@spatius/avatarkit:
1
Initialize the SDK
2
Load the avatar
3
Mount the view
4
Initialize audio (inside a user gesture)
5
Connect and send audio
6
Cleanup
Next steps
Web SDK reference
Complete Web SDK API: AvatarSDK, AvatarManager, AvatarView, AvatarController, types, errors.
Browse all demos
Every runnable demo by platform and integration path.

