talking-avatar-skill
Skill20 starsChanged 2 months agoMITView on GitHub
Build or transform lightweight realtime voice-chat apps with a talking character avatar from either a user-supplied photograph or a text description. Use when Codex is asked to create a talking avatar, photo avatar, character chatbot, roleplaying voice companion, mouth-sprite animation, or reusable OpenAI Realtime avatar app in Vite/Next.js, including BYOK API-key intake, identity-consistent image generation, audio-driven lip sync, testing, and deployment.
In this repository7 other files it gives its agents.
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 15 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Create one focused voice conversation with a fixed character portrait whose mouth poses follow the actual remote audio.
- Very specific: line 12
Use imagegen for every canonical portrait or mouth-frame generation/edit.
- Very specific: line 13
Use openai-docs and, when applicable, openai-platform-api-key to verify the current Realtime WebRTC endpoint, session schema, model, …
- Distinctive: line 14
Use the available frontend design skill for interface work.
- Very specific: line 15
If .openai/hosting.json exists, follow sites-building and sites-hosting through deployment.
- Distinctive: line 16
Do not add backgrounds, wardrobes, role modes, or multiple characters unless the user explicitly asks.
- Distinctive: line 24
Read references/image-pipeline.md before creating or editing the avatar assets.
- Very specific: line 40
Run scripts/validate_avatar_assets.py --dir <project>/public/avatar and fix all failures.
- Distinctive: line 42
Never animate the complete portrait.
- Very specific: line 46
Prefer an existing working stack.
- Distinctive: line 63
Read references/app-contract.md before changing the Realtime route, API-key flow, or event handling.
- Distinctive: line 67
Read references/realtime-lipsync.md and preserve its behavioral contract:
- Distinctive: line 71
Update the visible mouth pose no faster than about every 96 ms.
- Distinctive: line 75
Keep the portrait pixels completely static.
- Very specific: line 77
Do not use a canned infinite mouth animation.
- Distinctive: line 81
Ask the user to enter the OpenAI API key inside the app.
- Distinctive: line 82
Keep the key in component memory only.
- Distinctive: line 84
Never expose a long-lived key directly to the Realtime WebRTC peer connection.
- Distinctive: line 89
Run the production build.
- Distinctive: line 90
Run lint and the starter regression test when available.
- Distinctive: line 95
If the user requests visual browser QA, test a live voice turn and tune timing from observed speech.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Talking Avatar
Create one focused voice conversation with a fixed character portrait whose mouth poses follow the actual remote audio. Accept either a photograph or a character description, generate a canonical portrait plus small mouth sprites, and build the app around OpenAI Realtime.
Coordinate the required skills
- Use
imagegenfor every canonical portrait or mouth-frame generation/edit. Read its full instructions before generating. - Use
openai-docsand, when applicable,openai-platform-api-keyto verify the current Realtime WebRTC endpoint, session schema, model, voices, and credential flow. Never rely on this skill's model examples as current truth. - Use the available frontend design skill for interface work.
- If
.openai/hosting.jsonexists, followsites-buildingandsites-hostingthrough deployment. - Do not add backgrounds, wardrobes, role modes, or multiple characters unless the user explicitly asks. The default product is one avatar and one conversation.
Choose the input path
- Photograph supplied: inspect it with
view_image, treat it as an identity reference, and preserve face shape, skin tone, hair, glasses, facial hair, and distinguishing features. - Character described: normalize the description into a concrete visual spec. Ask only for a missing detail that materially changes identity, such as photorealistic versus illustrated. Otherwise proceed with tasteful defaults.
- Establish the character name, concise persona, app name, language, and preferred voice. Infer reasonable defaults when safe.
Read references/image-pipeline.md before creating or editing the avatar assets.
Build the asset set
- Generate one canonical, front-facing, evenly lit, closed-mouth portrait. Lock its canvas, crop, head position, gaze, pose, clothing, background, and lighting.
- From that canonical image, generate three separate identity-preserving edits:
soft: lips slightly parted;round: a natural rounded vowel;open: a natural medium-open vowel.
- Repeat the invariants in every edit prompt. Change only the immediate lips and inner mouth. Reject frames with moved eyes, jaw, glasses, head, beard, clothing, or lighting.
- Crop the smallest practical identical rectangle from all three speech frames. Keep enough surrounding skin for feathering, but do not ship full-frame speech images.
- Save exactly these project assets by default:
public/avatar/avatar-base.jpgpublic/avatar/mouth-soft.pngpublic/avatar/mouth-round.pngpublic/avatar/mouth-open.png
- Run
scripts/validate_avatar_assets.py --dir <project>/public/avatarand fix all failures.
Never animate the complete portrait. Only replace the mouth patch.
Build or integrate the app
Prefer an existing working stack. For a new project, use Next.js or vinext because the user's API key must cross a server route; use plain Vite only when a safe backend already exists.
For a compatible new Next/vinext project, scaffold the proven core:
python3 <skill-dir>/scripts/scaffold_app.py \
--target <project-dir> \
--character-name "Mira" \
--app-name "Mira Live" \
--persona "a concise, curious field researcher" \
--model "<verified-realtime-model>" \
--transcription-model "<verified-transcription-model>" \
--voice "<verified-realtime-voice>"The target must already contain the framework configuration and dependencies. Install framer-motion and @phosphor-icons/react when missing. Use --force only for a newly initialized project after inspecting the files it will replace. For an existing product, copy or adapt individual files from assets/starter/ instead of overwriting its architecture.
Read references/app-contract.md before changing the Realtime route, API-key flow, or event handling.
Implement natural lip sync
Read references/realtime-lipsync.md and preserve its behavioral contract:
- Analyze the remote output
MediaStream, not microphone input and not Realtime event cadence. - Sample audio every animation frame without updating React state.
- Update the visible mouth pose no faster than about every 96 ms.
- Smooth attack and decay, normalize against a rolling peak, and close after short silence.
- Move through adjacent poses (
closed → soft → round → open) instead of jumping. - Set a DOM
data-mouthattribute and let CSS reveal exactly one patch. - Keep the portrait pixels completely static.
Do not use a canned infinite mouth animation. response.output_audio.delta identifies speaking state but does not provide lip timing.
Preserve the BYOK security boundary
- Ask the user to enter the OpenAI API key inside the app.
- Keep the key in component memory only; never use local storage, session storage, IndexedDB, analytics, logs, or source files.
- Send it once to the same-origin session route over HTTPS, clear client state after negotiation, and return
Cache-Control: no-store. - Never expose a long-lived key directly to the Realtime WebRTC peer connection.
- Map upstream authentication and rate-limit failures to short user-facing errors without echoing response bodies or secrets.
Validate before handoff
- Run the production build.
- Run lint and the starter regression test when available.
- Confirm the source contains an
AnalyserNode,requestAnimationFrame, a 90–110 ms pose interval, adjacent-pose stepping, and no CSS@keyframes mouth-*loop. - Confirm all mouth patches have identical dimensions and align over the canonical mouth at desktop and mobile sizes.
- Confirm only the mouth changes during speech; blinking, head bobbing, pose drift, and full-frame swaps are failures.
- Confirm mic mute, speaker mute, interruption, transcript deltas, typed messages, disconnect cleanup, audio-context cleanup, empty state, connection errors, and invalid-key errors.
- If the user requests visual browser QA, test a live voice turn and tune timing from observed speech. Otherwise do not claim that browser-level lip sync was visually verified.
- Deploy when requested or when the active hosting skill requires it, then return the live URL.
Deliverables
Return the runnable app, the final avatar asset paths, the generation prompt set, whether photo or description mode was used, the Realtime model/voice verified for that run, validation results, and the deployed URL when applicable.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

