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

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.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 livekit-plugins-pocket 0.1.0
File Size Uploaded Provenance Actions
livekit_plugins_pocket-0.1.0.tar.gz 16.4 kB Without provenance Details for livekit_plugins_pocket-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 32.7 kB

Release files / livekit_plugins_pocket-0.1.0.tar.gz

Download URL livekit_plugins_pocket-0.1.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0fb3436afda170adc0e8339f2cf75bb25e58429c24dbf61583a242bbccf57c29
BLAKE2b-256 checksum
How to use checksums
2b7f1ae1810ceebbabc3fda53767a2f8b25ca45a7638eb3c9b0a567cf682eecb
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.0-py3-none-any.whl

Download URL livekit_plugins_pocket-0.1.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82253ed597e7b7c22a7de4531785487a4813488738d19edb3ebe811add91dd4f
BLAKE2b-256 checksum
How to use checksums
4a54cf129e1cef34bc4476bf1fa5171756b596b6d533a6a4c970c8464bb4f0b9
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.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.

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