How a held button becomes a spoken reply

Flare runs on free tiers on purpose. That constraint shaped nearly every decision below, from splitting a turn into three requests to keeping the character's behaviour out of the language model.

The path of one turn

Flare request pathThe browser records audio and sends it to the Worker, which forwards it to Whisper for text. The browser then sends the transcript; the Worker reads the conversation from D1, streams a reply from Llama with a mood, gesture and intensity tag, asks Kokoro for audio of each sentence as it completes, saves both messages, and sends text and audio back over one event stream.Browserrecord, transcript, lip-syncWorkerauth, validation, D1DeepInfraWhisper, Llama, Kokoroaudiotranscribe1. hold and speaktranscriptreply stream2. words stream inD1 historymp3 per sentencespoken as it lands3. speak and animate

The browser does the cheap work

Recording, silence detection, lip-sync, blinking, gaze and gestures all run on your device. The Worker never decodes audio or parses uploads; it forwards a raw body and streams the reply back.

The reply streams, sentence by sentence

The model's words arrive as a stream. The Worker splits them at sentence boundaries and asks for audio of each sentence the moment it is complete, so the first words are spoken while the rest is still being written. Every stage can be cancelled without wasting the others.

One model call per turn

The reply begins with a one-line tag carrying the mood, a gesture, how strongly it is felt and, on a new thread, a title; the spoken text follows. Prompts are short, replies come back in your language, and the history is condensed into a summary once a conversation passes twenty messages.

A character that does not need a prompt to breathe

The model chooses from ten moods and five gestures, and that is the whole of its influence over the body. Everything else is a state machine: idle sway and breathing on a clock, blinks on a random timer, eyes that saccade around a target, a head that leans in while listening and drifts up while thinking.

Each mood is a hand-tuned set of blend-shape weights on brows, eyes and cheeks, chosen so it can be held while the mouth is busy with lip-sync. Strong moods briefly blend in a body clip at reduced weight, so annoyance reads as a flicker rather than a tantrum. The stage lights follow the same state, in the scene and on the page.

Try the character

These buttons write to the same state the assistant uses. Pick a mood, add a gesture, switch the state, and watch the face, posture and light respond.

Scroll to wake Flare

Mood

Ten expressions the model can choose. Each holds while Flare talks.

One number from the model scales the face and the body reaction.

Gesture

Nod and shake are procedural; laugh and dance are clips.

State

Posture, gaze and lighting follow the conversation state.

What it is built on

Web app
Next.js, statically exported to Cloudflare Pages. React Three Fiber renders the character.
API
A Hono application on Cloudflare Workers, kept inside the free plan CPU budget by design.
Database
Cloudflare D1 (SQLite) for users, conversations and transcripts, with rolling summaries.
Sign-in
Clerk, with session tokens verified locally on the Worker using its public key.
Hearing
Whisper large-v3-turbo, hosted by DeepInfra.
Thinking
Llama 3.1 8B Instruct in JSON mode, so mood, gesture and title come back with the reply.
Speaking
Kokoro-82M, one sentence at a time as the reply streams, so the first words arrive while the rest is still being written.
Listening
Silero VAD, a small neural voice detector running on your device through ONNX Runtime Web, with an energy gate as fallback.
Character
A Ready Player Me rig with ARKit blend shapes and a small library of body clips.