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.

You control what the avatar says. 2wai handles turning that into a real-time video stream: text-to-speech (or your own audio), lip-sync rendering, and delivery over LiveKit (WebRTC). If you’d rather bring your own LLM for the brain or your own TTS audio, the API is built to let you swap either in.

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

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
  Server->>API: POST /speak {text}
  API-->>Client: lip-synced speech streams live
  • Your server holds a secret key (sk_...) and never shares it with the client. It creates sessions and tells the avatar what to say.
  • Your client holds only a short-lived LiveKit participant_token, scoped to a single session; it never calls the REST API directly.
  • 2wai runs the avatar rendering pipeline (text-to-speech or your own audio, 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.

Bring your own brain

Any LLM — OpenAI, Anthropic, your own fine-tune, a rules engine. See Bring your own brain.

Bring your own TTS

Already have TTS you like? Push its audio directly. See Bring your own TTS.

Custom voices

Clone a voice from a short reference clip in one API call. See Voices.

All REST endpoints are served from:

https://api.2wai.ai