Lip sync, voice and talking characters over HTTP and WebSocket: send audio and get mouth cues back, send text and get a character's voice with the mouth on it, or render a character narrating your script as a video.
Getting started
Every endpoint lives under https://vibed.video/v1, takes JSON or binary bodies, and needs an API key.
1. Get a key. Sign in to the developer console and click New key. The key (vk_β¦) is shown once, so store it. You can hold several keys and revoke any of them.
2. Check it works. GET /v1/me answers with your account id:
curl -H "Authorization: Bearer $KEY" https://vibed.video/v1/me
3. Lip-sync a line. Send audio and its transcript, get the mouth shapes back:
curl -H "Authorization: Bearer $KEY" -F audio=@line.mp3 -F text="Oh, hey, I'm Mika!" \
https://vibed.video/v1/lipsync
Signed in, the console's Quick start has these steps with your own key filled in, plus JavaScript versions and a button that runs the first call.
Authentication
Send the key as a bearer token. Where a header cannot be set (a browser WebSocket, an <img>, <audio> or <video> tag), pass it as ?key= instead.
Authorization: Bearer <key> # HTTP
wss://vibed.video/v1/lipsync/stream?key=<key> # sockets and media tags
A key belongs to your account: characters you build and videos you render are visible only to your keys, and usage is recorded per key.
A page on your own site can call /v1 and import the SDK from /sdk directly: both answer every origin (CORS *), which is safe because the key travels in a header a browser never adds on its own. The rest of the site does not.
Endpoints
| Endpoint | What it does |
|---|---|
POST /v1/lipsync | Audio in, the complete cue timeline out |
WS /v1/lipsync/stream | Audio streamed in, cues streamed back as it is analysed |
POST /v1/speak | Text in, a character's voice and its cues streamed out |
WS /v1/speak/stream | Text streamed in as your LLM writes it, voice and cues streamed out |
POST /v1/takes | Text in, a character's voice as an mp3 with its words and cues, in one answer |
GET /v1/characters | Every character your key can use, and each one's frames, voice and intro |
GET /v1/characters/<slug>/bundle | A character as one zip, for rendering it yourself offline |
POST /v1/characters | A photo in, a complete talking character out |
POST /v1/videos | Text in, an mp4 of a character saying it |
GET /v1/videos | Your video jobs, newest first |
GET /v1/me, GET /v1/health | Your account, and the server's status |
Mouth cues
Every endpoint that animates a mouth answers with cues: { start, end, value }, where start and end are seconds and value is one of nine mouth shapes. Show the frame for value from start to end.
| Shape | Mouth | Sounds |
|---|---|---|
X | Closed, relaxed (rest) | silence |
A | Closed | P, B, M |
B | Teeth clenched | K, S, T, N, EE |
C | Open | EH, AE, AH |
D | Wide open | AA |
E | Slightly rounded | AO, ER |
F | Puckered | UW, OW, W |
G | Teeth on lower lip | F, V |
H | Tongue raised | L, R |
extendedShapes picks the set: "GHX" (all nine, the default) or "" (the basic six, A to F, for small stylised mouths where teeth and tongue cannot read). Ask for the set you render: a basic-six timeline is analysed differently, not derived from an all-nine one.
Two things every client should know
POST/v1/lipsync
Audio in, the complete cue timeline out. Use it for recorded lines; for live audio use the streaming socket.
# multipart (curl-friendly)
curl -H "Authorization: Bearer $KEY" -F audio=@line.mp3 -F text="Oh, hey, I'm Mika!" \
https://vibed.video/v1/lipsync
# raw body, options in the query
curl -H "Authorization: Bearer $KEY" -H 'content-type: audio/mpeg' --data-binary @line.mp3 \
'https://vibed.video/v1/lipsync?text=Oh%2C%20hey&character=hallway-girl'
# JSON with base64 audio
{ "audio": "<base64>", "text": "β¦", "character": "hallway-girl", "extendedShapes": "GHX" }
Request
| Field | Description |
|---|---|
audio | The audio, as a multipart file, the raw body, or base64 in JSON. Any format ffmpeg reads; up to 25 MB. |
text | The transcript. Optional, but send it. |
character | A character slug from GET /v1/characters. Records which character spoke, and supplies its shape set when it declares one. |
extendedShapes | "GHX" or "". Overrides the character's set. |
offsetS | Seconds added to every cue's start and end, so the cues arrive on your own timeline: a line that starts at 12.1 s in your film sends 12.1. From 0 to 86400; default 0. A JSON number, a form field, or ?offsetS= with a raw body. |
Response
{
"id": "ls_β¦", "character": "hallway-girl", "durationS": 3.6, "extendedShapes": "GHX", "offsetS": 0,
"cues": [{ "start": 0, "end": 0.27, "value": "X" }, β¦],
"shapesUsed": ["A","B","C","D","X"], "slices": 1, "lipsync": "rhubarb",
"timings": { "wallMs": 1550, "jobWallMs": 1550, "queueMs": 0, "firstCueMs": 1549 }
}
Clips up to 15 s run as one job. Longer audio is cut at pauses and the slices run in parallel (slices > 1), so a long file does not take proportionally longer.
offsetS moves only the cues: durationS and timings are the audio's own, and the response echoes the offset it applied.
Error codes
| Status | Meaning |
|---|---|
400 | Undecodable audio, or a bad option |
404 | Unknown character |
413 | Body over 25 MB |
415 | Unrecognised body type |
429 | Queue full. Retry after Retry-After seconds; nothing was lost. |
WS/v1/lipsync/stream
Audio streamed in, cues streamed back one pause-delimited slice at a time while later audio is still arriving. Use it for live speech: a microphone, a call, a TTS stream of your own.
The audio is raw PCM only: s16le, 16 kHz, mono, in binary frames of any size (100 ms = 3200 bytes is the natural unit). The rest of the conversation is JSON text frames:
β {"type":"start","text":"β¦","character":"β¦","extendedShapes":"GHX","slicer":{"maxSliceS":4}}
β {"type":"ready","streamId":"st_β¦","sampleRate":16000,"format":"pcm_s16le"}
β <binary pcm> <binary pcm> β¦
β {"type":"text","text":"the transcript so far"}
β {"type":"flush"}
β {"type":"slice-open","sliceIndex":0,"sliceStartS":0}
β {"type":"cues","sliceIndex":0,"sliceStartS":0,"sliceEndS":2.83,"cues":[β¦],"latencyMs":1373,"jobWallMs":1092,"holdMs":0}
β {"type":"end"}
β {"type":"done","streamId":"st_β¦","durationS":5.8,"slices":2,"cues":32}
Messages you send
| Message | Description |
|---|---|
start | Opens the stream. Optional text, character, extendedShapes, slicer. |
| binary frames | The audio. |
text | Replaces the transcript so far. Optional. |
flush | Cuts a slice now instead of waiting for a pause. Optional. |
end | No more audio. The server finishes the last slice, sends done and closes with 1000. |
Events you receive
| Event | Description |
|---|---|
ready | The stream is open. |
slice-open | The next slice's start is final, and the stream is silent from the previous slice's end up to it. See playing it back. |
cues | One slice's cues. Times are stream time (seconds since the first byte), never slice-relative. |
slice-error | One slice failed (queue_full or job_failed). Only that slice's cues are lost; the stream continues. |
done | The stream is finished. Carries failed and shed counts when any slice was lost. |
error | Sent before the socket closes on a mistake. |
Slicer options
slicer in start tunes the pause detector. Shorter maxSliceS gives earlier first cues at a small cost in accuracy; /v1/speak uses 220 ms and 4 s.
| Option | Default | Description |
|---|---|---|
minSilenceMs | 250 | How long a pause must be to cut a slice |
padMs | 170 | Audio kept on each side of a cut |
maxSliceS | 15 | Longest slice before a cut is forced |
minSpeechMs | Shortest slice worth analysing |
Closing and errors
- Closing the socket cancels the stream: slices still queued are withdrawn and nothing more is analysed.
- A protocol mistake closes the socket with
1008after anerrorevent; a server failure closes with1011. queue_fullsheds your own backlog first: when the engine's queue fills, the stream with the most slices waiting gives up its newest one. A stream sent far faster than real time sheds; a stream keeping pace is not turned away.- A stream can carry up to ten minutes of audio. On the demo key it carries 10 s and lives 30 s.
Playing it back
Start the playhead when the first cues event arrives, not when the audio starts, and keep a small buffer: a slice that hit maxSliceS can land late.
slice-open (on every streaming endpoint) lets a player cross pauses without stalling. It says the next slice's start is final and the audio up to it is silence, so move your buffer's frontier to sliceStartS and play on with the mouth at rest. Do not start the playhead on it.
Without slice-open, a player holds at every pause between two slices until the next slice's cues land: about 0.3 s per pause, 0.6 s at most.
POST/v1/speak
Text in, a character's voice and its mouth cues out, streamed together as the audio is made. This is where the two halves meet: the character's voice speaks the text and the streaming engine animates it as the audio arrives.
curl -N -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
-d '{"text":"Hi there!","character":"hallway-girl"}' https://vibed.video/v1/speak
Request
| Field | Description |
|---|---|
text | What to say, up to 2000 characters. |
character | A character slug; speaks in that character's voice. |
voiceId | Any ElevenLabs voice id, instead of character. |
modelId, voiceSettings | Optional ElevenLabs model and voice settings. |
emotion | neutral, warm, happy, sad, afraid, angry, embarrassed or wary: bends the voice, faster and less steady for angry, slower and flatter for sad, from wherever the character's own voice sits. Default neutral; anything else is a 400. meta echoes it. |
registers | true voices the text as a scene: narrator and character. Default false. |
Response
application/x-ndjson: one JSON event per line, in arrival order.
{"type":"meta","id":"sp_β¦","character":"hallway-girl","voiceId":"β¦","sampleRate":16000,"format":"pcm_s16le","emotion":"neutral","tts":"elevenlabs","lipsync":"rhubarb"}
{"type":"pcm","seq":0,"t0S":0,"b64":"β¦"}
{"type":"words","words":[{"word":"Hi","startS":0.05,"endS":0.2},β¦]}
{"type":"slice-open","sliceIndex":0,"sliceStartS":0.12}
{"type":"cues","sliceIndex":0,β¦}
{"type":"slice-error","sliceIndex":3,"sliceStartS":8.1,"sliceEndS":11.9,"code":"queue_full","message":"β¦"}
{"type":"done","durationS":5.85,"slices":2,"cues":32}
| Event | Description |
|---|---|
meta | The voice, the emotion, the audio format, and which voice provider and lipsync engine answered. |
pcm | 100 ms of s16le PCM, base64. t0S is its stream time. |
words | Exact word timings. |
slice-open, cues, slice-error | As on the lipsync socket. A slice-error carries the slice's bounds so a player can cross the gap with the mouth at rest. |
done | Finished; counts lost slices as failed and shed. |
error | The voice or the engine failed; carries message. Sent instead of done, last. |
Closing the connection cancels: the voice stops and queued slices are withdrawn.
Narrator and character
With registers: true a text is a scene. What is in "quotes" is the character speaking, in the character's voice, and only that moves the mouth. Everything outside quotes is narration, read by the narrator: the character's own narrator when it has one, otherwise the default. A character with an inner voice also has thoughts in (brackets), in its own voice with no mouth movement; for every other character brackets are narration. A text with no quotes at all is the character's spoken line, whole, and a *starred* run in it is narration. emotion bends the character and never the narrator. It works on POST /v1/speak and WS /v1/speak/stream alike, and without it nothing changes.
curl -N -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
-d '{"registers":true,"character":"hallway-girl","text":"She looks up from the cup. \"You came back.\" She almost smiles."}' \
https://vibed.video/v1/speak
{"type":"meta","id":"sp_β¦","voiceId":"sssnβ¦","registers":true,"narratorVoiceId":"6HXfβ¦",β¦}
{"type":"segment","index":0,"kind":"narration","startS":0,"text":"She looks up from the cup.","run":0,"voiceId":"6HXfβ¦"}
{"type":"pcm","seq":0,"t0S":0,"b64":"β¦"} β¦
{"type":"cues","sliceIndex":0,"sliceStartS":0,"sliceEndS":0.4,"cues":[],β¦} β¦
{"type":"segment","index":1,"kind":"speech","startS":1.9,"text":"You came back.","run":1,"voiceId":"sssnβ¦"}
{"type":"pcm","seq":19,"t0S":1.9,"b64":"β¦"} β¦
{"type":"slice-open","sliceIndex":4,"sliceStartS":1.9}
{"type":"cues","sliceIndex":4,"sliceStartS":1.9,"sliceEndS":2.9,"cues":[{"start":1.95,"end":2.1,"value":"B"},β¦],β¦}
{"type":"segment","index":2,"kind":"narration","startS":2.9,"text":"She almost smiles.","run":2,"voiceId":"6HXfβ¦"} β¦
{"type":"done","durationS":4.1,"slices":8,"cues":11,"segments":3}
It is one stream on one clock: segments play in written order, pcm is contiguous and every time (t0S, cue times, word times, slices) is stream time, so a player written for plain speak plays it unchanged.
| Event | With registers: true |
|---|---|
segment | New. Sent before that segment's audio: index, kind (narration, speech or thought), startS, text, run and voiceId. A segment ends where the next starts, or at done. A long run is cut at its sentences; segments of one run read as one line. |
cues | Speech has cues as usual. Narration and thought send cues with an empty list as their audio arrives, so a player's gate opens and its frontier moves on while the mouth stays at rest. sliceIndex rises over the whole stream, and done.slices counts these too. |
meta, ready | Add registers: true and narratorVoiceId. |
done | Adds segments. |
Usage counts the characters given to the voices: the quotes and brackets are not spoken. A segment's voice is X-TTS-Provider's as on any request. Text is capped as without the option. On the socket, bare text waits until a quote opens (it may yet be the spoken line, and a quote settles it as narration), break does nothing, and sentence and sentence-done are sent per segment.
WS/v1/speak/stream
Text streamed in, voice and cues streamed out. For an agent that talks while it thinks: send the text as your LLM writes it, and the voice starts at the first full stop instead of the last token.
Each sentence goes to the voice the moment it is complete, in order, with the previous sentence as context for intonation. The audio feeds one continuous lipsync stream, cut at every sentence end, so sentence one has cues while sentence two is still being spoken. The text you send is also the recogniser's transcript, so invented names lip-sync as well as ordinary words.
β {"type":"start","character":"hallway-girl","emotion":"happy"}
β {"type":"ready","streamId":"ss_β¦","sampleRate":16000,"format":"pcm_s16le","emotion":"happy","voiceId":"β¦"}
β {"type":"text","text":"Oh, hey! I'm Mika, and this is"}
β {"type":"text","text":" the streaming speak endpoint talking. Everyβ¦"}
β {"type":"sentence","index":0,"text":"Oh, hey! I'm Mika, β¦","startS":0}
β {"type":"pcm","seq":0,"t0S":0,"b64":"β¦"} β¦
β {"type":"words","sentence":0,"words":[β¦]}
β {"type":"slice-open","sliceIndex":0,"sliceStartS":0.12}
β {"type":"cues","sliceIndex":0,β¦}
β {"type":"sentence-done","index":0,"endS":3.1}
β {"type":"break"}
β {"type":"end"}
β {"type":"done","streamId":"ss_β¦","sentences":3,"durationS":21.1,"slices":7,"cues":103}
Messages you send
| Message | Description |
|---|---|
start | Opens the stream with character, or voiceId with optional modelId and voiceSettings. Optional emotion bends the voice for the whole stream, as on POST /v1/speak; an unknown one is refused with an error and 1008. registers: true voices the text as a scene, narrator and character. |
text | The next fragment of text, as it comes. |
break | Cuts a sentence now. Optional. |
end | No more text. The server finishes speaking, sends done and closes with 1000. |
Events you receive
| Event | Description |
|---|---|
ready | The stream is open; echoes the emotion. |
segment | With registers: true, before each segment's audio: narrator and character. |
sentence | A sentence was cut and sent to the voice. |
pcm, words, slice-open, cues | As on POST /v1/speak; all times are stream time. |
sentence-done | A sentence's audio is complete. |
done | Finished. |
error | Sent before the socket closes on a failure. |
Sentences are cut at ., !, ? and newlines once they are at least 24 characters long, so a short exclamation joins the next sentence. A stream can carry up to 6000 characters. Errors close the socket with 1008 (protocol or bad request) or 1011 (the voice or the engine failed), after an error event.
Performance
Measured with two warm workers, 227 characters fed at 30 characters per 120 ms: first audio 320 ms after the first full stop, first cues 350 ms after that, and cues stayed 100 ms ahead of the playhead for the whole 21 s stream.
One warm worker does about 0.7 s of work per second of speech, so a single-worker server falls behind a long stream. Sentences of about 150 characters and a worker pool sized for your concurrency are the two dials.
Start the playhead on the first cues event and hold at the cue frontier rather than let the mouth run ahead of its cues.
POST/v1/takes
Text in, one JSON answer out: a character's voice as an mp3 file, the words with their timings, and the mouth cues. Made for a pipeline that owns its own timeline, such as a video editor or a motion-graphics tool, and wants a file and two arrays to lay on it rather than a stream to play as it arrives. The voice is the same one POST /v1/speak streams, sentence for sentence.
curl -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
-d '{"text":"Filters now live in the sidebar.","character":"hallway-girl","offsetS":12.1}' \
https://vibed.video/v1/takes
Request
| Field | Description |
|---|---|
text | What to say, up to 2000 characters. |
character | A character slug; speaks in that character's voice. |
voiceId | Any ElevenLabs voice id, instead of character. |
modelId, voiceSettings | Optional ElevenLabs model and voice settings. |
emotion | neutral, warm, happy, sad, afraid, angry, embarrassed or wary: bends the voice, as on POST /v1/speak. Default neutral; anything else is a 400. |
extendedShapes | "GHX" (all nine shapes) or "" (the basic six). Default: the character's own set, else all nine. |
offsetS | Where the line starts on your timeline, in seconds, 0 to 86400 (default 0). Every word and cue comes back with it added, so 12.1 puts them where the line sits in your film. |
Response
200 with the take. Every time is in seconds on the audio's own clock plus offsetS; durationS is the audio's length, whatever the offset.
{"id":"tk_β¦","createdAt":"β¦","text":"Filters now live in the sidebar.","character":"hallway-girl",
"voiceId":"β¦","modelId":"β¦","emotion":"neutral","extendedShapes":"GHX","tts":"elevenlabs","lipsync":"rhubarb",
"durationS":2.18,"offsetS":12.1,"charsSpoken":32,
"audio":{"url":"/v1/takes/tk_β¦/files/tk_β¦.mp3","contentType":"audio/mpeg","bytes":26412,"sampleRate":48000},
"wordsExact":true,
"words":[{"word":"Filters","startS":12.15,"endS":12.6},β¦],
"cues":[{"start":12.1,"end":12.17,"value":"X"},{"start":12.17,"end":12.31,"value":"G"},β¦]}
| Field | Description |
|---|---|
id | The take's id, for GET /v1/takes/<id>. |
durationS | The audio's length. The mp3 is exactly this long. |
offsetS | The offset you sent, 0 when none. |
audio | The voice: an mp3 (48 kHz mono, 96 kbit/s constant bitrate) at url, bytes long. |
words | Every word of the text, in order: { word, startS, endS }. |
wordsExact | True when the word timings are the voice provider's own; false under a free local provider, which spreads the words evenly over the audio. |
cues | The mouth cues, { start, end, value } as everywhere (see mouth cues): one unbroken run over the whole audio. |
emotion, extendedShapes | What the take was made with. |
tts, lipsync | The voice provider that spoke and the lipsync engine that made the cues. |
charsSpoken | Characters sent to the voice provider: 0 when this exact text in this voice was spoken before. |
The cues are found on the voice as it was made, before it is compressed, and the mp3 carries the encoder's delay in its header, so it plays from the first sample: decoded, it lines up with words and cues exactly.
The same text in the same voice, emotion and settings is spoken once per account: asking again, with another offsetS or another alphabet, gives the same audio and spends nothing on voice. Its cues are kept with it too, once per engine and alphabet, so asking again with the same ones gives the same cues without analysing the audio again. An account keeps its most recently used voices, about three and a half hours of speech shared with its videos; a line that has fallen out of that is spoken again, and charsSpoken says so. A take is answered when it is complete, which takes about as long as the voice takes to make (a few seconds for a sentence). Closing the connection before then cancels it: the voice stops and nothing is kept.
Getting the file
GET /v1/takes/<id>/files/<id>.mp3 serves the mp3 (the path in audio.url), honours range requests, and takes ?download=1 to save it and ?key= for an <audio> tag.
GET/v1/takes/<id>
The take again, the same JSON the POST answered. Your newest hundred takes are kept.
Error codes
| Status | When |
|---|---|
400 | No text, more than 2000 characters, neither character nor voiceId, an unknown emotion, an offsetS that is not a number from 0 to 86400, or an extendedShapes other than "GHX" or "". |
404 | Unknown character, or a take that is not yours. |
429 | The lipsync queue is full. Retry after Retry-After: the voice is kept, so a retry spends nothing on it. |
502 | The voice provider failed; error says how. |
GET/v1/characters
Every character your key can use, ready to draw: your own first (including builds still running or failed), then the house cast that every key may use. A ready character is the full object GET /v1/characters/<slug> returns, with an avatar for a list and a preview that plays the character introducing itself, so one call is enough for a gallery. Its id is the slug that character takes on /v1/lipsync, /v1/speak, /v1/videos and both sockets.
curl -H "Authorization: Bearer $KEY" https://vibed.video/v1/characters
{
"characters": [
{ "id": "silver-haired-researcher", "status": "ready", "buildId": "402f08f35233",
"name": "Dr. Elara Vance", "tagline": "β¦", "owner": "<tenant>",
"avatar": "/v1/characters/silver-haired-researcher/assets/thumb.webp",
"preview": { "image": "β¦/viseme_X.webp", "audio": "β¦/intro.mp3", "cues": "β¦/intro.visemes.json" },
"extendedShapes": "GHX", "frame": { β¦ }, "geometry": { β¦ }, "assets": { β¦ }, "voice": { β¦ } },
{ "id": "9af996805d64", "status": "building", "buildId": "9af996805d64", "name": "9af996805d64", "owner": "<tenant>" },
{ "id": "hallway-girl", "status": "ready", "name": "Mika", "owner": "house", "avatar": "β¦", "preview": { β¦ }, β¦ }
]
}
| Field | Description |
|---|---|
status | ready, building or failed. A build that is not ready is a short entry: id (the build id), buildId, name, owner, status. |
buildId | Your characters only: the build, for following it. |
| everything else | As in the character object. |
When you have forked a house character, the list shows your fork, not the original: they share a slug, and the slug always means your fork.
GET/v1/characters/<slug>
One character's manifest: everything a renderer needs to draw and voice it.
curl -H "Authorization: Bearer $KEY" https://vibed.video/v1/characters/silver-haired-researcher
{
"id": "silver-haired-researcher", "name": "Dr. Elara Vance", "tagline": "β¦", "owner": "<tenant>",
"avatar": "/v1/characters/silver-haired-researcher/assets/thumb.webp",
"preview": {
"image": "/v1/characters/silver-haired-researcher/assets/viseme_X.webp",
"audio": "/v1/characters/silver-haired-researcher/assets/intro.mp3",
"cues": "/v1/characters/silver-haired-researcher/assets/intro.visemes.json"
},
"extendedShapes": "GHX", "frame": { "width": 400, "height": 600 },
"geometry": { "editRegion": [0.43, 0.32, 0.61, 0.40], "mouthFaceRatio": 0.078 },
"blink": { "editRegion": [0.36, 0.20, 0.68, 0.30] },
"breath": { "chin": 0.52, "head": 0.36, "chest": { "x": [0.15, 0.29, 0.71, 0.85], "y": [0.60, 0.71, 0.71, 1], "pivot": 1.58, "sy": 1.011, "sx": 1.005 } },
"emotions": [{ "id": "happy", "image": "β¦/emotions/happy.webp", "suppressBlink": false }, β¦],
"assets": {
"visemes": { "X": "/v1/characters/β¦/assets/viseme_X.webp", "A": "β¦", β¦ },
"blink": "β¦/blink.webp", "blinkClosed": "β¦/blink_closed.webp",
"emotions": { "happy": "β¦/emotions/happy.webp", β¦ },
"intro": { "audio": "β¦/intro.mp3", "cues": "β¦/intro.visemes.json" },
"stories": [{ "id": "β¦", "title": "β¦", "audio": "β¦" }],
"source": "β¦/viseme_source.png", "contactSheet": "β¦/CONTACT_SHEET.png",
"patches": {
"manifest": "β¦/patches/patches.json", "dims": { "w": 400, "h": 600 }, "scales": [1, 0.6, 0.4],
"sets": { "1": { "base": "β¦/patches/@1/base.webp", "layers": { "viseme_A": "β¦/patches/@1/viseme_A.webp", β¦ } }, "0.6": { β¦ }, "0.4": { β¦ } },
"layers": { "viseme_A": { "kind": "mouth", "id": "A", "rect": { "x": 166, "y": 186, "w": 80, "h": 56 }, "norm": { "x": 0.415, "y": 0.31, "w": 0.2, "h": 0.093 } }, β¦ },
"memory": { "frameMb": 0.9, "currentMb": 15.6, "patchedMb": 2.2, "ratio": 7 }
}
},
"voice": { "voiceId": "β¦", "modelId": "eleven_turbo_v2_5" }
}
| Field | Description |
|---|---|
id, name, tagline | The slug, and who the character is. |
owner | Your account id, or house. |
avatar | A small image for a list or a card: the resting portrait, 480 px wide. |
preview | What a card plays: image is the full resting portrait, and audio with cues is the character introducing itself in its own voice, lips in sync (absent when no intro was made). |
extendedShapes, frame, geometry | Which mouth shapes exist, the frame's size, and where the mouth is: geometry.editRegion is the mouth box as [x1, y1, x2, y2] fractions of the frame. |
blink | The eye box, the same way (editRegion), from the blink bake; null when the character has no blink overlay. |
breath | The idle breath's torso geometry, as the web SDK's breath.js takes it: chin and head are fractions of the frame's height, chest is the masked patch that moves (its x and y are the four stops of two crossed gradients, pivot the point it scales about, sx and sy the scale at a full inhale). false means the character was measured and does not breathe (no torso in frame); absent means it was never measured, and a renderer derives it from the mouth and eye boxes. |
emotions | The expression overlays in the bake's order, each with its image and suppressBlink: when true, the lids clash with that overlay and a renderer stops blinking while it is worn. |
assets | Every file: the mouth frames (visemes), blink and expression overlays, the intro, the narrated stories, and the patches. |
assets.patches | The same layers as a base frame plus a small patch per layer, at each of scales: sets["1"].base is the rest frame, sets["1"].layers.viseme_A the pixels that differ for that mouth, placed over the base at layers.viseme_A.norm (fractions of the frame; rect is the same box in pixels of dims). Scale 0.6 and 0.4 sets are the same cut, resized. Every patch recomposites to the full frame with no visible change, so a renderer that is short on memory draws from these instead of the full frames (memory says what it saves: currentMb for all layers decoded whole, patchedMb for the base plus patches). The rest mouth X is the base itself and has no patch. Absent when the character has no patch sets. |
voice | The character's voice, for voiceId on the speak endpoints. |
The manifest is everything a renderer needs, and the slug is what character accepts on /v1/lipsync, /v1/speak and both sockets. Assets are plain files under /v1/characters/<slug>/assets/β¦ and accept ?key= for media tags. The frames are WebP at the source's size, audited so nothing but the mouth changes between them; visemes has nine entries for "GHX" and six for "". The sidecar files the numbers come from (manifest.json, blink.json, emotions/emotions.json, patches/patches.json) are served as assets too, but nothing in them is missing from the manifest.
GET/v1/characters/<slug>/bundle
The whole character as one zip: the manifest and every file it names. For a renderer that draws the character itself, in a render worker or a film pipeline: nothing at render time depends on the service being up, and no key ends up in your project's source.
curl -H "Authorization: Bearer $KEY" -o hallway-girl.zip https://vibed.video/v1/characters/hallway-girl/bundle
unzip hallway-girl.zip -d hallway-girl
manifest.json at the zip's root is the character object with every file as a path relative to the zip's root ("./viseme_X.webp", "./patches/@1/base.webp"), never a URL and never a key, and the zip holds exactly the files it names: the mouth frames, the blink and expression overlays, every patch set, the avatar, the intro and the stories. The bake's lossless source frame and its contact sheet are left out, and the bundle's manifest has no source or contactSheet: nothing renders from them, and they would more than double the download (they stay on GET /v1/characters/<slug>). Unzipped, the folder is the character. A house character is 1.5 to 4.5 MB; the entries are stored, not compressed again, because the frames and the audio already are.
The answer carries an ETag: send it back as If-None-Match and an unchanged character is a 304 with no body. A build id works too once the build is ready; before that it is a 409 whose body is the build's status, as GET /v1/characters/<id> answers it. In Node, the web SDK's downloadCharacter(slug, dir) fetches and unpacks it in one call.
POST/v1/characters
A photo in, a complete character out: nine mouth frames, blink and expression overlays, a persona, a voice and a spoken intro. Your characters belong to your account and only your keys can see them.
# start a build: the raw image as the body, or multipart "photo"
curl -H "Authorization: Bearer $KEY" -H 'content-type: image/jpeg' --data-binary @photo.jpg \
https://vibed.video/v1/characters
# β 202 { "id": "9af996805d64", "status": "building", "urls": { status, events, retry, assets } }
curl -H "Authorization: Bearer $KEY" https://vibed.video/v1/characters/9af996805d64 # poll
curl -N -H "Authorization: Bearer $KEY" https://vibed.video/v1/characters/9af996805d64/events # live (SSE)
A build takes about three minutes, and one runs at a time per server: a second POST while one runs answers 409 with Retry-After. ?stylize=always or ?stylize=never overrides the redraw decision below.
What happens to the photo
- A real photograph is redrawn as an anime portrait. A recognisable person cannot be redrawn from the image, so the model draws an original character from a description of it instead.
- Anything already drawn, rendered or 3D is kept exactly as it is.
- An explicit image is worked on through a shoulders-up crop.
Following a build
GET /v1/characters/<id> answers the build's status, with every stage (assess, stylize, sheet, visemes, blink, breath, emotions, patch, voice, stories, intro, finalize), its timings and, on failure, the error. POST /v1/characters/<id>/retry resumes from the failed stage without uploading again.
GET /v1/characters/<id>/events is a server-sent event feed: a state event per stage transition and a log event per step. Add ?voice=1 and the character comments on its own build as pcm and cues events.
When it is ready
Once status is ready, the character is in GET /v1/characters under its slug, and its manifest is at GET /v1/characters/<slug>. The build's own status (GET /v1/characters/<id>) carries the same manifest as character.
POST/v1/videos
Text in, a video of a character saying it out: the face in a circle on a flat key colour, lips in sync, blinking and breathing. Made for a narrator on someone else's video, such as a product demo or a walkthrough, where the caller cannot draw the face. One scene or a batch; every scene is its own file.
curl -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
-d '{"character":"silver-haired-researcher","size":480,"scenes":[
{"id":"intro","text":"Hi! Let me show you what we shipped this week."},
{"id":"filters","text":"Filters now live in the sidebar.","emotion":"happy"}]}' \
https://vibed.video/v1/videos
A render takes about as long as the video it makes, so the answer is a job (202):
{"id":"vid_β¦","status":"queued","queuePosition":1,"tts":"elevenlabs",
"scenes":[{"id":"intro","character":"β¦","text":"β¦","status":"queued"},β¦]}
Request
scenes is a list of scenes. The same fields on the body are defaults for every scene that leaves them out, and a body with text and no scenes is a single scene.
| Field | Description |
|---|---|
character | One of yours or the house cast (GET /v1/characters). |
text | What the character says: up to 3000 characters a scene, 8000 a job. All of it is spoken in the character's own voice, with no narrator or stage directions. |
id | Names the scene's files: letters, digits, ., -, _; not manifest or job. Defaults to scene-01, scene-02, β¦ |
size | The circle's diameter in pixels, which is also the video's width and height. 64 to 1080, default 512. |
zoom | Tighter (above 1) or wider (below 1) on the face. At 1 the circle shows the head and a strip of shoulders, whatever the character's framing. |
emotion | neutral, warm, happy, sad, afraid, angry, embarrassed or wary: the expression for the whole scene, and a bend on the voice. |
bg | The key colour around the circle, default #00FF00. Pick another for a green character. |
fps | Frame rate, 10 to 60, default 60. 23.976, 29.97 and 59.94 are encoded as the exact broadcast rates. |
lead, tail | Seconds on screen before the first word (0.3) and after the last (0.5). |
seed | Where the blinks fall: an integer from 0 to 4294967295. The same seed blinks at the same instants in every render, and at the instants the web SDK's frame model gives that seed (see Rendering offline). Default: one per scene, from its character and text, so a scene rendered again blinks the same. |
There is no alpha channel: key the colour out, or mask with the circle the script names.
A request that cannot render (an unknown character, an empty text, a repeated id) is a 400 naming every problem in the batch, before anything is spoken. Up to three jobs per account can wait or render at once (429 past that); one renders at a time.
Getting the files
Poll GET /v1/videos/<id> until status is done or failed; each scene carries its own queued, running, done or failed. A finished scene lists its files:
{"id":"intro","status":"done","durationS":4.7,
"video":"/v1/videos/vid_β¦/files/intro.mp4",
"script":"/v1/videos/vid_β¦/files/intro.json",
"srt":"/v1/videos/vid_β¦/files/intro.srt","vtt":"/v1/videos/vid_β¦/files/intro.vtt"}
| File | Contents |
|---|---|
<id>.mp4 | The clip: H.264 + AAC, size Γ size. The one to edit with. |
<id>.webm | preview: the same clip as VP9 + Opus, for browsers with no H.264 decoder. Made on first request. |
<id>.json | The script: every timing, below. |
<id>.srt, <id>.vtt | Captions. |
manifest.json | The whole batch. |
GET /v1/videos/<id>/files/<name> serves them, honours range requests, and takes ?download=1 to save and ?key= for a <video> tag.
The script
<id>.json is what an editor or another agent cuts with. Every time is in seconds on the clip's own clock:
{"id":"intro","character":"β¦","text":"β¦","emotion":"neutral",
"width":480,"height":480,"fps":60,"frames":282,"durationS":4.7,
"background":"#00FF00","circle":{"cx":240,"cy":240,"r":240},
"speech":{"startS":0.3,"endS":4.2},
"seed":7,"phase0":-0.0705,"lines":[{"start":0.3,"end":4.2}],"blinks":[2.02],
"tts":"elevenlabs","wordsExact":true,
"sentences":[{"text":"Hi!","startS":0.3,"endS":0.71,"words":[0,1]},β¦],
"captions":[β¦],
"words":[{"word":"Hi!","startS":0.3,"endS":0.71},β¦],
"cues":[{"start":0.3,"end":0.37,"value":"B"},β¦]}
captions are the sentences cut to subtitle length, the same as the .srt. wordsExact is true when the word timings are the voice provider's own and false under a local provider, which spreads the words evenly over the audio.
seed, phase0 and lines are what the frames were decided by. With cues and emotion they are the inputs of createTimeline in the web SDK's frame.js, so createTimeline({ manifest, cues, lines, emotions: emotion, seed, phase0 }).frame(k, fps) is frame k's state exactly: the mouth, the lids, the breath and the expression the server painted (see Rendering offline). phase0 is the breath's phase at 0, set so the line opens on a fresh inhale. lines is when the character speaks: the whole voice, not the cues, which start after the voice's own leading silence. blinks lists when the lids start to close, rounded to the millisecond; one may start just before 0, and there are none while an expression that holds the lids open is worn or for a character with no blink overlay. fps is rounded to three decimals: 23.976, 29.97 and 59.94 clips run on exactly 24000/1001, 30000/1001 and 60000/1001, so pass those to frame().
The same words by the same character are spoken once per account: rendering again at another size, zoom or background makes new video and spends nothing on voice (charsSpoken on the job says what was spent). An account keeps its most recently used voices, about three and a half hours of speech shared with its takes; a scene whose voice has fallen out of that is spoken again.
GET/v1/videos
Your video jobs, newest first, each in the same shape as GET /v1/videos/<id>. The newest twenty are kept.
{ "videos": [{ "id": "vid_β¦", "status": "done", "createdAt": "β¦", "finishedAt": "β¦", "totalDurationS": 6.9,
"charsSpoken": 0, "manifest": "/v1/videos/vid_β¦/files/manifest.json", "scenes": [ β¦ ] }] }
Account and health
Two calls for checking your setup, who a key belongs to and what the server offers, and the public demo key the home page's live demos run on.
GET/v1/me
Your account id and the key's id. The first call to make with a new key.
GET/v1/health
No key needed. The server's version, database and worker pool, plus:
| Field | Description |
|---|---|
tts | The default voice provider ({ provider, label, billed }), available (what a request may ask for) and switchable. |
lipsync | The default lipsync engine ({ engine, label, about }) and its own available list. |
ledger | Usage records the server's database refused since it started: refused in all, and byKind, by kind of work and error class. Your usage is counted from these records, so anything but 0 means some of it went unrecorded. |
The demo key
The live demos on vibed.video's home page run on a public key, so a visitor needs no account. GET /api/version publishes it as demoKey, or null when the server offers none. Since anyone can read it, it opens one door, WS /v1/lipsync/stream, and only under the caps below. Everything else needs a key of your own from the console.
Every other door answers the demo key with 403: every endpoint under /v1, asset URLs with ?key=, and the WS /v1/speak/stream upgrade, refused before the handshake. The body's error names the one door the key opens:
{ "error": "the demo key opens WS /v1/lipsync/stream and nothing else; make your own key at /console for the rest of the API" }
GET /v1/health needs no key and answers as usual.
On the lipsync socket, part of the request is fixed whatever it asks for:
- Engine. The server's default.
X-Lipsync-Engineand?lipsync=are ignored rather than refused, andreadynames the engine inlipsync. - Slicer.
start.sliceris ignored. The stream cuts at a 220 ms pause and forces a cut at 4 s; the other options keep their defaults. - Character.
start.character, when given, must be one of the house cast: the charactersGET /v1/characterslists withowner: "house". A character built or forked on an account is refused.start.textandextendedShapeswork as they do on any key.
| Cap | Limit |
|---|---|
| Audio per connection | 10 s, 320,000 bytes of PCM |
| Audio per day | 1000 s, shared by every demo connection, reset at midnight UTC |
| Analyses at a time | 1 demo connection, server-wide |
| Open connections | 2 per client address |
| New connections | 6 per client address per 10 minutes |
| Connection lifetime | 30 s from the upgrade |
start.text | 500 characters |
| Binary frame | 64 KB |
flush | 5 per connection |
| Messages | 1 start, no text message, nothing after end |
At the upgrade, a connection over a cap is refused before the handshake with 429, a Retry-After header in seconds and a JSON body whose reason says which cap:
{ "error": "live analysis is busy: the demo key runs one analysis at a time on this server; try again in a few seconds, or make your own key at /console", "reason": "busy" }
reason | Cap | Retry-After |
|---|---|---|
quota | Audio per day | Until midnight UTC |
rate | Open connections | 5 s |
rate | New connections | Until the oldest of the six is 10 minutes old |
busy | Analyses at a time | 5 s |
The day's audio is checked first, then the address's caps, then the server-wide one. A refused attempt does not count toward the address's six. A browser's WebSocket never sees the upgrade's status or body: a refused socket fires error and closes with 1006.
On the socket, a cap ends the stream in one of three ways, and none of them carries a Retry-After:
- The audio caps finish it. The frame that crosses the connection's 10 s, or the day's last second, is cut there and later audio is dropped. The stream then ends as if
endhad arrived: the last slice's cues,donewithcapped: trueandcap("audio"or"quota"), and a1000close. - Every other cap closes it. An
errorwithcode: "demo_limit"andcap, then a1008close.capis"lifetime"(30 s from the upgrade, whatever the stream is doing),"text","frame","flush"(the sixth) or"message"(a secondstart, atextmessage, anything afterend). - A character outside the house cast is refused. An
errorwithcode: "demo_scope"andstatus: 403, then a1008close.
β {"type":"done","streamId":"st_β¦","durationS":10,"slices":3,"cues":41,"capped":true,"cap":"audio"}
β {"type":"error","code":"demo_limit","message":"a demo key connection lives 30 s; β¦","cap":"lifetime"}
A demo connection holds its slot until its work settles: the socket closed, and every slice it queued analysed or withdrawn. A client that drops a connection mid-analysis and reconnects at once can be refused as busy.
Request headers
Optional headers that change how one call is handled. Where a header cannot be set (a browser socket), use the query parameter.
| Header | Query | Description |
|---|---|---|
X-TTS-Provider | ?tts= | Speak with another voice provider for this call. |
X-Lipsync-Engine | ?lipsync= | Find the mouth with another engine for this call. |
X-Usage-Tag | A label written on the call's usage record, to find a batch of calls later. |
Voice provider
X-TTS-Provider works on POST /v1/speak, POST /v1/takes, POST /v1/videos, POST /v1/characters (the build's intro, stories and commentary) and the WS /v1/speak/stream upgrade. Besides the default, a server may offer free local providers: mac (macOS speech, the real words in a stand-in voice; only on a Mac server) and mock (the character's own recorded clips cut to the text's length, so the words are wrong). Neither is the character's real voice. meta.tts on /v1/speak, tts on a take and the usage record say which provider spoke.
A provider the server does not have, or a billed one where the server's default is free, is a 400, never a silent fallback.
Lipsync engine
X-Lipsync-Engine works on POST /v1/lipsync, POST /v1/speak, POST /v1/takes, POST /v1/characters (the build's commentary) and both socket upgrades. Engines cost nothing, so any engine the server has may be asked for; GET /v1/health lists them, and one it does not have is a 400. Every answer names the engine that made its cues: lipsync on the /v1/lipsync response, on /v1/speak's meta, on a take and on both sockets' ready.
SDKs
An SDK puts a character on your screen saying a text with its mouth in sync, in a dozen lines, on your API key. The web SDK is the same set of files the vibed.video app and the console's Studio render with, so what you get is what the product shows: plain ES modules, no dependencies, no build step. The iOS SDK is that render model as a Swift package and the Android SDK the same as a Kotlin module, both graded against the same recordings.
Web
Three ways to get it, all the same files:
- Download
vibed-sdk.zipand unzip it; the directory is an npm package, sonpm install ./vibed-sdkin your project gives youimport { VisemeClient } from 'vibed-sdk'andimport { mountCharacter } from 'vibed-sdk/web', with TypeScript declarations beside every module. - Import from the server:
import { VisemeClient } from 'https://vibed.video/sdk/client.js', no install at all. Every module is at/sdk/<file>, and it works from any origin:/sdkand/v1answer with CORS*. - The console's SDKs page has the download, the snippet below with your own key filled in, and the runnable example page.
Say a line:
<link rel="stylesheet" href="https://vibed.video/sdk/stage.css">
<div id="stage" class="char-stage" style="width: 480px; aspect-ratio: 1"></div>
<button id="say">Say it</button>
<script type="module">
import { VisemeClient } from 'https://vibed.video/sdk/client.js';
import { mountCharacter } from 'https://vibed.video/sdk/talker.js';
const api = new VisemeClient({ key: 'vk_β¦', baseUrl: 'https://vibed.video' });
const her = mountCharacter(document.getElementById('stage'), api, 'hallway-girl');
document.getElementById('say').onclick = async () => {
await her.say('Hello there. Nice to meet you.', { emotion: 'happy' }); // resolves when the line has played out
};
</script>
The modules:
| Module | Import | What it is |
|---|---|---|
client.js | vibed-sdk | VisemeClient: every endpoint in this reference on a key. Browsers and Node 22+, no DOM. One file with no imports, so it can be taken alone. |
talker.js | vibed-sdk/web | mountCharacter() and Talker: a character in your element that says a text, speaks as your model writes, or lip-syncs your audio. |
stage.js | vibed-sdk/web | CharacterStage: the character's layer stack (nine mouths, blink, expressions, breath) in a host element, lit from a cue timeline. |
stream-voice.js | vibed-sdk/web | StreamedSpeech: a stream's audio and cues on one clock, held at the cue frontier so the mouth never runs ahead. |
pcm-player.js | vibed-sdk/web | PcmPlayer: 16 kHz PCM chunks on a WebAudio clock. |
breath.js | vibed-sdk/web | The idle breath: geometry derived from the character's manifest, and the loop that moves only the chest. |
frame.js | vibed-sdk/frame.js | The character at one instant as data, and a painter for any 2D canvas: see Rendering offline. Also in vibed-sdk/web. |
stage.css | vibed-sdk/stage.css | The stage's layer mechanics. Link it on any page that mounts a stage. |
The Talker is the one call. mountCharacter(el, api, slug) loads the character's frames through the API's asset URLs and returns a Talker: say(text, { emotion }) opens a speak stream, plays the voice as it arrives and moves the mouth on its cues, resolving when the line has played out (the emotion sets the face and bends the voice; an id outside the voice's eight, VOICE_EMOTIONS in breath.js, still sets the face and the line is spoken neutral rather than refused); speakStream() is the same wiring for a text your model is still writing (s.text(piece) as it comes, s.end() when done); lipsync({ text }) is the same for your own audio (l.audio(int16) sends 16 kHz PCM for cues and plays it here). hold(true) pauses, stop() cancels, unmount() lets the layers go. Call say() from a click the first time: that is what unlocks audio in a browser.
The client. VisemeClient is every endpoint in this reference, one method each, and a few of them are made for a pipeline that owns its own timeline. lipsync(audio, { text, offsetS }) answers the cues already on your clock. speak({ text, character, emotion }) and speakStream({ character, emotion }) bend the voice the way say() does. takes({ text, character, offsetS }) is a whole line in one answer: the voice as an mp3 at audio.url (fileUrl() puts the key on it for a tag or a download), its words and its cues, all already on your clock; take(id) is the same answer again. bundle(slug) is the character as one zip (an ArrayBuffer), and in Node downloadCharacter(slug, dir) fetches and unpacks it into a folder: manifest.json with every file as a relative path, and the files beside it, so a render worker reads the character from disk with no key and no network. Every call throws a VisemeError with the HTTP status on a refusal.
Your own cues and manifest. The pieces come apart. CharacterStage renders any manifest shaped like GET /v1/characters/<slug> and lights the mouth from any cue list in the mouth cues shape, so cues you made with POST /v1/lipsync ahead of time, or on another server, drive it with stage.render(tS, cues) on your own clock. An unzipped bundle on any static host is such a manifest: stage.load(slug, { base: '/path/to/folder' }) reads the expressions and geometry from it and asks for no other JSON than patches/patches.json. StreamedSpeech takes a socket's pcm and cues events from whatever transport carries them, and PcmPlayer plays 16 kHz PCM from anywhere. The stage asks the host how its images should load: the load's first request, manifest.json, is a CORS fetch() to the same base. Where the host answers it, with any status (the page's own origin, the API's /v1/, a CDN that sends Access-Control-Allow-Origin), every image loads with crossOrigin = 'anonymous', so a canvas can read the layers back; where it does not, in no CORS mode, so frames you serve from a host that sends no CORS header still load (its JSON files cannot be read from another origin without one either, so there the stage draws full frames, with no breath or expressions); load(slug, { crossOrigin }), or the same option to mountCharacter, sets it to 'anonymous' or null yourself.
Reproducible idle motion. CharacterStage.load(slug, { seed, clockOrigin }), and the same two options to mountCharacter, make the blinks and the breath reproducible. With a seed the stage blinks on frame.js's schedule for that seed and starts its chest at the seed's breath phase: two stages with the same seed blink together, and a stage blinks with a POST /v1/videos render or an offline render that uses the same seed. t = 0 is clockOrigin, in performance.now() milliseconds; by default it is the moment the load installs the character. Pass your own to line the stage up with a film or with another stage, earlier or later than the mount. A seed is an integer from 0 to 4294967295, the range POST /v1/videos takes; any other value (1.5, -1, 2^32 + 7, a string) rejects the load with a TypeError before the stage changes, rather than blinking on some other seed's schedule. Without a seed (or with null) the stage draws one of its own, which stage.seed reads (pass it to another stage or to a render to reproduce this one's idle motion), so two characters on one page never blink or breathe in lockstep. A stage given a seed does not speed its blink or its breath up while a Talker waits for a reply; one that drew its own does.
Drawing it yourself. frame.js is the same character as data you sample at any time, with painters for a canvas, for a renderer that paints frame by frame instead of mounting a stage. Rendering offline is the recipe, and /sdk/offline.html is it as a page you can run.
What the character is doing
Every SDK's Talker reports one status, with the same ids and the same rules, so an app can always show what the character is doing: status for now, statusDetail for why and how well, onStatus for each change (in order, never at subscribe).
| Status | What it means | What to show |
|---|---|---|
loading | The character is loading. | A placeholder or spinner on the stage. |
idle | Loaded, no line. | Nothing; the character breathes and blinks. |
connecting | A line started, the server has not answered yet. | A subtle "connecting" hint. |
thinking | The server answered, the voice has not started. | A thinking indicator. |
speaking | The voice is playing and the mouth moves. | Nothing, or a stop button. |
narrating | The voice is playing and the mouth rests: a registers line's narration or thought. segmentKind tells them apart. | Nothing, or the narration as a caption. |
buffering | Frozen: the next cues have not arrived, so the mouth and voice wait together. | After a moment, "buffering". |
paused | Your hold(true). | Your play button. |
needs-tap | Web only: the browser wants a user gesture before it plays audio. | A "tap to listen" button that calls unlock(). |
stalled | The player waits and nothing has come from the server for stallAfterS (8 s by default, 0 turns it off). Nothing is cancelled and the next event clears it. | "Taking longer than usual", with a retry or stop: your call. |
finished | The line played out; stays until the next line or stop(). | Ready for the next line. |
failed | A rejected load, a stream error or a socket the server or the network closed early. reason says why, close code included. Your own close() on a stream is not a failure: idle, or finished if it played out. stop() gives idle after a failed line. | The error, with a retry. |
statusDetail adds reason (on failed and stalled), degraded (a slice was lost, or the line froze for more than 2 s in total: the words are right, the mouth may have rested through part of them), lostSlices, bufferingS and lastEventAgoS, and on a registers line segment (index, kind, text) and segmentKind, also while buffering or paused. onSegment fires as the playhead enters each segment. say(text, { registers: true }) on the web, say(text, registers: true) on iOS and Android, or registers in speakStream's start. stalled watches the server, so a speakStream() you feed more slowly than stallAfterS, or a lipsync session with no speech for that long, reads it too: raise the option or turn it off for those.
Rendering offline
For a renderer that paints the character one frame at a time instead of letting a browser animate it: a canvas painted by seek(t) in a film or motion-graphics pipeline, a worker, a Node script. frame.js (at /sdk/frame.js, and in the download as vibed-sdk/frame.js) is the character at one instant as a pure function of time: which mouth, how far the lids are closed, how full the chest is, which expressions show and how strongly. It has no DOM, no timers and no randomness of its own, so it runs in a page, a worker or Node unchanged. POST /v1/videos decides every frame of a clip with it, and a live stage given a seed follows it too.
Four steps: get the character, get cues on your clock, build a timeline, paint it.
The character
- As files.
GET /v1/characters/<slug>/bundleis the character as one zip, and in NodedownloadCharacter(slug, dir)unpacks it into a folder:manifest.jsonwith every file as a relative path, and the files beside it. A render worker then reads the character from disk, with no key and no network. - From the API.
character(slug)is the manifest with every file under/v1/characters/<slug>/assets/, each loaded with?key=on it. In a browser, load every image withcrossOrigin = 'anonymous', or the canvas you paint it on cannot be read back (see below).
Cues on your clock
- For your own audio,
POST /v1/lipsyncwithoffsetSanswers the cues already where the line sits in your film. - For the character's voice,
POST /v1/takesanswers the voice as an mp3, its words and its cues in one call, all on your clock.
For several lines, put their cues in one list in time order. A take's or a speak stream's emotion bends the voice, and the timeline's emotions set the face: give both the same id and the face matches the voice, as say() does.
The timeline
import { createTimeline } from 'https://vibed.video/sdk/frame.js';
const tl = createTimeline({ manifest, cues, seed: 7 });
tl.frame(k, 30); // frame k at 30 fps
tl.at(1.37); // the instant 1.37 s
| Input | Description |
|---|---|
manifest | The character, required: GET /v1/characters/<slug>, or a bundle's manifest.json. What it has baked decides which expressions show and whether it breathes. |
cues | Mouth cues on your clock, in the mouth cues shape, sorted by start. |
lines | [{ start, end }]: when the character speaks. Default: read off the cues, spoken cues less than 1 s apart being one line. |
emotions | An expression worn throughout ('happy'), or spans [{ start, end?, id }] sorted by start. Default 'neutral'. |
seed | Where the blinks fall, an integer. Default 0. |
phase0 | The breath's phase at 0, or 'inhale' to open the first line that starts in the clip on a fresh inhale. Default: drawn from the seed. |
Inside a line the breath is faster and shallower, and a line opens on a fresh inhale. phase0: 'inhale' puts the bottom of an exhale where the first line starts, whatever expressions are worn before it, which is what POST /v1/videos asks for; inhalePhase0(t, emotion) is the same number for a line at t with one expression worn from 0. A span with no end lasts until the next one, and the gaps between spans are neutral. A change of expression crossfades over 140 ms, and an expression the character has not baked is worn as neutral. emotionSpansFor(lines) turns lines that carry an emotion field into spans by the Talker's rule: on from the line's start, held 3 s past its end, replaced at once by the next line's.
A state:
{ "shape": "C", "speaking": true, "blink": 0, "breath": 0.46, "emotion": "happy", "overlays": [{ "id": "happy", "alpha": 1 }], "seed": 7 }
| Field | Description |
|---|---|
shape | The mouth frame to draw (assets.visemes[shape]), X at rest. |
speaking | Inside a line. |
blink | The blink overlay's opacity, 0 to 1. Already 0 while an expression with suppressBlink is worn. |
breath | How far the chest is through its rise; chestScale(tl.rig, breath) is the chest's scale about its pivot. |
emotion | The expression worn. |
overlays | The expression overlays to draw, in order, each { id, alpha }: one at rest, two mid-crossfade. |
seed | The seed the blinks were drawn from. |
frame(k, fps) is how a renderer working in frames asks: the mouth comes from a frame rule that keeps every spoken cue on screen for at least one frame at any rate, and everything else is sampled at the frame's midpoint, (k + 0.5) / fps. at(t) is a point sample, exact for the mouth only at 25 fps and up: below that a frame is longer than the shortest cue, and a cue can fall between two samples. frames(count, fps) is every frame from 0.
Also exported: cueAt(cues, t), linesFromCues(cues), blinkAt(t, seed), blinkTimes(durationS, seed) (when the lids start to close), blinkFrom(t, seed) (the blink at or after t, for a player that arms timers instead of sampling), breathPhase0(seed) (the default phase0), seedOf(string) (a seed from any string; a video scene's default is its character and text), isSeed(x) and toSeed(x) (whether x is an integer 0-4294967295, and x or a TypeError: the check the stage and POST /v1/videos make), stateAt(t, cues, options) (one state without keeping a timeline), headBox(manifest, { zoom }) (the square POST /v1/videos frames its circle on, in frame pixels) and rigFromManifest(manifest). A timeline also has breathAt(t) and blinks(durationS).
Painting
frame.js also paints what it computes, on any 2D canvas context: a page's <canvas>, an OffscreenCanvas in a worker, @napi-rs/canvas in Node. It touches no DOM itself: you hand it how to load an image and how to make a canvas. The stack is the one the live stage and POST /v1/videos paint, in their order: the mouth, the chest scaled about its pivot (the breath), the expressions at their opacity, the blink.
loadLayers(manifest, loadImage, options)loads a character's layers once.loadImage(src)is yours and returns a promise of anythingdrawImagetakes. The manifest's paths are resolved againstbase: a bundle's./viseme_X.webpgoes under the folder, and the API's/v1/characters/<slug>/assets/...goes on the API's origin withquery(key=<your key>) on the end, since an image cannot send a header;url(path)replaces the resolution entirely. By default it draws from the character's patch set (one base frame plus a small crop per layer, a fraction of the memory) and picks the smallest set that coversboxWxboxHdevice pixels atdpr, or the largest when no box is given;patches: falseloads full frames andpatches: 0.6that one set.emotionsis'all'(the default), a list of ids, orfalse. WithmakeCanvas(w, h)it also builds the chest, so the character breathes. If an image fails to load, the call rejects and names the URL.paintFrame(ctx, layers, manifest, state, { x, y, w })paints one state with the frame's top-left at (x, y),wwide; the height follows the frame. Full frames and the full-size patch set paint the same picture.paintCircle(ctx, layers, manifest, state, { cx, cy, d, zoom, bg })frames it the wayPOST /v1/videosdoes: the head and a strip of shoulders in a circle of diameterdcentred at (cx, cy), withbgin the corners.chestPatch(manifest, restImage, makeCanvas)is the chest layer on its own, for layers you put together yourself, andassetUrl(path, base, query)is the resolverloadLayersuses. It never puts the key on a URL that already has a scheme.chestMaskAt(chest, u, v),chestPaintedAt(chest, scale, u, v)andchestSourceAt(chest, scale, u, v)are the chest as numbers, for a painter with no 2D context that resamples by hand (POST /v1/videospaints its chest with them): the mask's opacity at a point of the frame, where the breath paints a point of the copy, and the copy's point under a painted one. Points are fractions of the frame,chestisrig.breath.chestandscaleischestScale(rig, state.breath).
In Node, from a downloaded folder:
import { readFile } from 'node:fs/promises';
import path from 'node:path';
import { createCanvas, loadImage } from '@napi-rs/canvas';
import { VisemeClient } from 'vibed-sdk';
import { createTimeline, loadLayers, paintCircle } from 'vibed-sdk/frame.js';
// Once; after that the folder is the character.
await new VisemeClient({ key: process.env.VIBED_KEY, baseUrl: 'https://vibed.video' }).downloadCharacter('goth-girl', 'goth-girl');
const manifest = JSON.parse(await readFile('goth-girl/manifest.json', 'utf8'));
const layers = await loadLayers(manifest, (src) => loadImage(src), { base: 'goth-girl', makeCanvas: (w, h) => createCanvas(w, h) });
const { timeline } = JSON.parse(await readFile(path.join('goth-girl', manifest.assets.intro.cues), 'utf8'));
const tl = createTimeline({ manifest, cues: timeline.cues, emotions: 'happy', seed: 7 });
const canvas = createCanvas(512, 512);
const ctx = canvas.getContext('2d');
for (let k = 0; k < 6 * 30; k++) {
ctx.clearRect(0, 0, 512, 512);
paintCircle(ctx, layers, manifest, tl.frame(k, 30), { cx: 256, cy: 256, d: 512, bg: '#00ff00' });
// await canvas.encode('png'), or ctx.getImageData(0, 0, 512, 512).data to ffmpeg -f rawvideo -pix_fmt rgba
}
In a browser, on your own origin:
import { VisemeClient } from 'https://vibed.video/sdk/client.js';
import { assetUrl, createTimeline, loadLayers, paintFrame } from 'https://vibed.video/sdk/frame.js';
const API = 'https://vibed.video';
const key = 'vk_β¦';
const query = `key=${encodeURIComponent(key)}`;
const manifest = await new VisemeClient({ key, baseUrl: API }).character('goth-girl');
const loadImage = (src) => new Promise((resolve, reject) => {
const img = new Image();
img.crossOrigin = 'anonymous'; // before src, or the canvas cannot be read back
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`could not load ${src}`));
img.src = src;
});
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
const layers = await loadLayers(manifest, loadImage, {
base: API, query,
makeCanvas: (w, h) => new OffscreenCanvas(w, h),
boxW: canvas.width, boxH: canvas.height,
});
const { timeline } = await (await fetch(assetUrl(manifest.assets.intro.cues, API, query))).json();
const tl = createTimeline({ manifest, cues: timeline.cues, seed: 7 });
function seek(t) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
paintFrame(ctx, layers, manifest, tl.at(t), { w: canvas.width });
}
seek(1.37);
crossOrigin = 'anonymous' is what keeps the canvas yours. Every /v1 and /sdk response carries Access-Control-Allow-Origin: *, but a browser only asks for it when the <img> does. Without the attribute the picture still draws, but the canvas is tainted, and getImageData and toBlob throw a SecurityError. /sdk/offline.html is this example, runnable, with a time slider, the intro played, an expression change and the canvas read back; a copy of it served from your own origin takes ?api=https://vibed.video.
What is the same everywhere
- The state. For the same manifest, cues, lines, emotions, seed and phase0,
frame(k, fps)andat(t)answer the same on every machine and in every JavaScript engine: plain arithmetic and a seeded generator, never the clock orMath.random. - The pixels, on one canvas implementation: the same state paints the same bytes on every run and from any folder. Different implementations (two browsers, two GPUs,
@napi-rs/canvas) each resample the art their own way, so their pixels can differ slightly where the picture does not. - A
POST /v1/videosclip. Its script carriesseed,phase0andlinesbesidecues,emotionandfps, socreateTimeline(...).frame(k, fps)is the state the server painted frame k with. The server composites with its own resampler and the mp4 is compressed, sopaintCircleof that state is the server's frame apart from the resampling, not byte for byte. - A live stage loaded with the same
seedlights the blinks the timeline has at the samet(each edge armed for its absolute time, so a late timer never shifts the schedule), showscueAt(cues, t)for the mouth, and starts its chest atbreathPhase0(seed). The breath then follows the same rules for as long as the page drives idle and speaking the way the timeline'slinesdo. The Talker's thinking beat before a line's first cues has no offline counterpart.
iOS
VibedSDK is a Swift package, iOS 16+, with no dependencies: the same character files and the same cue shape as the web, a stage view with the nine mouths, blink, expressions and breath, the speak and lipsync sockets, a player on AVAudioEngine that holds at the cue frontier, and a Talker that wires them. Frames are decoded once at the view's size, and a character with patches is about 10 MB on screen.
- Download
vibed-sdk-ios.zipand unzip it; thevibed-sdk-iosfolder is a Swift package. In Xcode, File > Add Package Dependencies > Add Local and pick that folder; in aPackage.swift,.package(path: "../vibed-sdk-ios")and the productVibedSDK. SPM cannot fetch a source package from a zip URL, so the package is local on purpose. - The console's SDKs page has the download and the snippet below with your own key filled in.
Say a line:
import SwiftUI
import VibedSDK
struct ContentView: View {
@State private var her = Talker(client: VibedClient(key: "vk_β¦"))
var body: some View {
VStack {
TalkerStage(her).frame(height: 400)
Button("Say hi") { Task { try await her.say("Hello there. Nice to meet you.", emotion: "happy") } }
}
.task { her.load("hallway-girl") }
}
}
Talker(client:) makes its own CharacterStageView and TalkerStage shows it in SwiftUI; load(_:) fetches the manifest and decodes the frames; say(_:emotion:) opens a speak stream with the emotion in its start, so it bends her voice as well as setting her face, plays the voice as it arrives and moves the mouth on its cues, returning when the line has played out. In UIKit, mountCharacter(in: stageView, client: client, ref: "hallway-girl") is the same Talker. speakStream() is the wiring for a text your model is still writing (SpeakStart(emotion:) bends the whole stream and ready.emotion echoes it), lipsync() for your own audio, with startMicrophone() to feed it from the microphone; hold(true) pauses, stop() cancels, unmount() lets the layers go. The VibedClient underneath covers every endpoint in this reference and runs on macOS too: lipsync(audio:text:offsetS:) answers cues on your own clock, and downloadCharacter(_:to:) unpacks a character's bundle into a folder, every CRC and every path checked before anything is written (a BundleError otherwise), that CharacterStageView.load(manifest:baseURL:assetLoader:) renders with no key and no network. vibed-cli (in the package) drives it from a terminal; vibed-cli fetch <slug> <dir> is that folder from the command line.
What is proved before a version ships: the Swift playback rules replay the same recorded scenarios the web SDK is tested on, on a stepping clock, and must make the same holds and frontier moves to the millisecond; the breath geometry derived in Swift must equal the web's on every house character; the player is run in offline rendering and every chunk must land at its sample position; and the command-line client is driven against a live server, its events graded over the wire by the same cue rules the web client is held to, including the lipsync stream against committed truth. The zip reader is run on a bundle the server made, deflated, damaged, with an unsupported method and with a name outside the folder, each refusal writing nothing; and against a live server the emotion must be echoed on both doors and refused on both when it is not one of the eight, the lipsync offset must move every cue by exactly itself, and vibed-cli fetch must write every file byte for byte what the web client's downloadCharacter writes and the server serves. The README.md in the zip has the install, the whole surface, the memory and CPU numbers and the vibed-cli commands.
Android
vibed-sdk-android is a Kotlin library module, minSdk 26, with coroutines as its only dependency: the same character files and the same cue shape as the web and iOS, a stage view that draws the nine mouths, blink, expressions and breath in one Canvas pass from hardware bitmaps, the speak and lipsync sockets on the library's own WebSocket client, a player on AudioTrack that holds at the cue frontier, and a Talker that wires them. Frames are decoded once at the view's size, none of it on the Java heap, and a character with patches is about 10 MB on screen.
- Download
vibed-sdk-android.zipand unzip it beside your project; thevibed-sdk-androidfolder is a Gradle project whosesdk/is the library. Include it as a module of your app, insettings.gradle.kts: ``kotlin include(":vibed-sdk") project(":vibed-sdk").projectDir = file("../vibed-sdk-android/sdk")`thenimplementation(project(":vibed-sdk"))in the app's dependencies. Sources rather than an AAR, so the module compiles with your own Android Gradle plugin and Kotlin versions. The Compose wrapper,sdk-compose/, is the same two lines with:vibed-sdk-compose`, plus the Compose compiler plugin at your Kotlin version. - The console's SDKs page has the download and the snippet below with your own key filled in.
Say a line:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) // a CharacterStageView with id stage, a Button with id say
val her = Talker(findViewById<CharacterStageView>(R.id.stage), VibedClient(key = "vk_β¦"))
her.load("hallway-girl")
findViewById<Button>(R.id.say).setOnClickListener {
lifecycleScope.launch { her.say("Hello there. Nice to meet you.", emotion = "happy") }
}
}
}
Talker(view, client) wires the stage view, the player and the client; load(ref) fetches the manifest and decodes the frames; say(text, emotion) suspends while it opens a speak stream with the emotion in its start (it bends her voice as well as setting her face), plays the voice as it arrives and moves the mouth on its cues, and returns when the line has played out (it needs a coroutine scope; lifecycleScope is AndroidX's, not the library's). In Compose, AndroidView(factory = { her.view }) shows the same Talker's view (video.vibed.sdk.stage.view.CharacterStageView); the sdk-compose module's CharacterStage(manifest, assetLoader, β¦) is the stage for a manifest you load and drive yourself. speakStream() is the wiring for a text your model is still writing (SpeakStart(emotion = β¦) bends the whole stream), lipsync() for your own audio, with startMicrophone() to feed it from the microphone (RECORD_AUDIO is your app's permission); hold(true) pauses, seek(tS) jumps, stop() cancels, unmount() lets the layers go. Against a dev server over plain http from the emulator (baseUrl = "http://10.0.2.2:5189"), the app needs android:usesCleartextTraffic="true"; vibed.video needs nothing. The VibedClient underneath covers every endpoint in this reference and runs on the JVM too: lipsync(audio, offsetS = β¦) answers cues on your own clock, and downloadCharacter(ref, dir) unpacks a character's bundle into a folder, every CRC and every path checked before anything is written (a BundleException otherwise), that CharacterStageView.load(manifest, options) { File(dir, it).readBytes() } renders with no key and no network.
What is proved before a version ships: the Kotlin playback rules replay the same recorded scenarios the web and iOS SDKs are tested on, on a stepping clock, and must make the same holds and frontier moves to the millisecond; the breath geometry derived in Kotlin must equal the web's on every house character; the library is built offline from pinned versions and held under 1 MB with coroutines as its only dependency; the client is driven against a live server, its events graded over the wire by the same cue rules the web client is held to; the download itself is unzipped and built as a customer would build it, gradlew runnable as it comes; and the sample app is driven on an emulator - a key typed, a character loaded, a line said, the mouth seen to move, the status going speaking then done - beside an instrumented test that draws a frame on the device and compares it pixel for pixel. The zip reader is run on a bundle the server made, deflated, damaged, with an unsupported method and with a name outside the folder, each refusal writing nothing; and against a live server the emotion must be echoed on both doors and refused on both when it is not one of the eight, the lipsync offset must move every cue by exactly itself, and the client's downloadCharacter must write every file byte for byte what the web client's writes and the server serves. The README.md in the zip has the install, the whole surface, the permissions and the memory and CPU numbers.
Usage
Every call writes one usage record: kind, audio seconds, wall time, queue wait, cue count and outcome. The console's Usage page shows totals, per key, per day and the most recent calls. On the streaming socket, a stream that only lost slices to a full queue is recorded as shed (capacity, like a 429), and error means a job failed.
Errors
Every error is a JSON body with an error message, sent with one of these HTTP statuses.
| Status | Meaning |
|---|---|
400 | A bad request: invalid body or option, undecodable audio, unknown provider or engine. Video requests name every problem in the batch. |
401 | Missing, unknown or revoked key. |
403 | The demo key on a door it does not open. |
404 | Unknown character, build, job, take or file. |
405 | Wrong method for the endpoint; Allow names the right one. |
409 | A character build is already running (retry after Retry-After), or a bundle was asked for by the id of a build that has not finished. |
413 | Body too large. |
415 | Unrecognised body type. |
426 | A plain HTTP request to a WebSocket endpoint. |
429 | Queue full, too many video jobs, or a demo key connection over its caps (reason says which). Retry after Retry-After where given; nothing was lost. |
502 | The voice provider failed (a take); error says how. |
Sockets close with 1000 when finished, 1008 on a protocol mistake or a demo key cap and 1011 on a server failure, each failure after an error event.