Skip to main content

livekit-plugins-pocket

Third-party LiveKit Agents TTS plugin for a self-hosted Pocket TTS server. It speaks the WebSocket protocol implemented by livekit-streaming-tts.

This package is not part of livekit/agents. LiveKit's maintainers do not publish or support it. The import matches the official plugin layout so it can sit next to livekit-plugins-cartesia and the rest:

from livekit.plugins.pocket import TTS

The wheel does not ship livekit/__init__.py or livekit/plugins/__init__.py, so it does not replace the livekit realtime package or any other plugin. The distribution name livekit-plugins-pocket follows the official livekit-plugins-<name> pattern. Check PyPI before publishing it; LiveKit owns that naming convention for in-repo plugins.

Install

Python 3.10–3.14, same range as current livekit-agents.

pip install -e ./livekit-plugins-pocket

That pulls livekit-agents>=1.8.9. It does not download Pocket weights.

Run the server first

The plugin is only a client. Synthesis happens in the existing server (Pocket, 24 kHz, one-shot generate_audio):

# from the livekit-streaming-tts checkout, with the pocket extra installed
tts-server --engine pocket --port 8001
curl http://127.0.0.1:8001/health

That command loads Kyutai's English weights. A community model is selected on the server, not in this plugin. See Community models in the livekit-streaming-tts README. For the multilingual finetune:

POCKET_TTS_MODEL=Thanushttk/pocket-tts-multilingual tts-server --engine pocket --port 8001

The plugin does not send a model id. Weights stay on the server process that just started. The websocket is ws://127.0.0.1:8001/tts/ws. Override it with POCKET_TTS_WS_URL or TTS_WS_URL.

Agent

stt, llm, and vad come from whatever else you already use. Ten lines for this TTS:

from livekit.agents import Agent, AgentSession
from livekit.plugins.pocket import TTS

session = AgentSession(
    tts=TTS(voice="alba"),  # ws://127.0.0.1:8001/tts/ws, 24 kHz PCM
    # stt=..., llm=..., vad=...,
)
await session.start(
    agent=Agent(instructions="You are a helpful voice assistant."),
    room=ctx.room,
)

TTS() reads:

Argument Environment Default
ws_url POCKET_TTS_WS_URL, then TTS_WS_URL ws://127.0.0.1:8001/tts/ws
voice POCKET_TTS_VOICE alba
sample_rate POCKET_TTS_SAMPLE_RATE 24000
language POCKET_TTS_LANGUAGE unset (Pocket is English)
normalize POCKET_TTS_NORMALIZE true
pauses POCKET_TTS_PAUSES false
timeout POCKET_TTS_TIMEOUT 30 seconds after text is sent
api_key POCKET_TTS_API_KEY unset (no Authorization header)

If the server was started with TTS_API_KEY, pass the same secret as api_key or export POCKET_TTS_API_KEY on the LiveKit machine. The plugin sends Authorization: Bearer <key> on the websocket handshake. With neither set, it connects with no auth header, which is what a server without TTS_API_KEY expects.

voice is one string on the websocket config, not wav bytes on each text frame. The server resolves it. It can be a preset (alba), a wav path or hf:// wav that the server can read, or a .safetensors voice state the server already exported. The first use of a wav pays the clone cost. Later turns, and the next server start, reuse the cached tensor.

pauses=True splices silence on the server. pocket-tts 2.1.0 does not do this itself. The LLM must emit the marker literally between sentences: Hello. [pause:0.5] World. Also [pause] (0.5s), [pause:1.5], and <break time="1.5s"/>. Durations clamp at 10 seconds. Other SSML tags are rejected. Leave pauses off when the model is not emitting those markers.

Streaming is on. LLM tokens are buffered with LiveKit's blingfire sentence tokenizer, sent as text frames, then one flush at the end of the segment. A barge-in sends cancel on that same websocket and closes it. The next turn opens a new websocket.

synthesize("Hello.") sends that string in one shot.

Tests

python -m unittest tests.test_protocol

The protocol tests mock the socket. They do not load a model. The TTS import test skips when livekit-agents is not installed.

Contributing this plugin

LiveKit documents one path for a plugin they will maintain: open a pull request against livekit/agents (and the Node.js SDK if you also cover JavaScript). That path means their namespace (livekit.plugins.<name>), their CI, a CLA, and a docs page. See Models → Contributing.

This package should stay a separate repository. It depends on a server and protocol you run yourself, not on a hosted API LiveKit can key. Upstream it later only if you want LiveKit to own the client and you are ready to match their review bar.

An in-repo plugin looks like livekit-plugins-neuphonic: pyproject.toml, livekit/plugins/<name>/__init__.py, tts.py, version.py, log.py, subclassing livekit.agents.tts.TTS.

Not in this package

  • Kokoro, OmniVoice, Piper, and the other engines in livekit-streaming-tts. Point this client at a server that already loaded Pocket.
  • LiveKit Inference / LiveKit Cloud TTS. Audio comes from your websocket server.
  • The server's sentence splitter. The client uses LiveKit's tokenizer and does not copy the server's abbreviation or comma-split rules.

Metadata

Release files for livekit-plugins-pocket 0.1.1

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

Source distribution (sdist)

Source distribution for livekit-plugins-pocket 0.1.1
File Size Uploaded Provenance Actions
livekit_plugins_pocket-0.1.1.tar.gz 17.3 kB Without provenance Details for livekit_plugins_pocket-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for livekit-plugins-pocket 0.1.1
File Interpreter ABI Platform Actions
livekit_plugins_pocket-0.1.1-py3-none-any.whl Python 3 none any Details for livekit_plugins_pocket-0.1.1-py3-none-any.whl

Total release size: 34.1 kB

Release files / livekit_plugins_pocket-0.1.1.tar.gz

Download URL livekit_plugins_pocket-0.1.1.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4439c33ac7012f8858c4f175f49e5a4f657e31091ad6590f5a6a09416658db88
BLAKE2b-256 checksum
How to use checksums
f7b82e0064d290194c4a29e427731bfd76038d8254ab6698809080775778a051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / livekit_plugins_pocket-0.1.1-py3-none-any.whl

Download URL livekit_plugins_pocket-0.1.1-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0b08f49337000aed4fde5ba642d2738982be4551496ab7ccfa5063ba6ff4f0b
BLAKE2b-256 checksum
How to use checksums
f4823144840e10200444a58b9a6011568eb0667d330854495c2da601b8c466b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for livekit-plugins-pocket 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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