Registry / llm-agents / speechmatics-voice

speechmatics-voice

JSON →
library0.2.8pypypi✓ verified 84d ago

Official Python client for Speechmatics Real-Time API for voice agents. Supports WebSocket-based streaming for real-time transcription and agent interaction. Current version: 0.2.8, release cadence: irregular.

pip install speechmatics-voice
INSTALL
IMPORT
SIG · SPEECHMATICS-VOICE
S
speechmatics-voice
llm-agentspythonv0.2.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VoiceAgentClient
from speechmatics.voice import VoiceAgentClient
from speechmatics_voice import VoiceAgentClient
Library uses dot in package name, not underscore

Connect to Speechmatics Voice Agent, send audio, and receive real-time transcriptions.

import asyncio from speechmatics.voice import VoiceAgentClient async def main(): client = VoiceAgentClient( url='wss://realtime.voice.speechmatics.com/v1', auth_token=os.environ.get('SPEECHMATICS_AUTH_TOKEN', ''), ) await client.start() # Send audio data await client.send_audio(b'\x00' * 16000) # Receive messages async for msg in client: print(msg) if msg.get('type') == 'utterance_end': break await client.stop() asyncio.run(main())
Debug
Known issues
breakingThe client expects audio in 16kHz, 16-bit linear PCM format. Using other formats will fail silently.
fix
Ensure audio is resampled to 16kHz mono 16-bit PCM before sending.
affects: all
gotchaThe `auth_token` must be provided as a string, not as a dict or header. Passing via headers is not supported.
fix
Pass `auth_token='your_token'` directly to the constructor.
affects: all
gotchaThe library uses asyncio; opening multiple connections without proper async management can cause resource leaks.
fix
Always use `async with` or explicitly call `await client.stop()` to close connections.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'speechmatics'
Incorrect import path; package name on PyPI is speechmatics-voice but import uses speechmatics.voice
fix
Install with `pip install speechmatics-voice` and import as `from speechmatics.voice import VoiceAgentClient`
websockets.exceptions.ConnectionClosedError: no close frame received
Server closes connection due to invalid auth token or audio format mismatch.
fix
Check that auth token is correct and audio is 16kHz 16-bit PCM mono.
TypeError: object dict can't be used in 'await' expression
Trying to await a non-async method, e.g., `await client.connect` instead of `await client.start()`
fix
Use `await client.start()` to initiate connection.
Upgrade
Version history
0.2.8latest on PyPI · released Jan 26, 2026
Audit
Dependencies
websocketsrequiredrequired for WebSocket connection
aiofileoptionaloptional for file recording
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
speechmatics-voice — pip install speechmatics-voice · libregistry