Authorization notice. Openspline is dual-use. Only use it on software, sites and systems you own or have explicit permission to test.
Credentials. Keep OPENAI_API_KEY on the backend and never expose it to the browser.
Who it is forA developer whose agent already uses the OpenAI Realtime API and needs a visual avatar without rewriting event handling.
The problemA Realtime agent plays audio only, and wiring audio to a video avatar by hand is error prone.
The outcomeThe existing Realtime event handler keeps working while the avatar speaks the agent's audio.
What you need first
- A portrait image of the face to animate, with rights to use it
- Python 3.x or Node 20+ for the SDK
- Either an OpenSpline Cloud API key or a Linux or WSL2 machine with an NVIDIA GPU
- An existing voice AI agent or a TTS provider that outputs PCM audio
Steps
- Run
pip install openai==2.54.0. - Set
OPENAI_API_KEYin your backend environment. - Open the avatar with
async with Openspline().avatar("portrait.jpg") as avatar:and wait withawait avatar.wait_for_viewer(). - Create
adapter = OpenAIRealtime(avatar, connection)and loop overadapter.wrap(connection), passing each event to your handler. - Disable your previous speaker output so audio does not play twice, then run
OPENAI_API_KEY=... python examples/python/openai_realtime.py portrait.jpg.
Prompt for your agent
Use the openspline repo (github.com/openspline/openspline) to add the OpenAIRealtime adapter to the agent in <path-to-agent>, keeping its existing event handler. Use portrait <path-to-portrait.jpg>. Confirm the speaker output is disabled so audio plays once, and report the viewer URL.
Caveat. The README pins openai==2.54.0 for this connector, so newer SDK versions may not match the example.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Disclaimer
Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page