Skip to main content

pipecat-meshlite

Give your Pipecat bot a lip-synced MeshLite face. The face is drawn in the visitor's browser by the MeshLite web SDK, from the audio track your page already receives from the bot. Your bot keeps its own speech-to-text, LLM, voice and transport: no video server, no GPU, no avatar participant, and no MeshLite voice minutes.

your Pipecat bot --audio track + RTVI events--> visitor page --> MeshLite face (lips in the browser)
                 <--"meshlite-session" request--   (pipecat-client-js + MeshLite web SDK)

This package holds the server side:

  • MeshLiteAvatarProcessor: a pass-through pipeline processor. It answers the page's meshlite-session RTVI request with a MeshLite session created with your secret key, and tells the page when the bot's language changes, so the lip model follows. It never changes, delays or copies the bot's audio.
  • MeshLiteClient: creates MeshLite client sessions (audio: "track") for any web route, if you prefer to give the page its session over HTTP.

Maintained by Toda Labs, the company that makes MeshLite.

Tested with Pipecat v1.16.0, @pipecat-ai/client-js 1.16.0 and the MeshLite web SDK 1.11.60.

Installation

uv add pipecat-meshlite
# or: pip install pipecat-meshlite

Prerequisites

In the MeshLite Console (Projects, then For developers):

  1. In Allowed sites, add the address of your page (for a local test, http://localhost:7860).
  2. In Keys, create a publishable key and a secret key of the same environment (test or live).
  3. In Code, copy your avatar id.
Variable Required Meaning
MESHLITE_PUBLISHABLE_KEY yes ml_pk_test_... or ml_pk_live_... (also sent to the page)
MESHLITE_SECRET_KEY yes ml_sk_... of the same environment; stays on your server
MESHLITE_ORIGIN yes address of your page, for example https://www.example.com
MESHLITE_AVATAR recommended avatar id; the page must mount the same one (the example requires it). Without it, sessions get the plan's default avatar
MESHLITE_API no another MeshLite environment (default https://console.meshlite.io)

Usage

1. The bot: add the processor

from pipecat.pipeline.pipeline import Pipeline
from pipecat.transcriptions.language import Language
from pipecat_meshlite import MeshLiteAvatarProcessor

avatar = MeshLiteAvatarProcessor(language=Language.EN)  # reads MESHLITE_* from the environment

pipeline = Pipeline([
    transport.input(),
    stt,
    user_aggregator,
    llm,
    tts,
    avatar,              # after the TTS: it reads what the bot says
    transport.output(),
    assistant_aggregator,
])

RTVI must be on (the default of PipelineWorker). Tested with the SmallWebRTC transport; the processor only uses RTVI messages, so other browser transports should work too.

Lip language. The processor reads the words the bot speaks (TTSTextFrame). As soon as a reply is clearly in English, French or Mandarin and differs from the current lip model, it sends meshlite-language to the page. A bot that switches language on purpose can call await avatar.set_language("fr"). The lips follow the bot's voice, not the visitor's speech-to-text.

Parameter Default Meaning
client from the environment a MeshLiteClient (keys, origin, avatar, API)
avatar client's avatar avatar id for this bot
language None language the bot speaks; picks the lip model (en, fr, zh-CN, else auto)
max_sessions 3 most session requests to MeshLite per connection, refusals included (each session counts as a conversation)
follow_language True send meshlite-language when the language the bot speaks changes

Event handlers: on_session_created(processor, session) and on_session_error(processor, error). If MeshLite refuses a session, the page gets an error response (meshlite_session_refused:<code>, final, or meshlite_session_unavailable:<code>, worth another try), the processor pushes a non-fatal ErrorFrame, and the visitor keeps hearing the bot without the face.

2. The page: mount the face and attach the Pipecat client

<div id="avatar" style="width:340px;height:510px"></div>
<script src="https://console.meshlite.io/sdk/1.11.60/meshlite.js" crossorigin="anonymous"></script>
<script type="module">
  import { PipecatClient } from "@pipecat-ai/client-js";
  import { SmallWebRTCTransport } from "@pipecat-ai/small-webrtc-transport";

  let botReady;
  const ready = new Promise((resolve) => { botReady = resolve; });
  const client = new PipecatClient({
    transport: new SmallWebRTCTransport(), enableMic: true,
    callbacks: {
      onBotReady: () => botReady(),
      onServerMessage: (m) => { if (m?.type === "meshlite-language") avatar.setLanguage(m.language); },
    },
  });
  const avatar = MeshLite.mount({
    container: "#avatar", avatar: "your-avatar-id", publishableKey: "ml_pk_live_...", audio: "track",
    // Stays under the SDK's 15 s wait: at most 4 s for the bot, then 10 s for the session.
    sessionToken: async () => {
      await Promise.race([ready, new Promise((_, fail) => setTimeout(() => fail(new Error("bot not ready")), 4000))]);
      try {
        const reply = await client.sendClientRequest("meshlite-session", {}, 10000);
        return (reply?.d ?? reply).sessionToken;
      } catch (e) {
        const error = e?.data?.error ?? e?.message ?? String(e);
        // A refusal or the session limit will not change: the SDK must not ask again.
        throw Object.assign(new Error(error), { retryable: !/^meshlite_session_(refused|limit)/.test(error) });
      }
    },
  });
  avatar.attachPipecat(client);              // before connect, so no speech is missed
  await client.connect({ webrtcUrl: "/api/offer" });
</script>

attachPipecat takes the bot's audio track and follows Pipecat's RTVI events (botStartedSpeaking, botStoppedSpeaking, botInterrupted, ...). On an interruption the face stops at once and does not replay the cut sentence. Keep your usual bot audio element: the SDK mutes it while the face carries the voice and unmutes it whenever the face cannot. Full page guide: meshlite.io/docs#pipecat.

Session over HTTP instead

from pipecat_meshlite import MeshLiteClient

meshlite = MeshLiteClient()

@app.post("/api/meshlite-session")
async def meshlite_session():
    session = await meshlite.create_session(language="en")
    return session.to_client()   # {sessionToken, publishableKey, avatar, language}

Authenticate your visitors and rate-limit this route: each call creates a conversation.

Run the example

examples/bot.py is a complete bot in one file: Azure speech-to-text, Azure OpenAI and Azure text-to-speech over SmallWebRTC, with the MeshLite face page served at /.

git clone https://github.com/meshlite-avatar/pipecat-meshlite && cd pipecat-meshlite
uv sync --extra example
cp examples/env.example examples/.env     # fill in the Azure and MeshLite values
uv run examples/bot.py

Open http://localhost:7860, press Start and allow the microphone. The face greets you and answers with matching lips. Interrupt it by speaking: it stops at once. The voice starts through the face about 0.8 s after it reaches the page (a live track has no "segment ready" signal); until the face is ready, the page plays the voice itself.

Any other Pipecat services work the same way: the processor does not depend on them.

Evals

evals/meshlite_bot.yaml runs the example under pipecat eval (greeting, an answer, and an interruption), judged by Azure OpenAI:

uv sync --extra example --extra eval
uv run examples/bot.py                    # in one terminal
cd evals && set -a && . ../examples/.env && set +a
PYTHONPATH=. uv run pipecat eval run meshlite_bot.yaml -v

Tests

uv sync --extra test
uv run pytest

Limits

  • One lip model per language: English, French, Mandarin Chinese. Other languages use the avatar's own language model.
  • A MeshLite session lasts at most 2 hours and counts as one conversation of your plan.
  • The face starts about 0.8 s after the first voice; the whole reply is delayed by that start-up time once the face carries the voice.

License

Apache-2.0. See LICENSE.

Metadata

Release files for pipecat-meshlite 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pipecat-meshlite 0.1.0
File Size Uploaded Provenance Actions
pipecat_meshlite-0.1.0.tar.gz 27.6 kB With provenance Details for pipecat_meshlite-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pipecat-meshlite 0.1.0
File Interpreter ABI Platform Actions
pipecat_meshlite-0.1.0-py3-none-any.whl Python 3 none any Details for pipecat_meshlite-0.1.0-py3-none-any.whl

Total release size: 47.9 kB

Release files / pipecat_meshlite-0.1.0.tar.gz

Download URL pipecat_meshlite-0.1.0.tar.gz
Size 27.6 kB
Tags Source
SHA-256 checksum
How to use checksums
be775f4fe68016279678ce73b1e899e102d6ef796ebdf91ed151d658d7a8e169
BLAKE2b-256 checksum
How to use checksums
2de21c4a4a661336556d123089f2df1c45e3e854f8c4e460b3623e632d6119d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pipecat_meshlite-0.1.0-py3-none-any.whl

Download URL pipecat_meshlite-0.1.0-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0de80582422890dc3ddd49d292b559d510d534cf40a4d385a7614f95e8842cb0
BLAKE2b-256 checksum
How to use checksums
1b57ddfa70af3f4b22677a339eb461ce8e4f2aa3bfc5be73d8de336f261a6164
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for pipecat-meshlite 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pipecat_meshlite-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page