Skip to content

Introduction

The 2wai Avatar Toolkit lets you add a live, talking, lip-synced avatar to any product you’re building — a support widget, a companion app, a training simulator, a kiosk — without running video, audio, or rendering infrastructure yourself.

Each avatar has its own brain and its own voice, set in 2wai Studio. Your users talk to it; 2wai handles the reply, the voice, lip-sync rendering, and delivery over LiveKit (WebRTC). Bringing your own LLM or your own TTS is planned but not available on the current gateway.

2wai uses a split-plane design: your server holds credentials and mints sessions; the client only renders what it’s told to.

%%{init: {'theme': 'dark', 'sequence': {'actorFontSize': 24, 'messageFontSize': 22, 'noteFontSize': 20, 'wrap': true, 'width': 180}}}%%
sequenceDiagram
  autonumber
  participant Server as Your Server
  participant API as 2wai Gateway
  participant Client as Your Client

  Server->>API: POST /v1/sessions (sk_)
  API-->>Server: livekit_url + participant_token
  Server-->>Client: hand off token
  Client->>API: join LiveKit room
  API-->>Client: subscribed video + audio tracks
  Client->>API: user turn as text stream (lk.chat)
  API-->>Client: avatar replies: lip-synced speech + reply text
  Server->>API: DELETE /v1/sessions/{id}
  • Your server holds a secret key (sk_...) and never shares it with the client. It creates sessions and ends them.
  • Your client holds only a LiveKit participant_token, scoped to a single session. It joins the room and sends the user’s turns to the avatar over it; it never calls the REST API directly.
  • 2wai runs the avatar (its brain, its voice, lip-sync, video encoding) and streams the result over a LiveKit room as subscribed WebRTC tracks.

A leaked client-side token can’t be used to mint new sessions, run up your bill, or exfiltrate your secret key. The worst it can do is watch (or disconnect from) the one session it was scoped to. See Authentication for the full model.

Web / TypeScript

@twai/core + @twai/player + @twai/react or the drop-in <twai-avatar> Web Component. Modern browsers, ES2020+.

Flutter

Cross-platform: iOS, Android, Web, Windows, macOS, Linux from one codebase. twai_avatar_sdk + Transport 0 (LiveKit) by default.

iOS native (Swift)

TwaiAvatarKit — SwiftUI-first, Swift Package Manager, iOS 15+. Shipped and verified on device.

REST + Postman

Any language. OpenAPI spec + Postman collection + Node / Python / Cloudflare Worker mint-proxy templates.

Android native (Kotlin)

Upon request. Flutter already ships to Android from one codebase. A dedicated Kotlin/Compose SDK is roadmap-conditional — ping your 2wai contact if you need it.

Live video avatar

Stream a real-time, lip-synced avatar in a few hundred lines of client code. See the Quickstart.

Your own avatar

Build an avatar in 2wai Studio, set its persona and voice, expose it to the API. See Creating avatars.

Bring your own brain or TTS (planned)

Not available on the current gateway. See Bring your own brain for what is planned.

All REST endpoints are served from:

https://api.2wai.ai