{"id":27412,"library":"speechmatics-voice","title":"Speechmatics Voice Agent Python Client","description":"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.","status":"active","version":"0.2.8","language":"python","source_language":"en","source_url":"https://github.com/speechmatics/speechmatics-voice-python","tags":["speech-recognition","voice-agent","real-time","websocket"],"install":[{"cmd":"pip install speechmatics-voice","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"required for WebSocket connection","package":"websockets","optional":false},{"reason":"optional for file recording","package":"aiofile","optional":true}],"imports":[{"note":"Library uses dot in package name, not underscore","wrong":"from speechmatics_voice import VoiceAgentClient","symbol":"VoiceAgentClient","correct":"from speechmatics.voice import VoiceAgentClient"}],"quickstart":{"code":"import asyncio\nfrom speechmatics.voice import VoiceAgentClient\n\nasync def main():\n    client = VoiceAgentClient(\n        url='wss://realtime.voice.speechmatics.com/v1',\n        auth_token=os.environ.get('SPEECHMATICS_AUTH_TOKEN', ''),\n    )\n    await client.start()\n    # Send audio data\n    await client.send_audio(b'\\x00' * 16000)\n    # Receive messages\n    async for msg in client:\n        print(msg)\n        if msg.get('type') == 'utterance_end':\n            break\n    await client.stop()\n\nasyncio.run(main())","lang":"python","description":"Connect to Speechmatics Voice Agent, send audio, and receive real-time transcriptions."},"warnings":[{"fix":"Ensure audio is resampled to 16kHz mono 16-bit PCM before sending.","message":"The client expects audio in 16kHz, 16-bit linear PCM format. Using other formats will fail silently.","severity":"breaking","affected_versions":"all"},{"fix":"Pass `auth_token='your_token'` directly to the constructor.","message":"The `auth_token` must be provided as a string, not as a dict or header. Passing via headers is not supported.","severity":"gotcha","affected_versions":"all"},{"fix":"Always use `async with` or explicitly call `await client.stop()` to close connections.","message":"The library uses asyncio; opening multiple connections without proper async management can cause resource leaks.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with `pip install speechmatics-voice` and import as `from speechmatics.voice import VoiceAgentClient`","cause":"Incorrect import path; package name on PyPI is speechmatics-voice but import uses speechmatics.voice","error":"ModuleNotFoundError: No module named 'speechmatics'"},{"fix":"Check that auth token is correct and audio is 16kHz 16-bit PCM mono.","cause":"Server closes connection due to invalid auth token or audio format mismatch.","error":"websockets.exceptions.ConnectionClosedError: no close frame received"},{"fix":"Use `await client.start()` to initiate connection.","cause":"Trying to await a non-async method, e.g., `await client.connect` instead of `await client.start()`","error":"TypeError: object dict can't be used in 'await' expression"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}