Skip to main content
A full working example of the Characters API: one Node file, zero dependencies. It keeps your secret key on the server, mints a short-lived session token per player, and drops the Alakazam embed, so the character streams as live video and talks back in voice, with the chat built in. This is the exact production embed pattern.
The full source is shown below. Copy it into a file and run it.

1. Get a character id

Create one, or import a shipped example (see Example characters):

2. Save this as character-demo.mjs

3. Run it

Open http://localhost:3000, tap to start, and the character streams as live video, talks back in voice, and takes typed messages. Because you pass a stable ALAKAZAM_PLAYER, it remembers across sessions (cross-session memory).
ALAKAZAM_EMBED_HOST is wherever the Alakazam embed player (embed.html) is served. Use your hosted player. For local development against the repo, run the play-app dev server and point at it (Vite defaults to http://localhost:5173).

Going to production

This is the embed pattern verbatim: your backend mints the token, and your page drops the <iframe>. To lock the token to your domain, pass an origin when minting and add it to your app’s embedding_origins. See Embedding.