Skip to main content

Server-side Python SDK for Vox-hosted WebRTC sessions.

Project description

vox-rtc-server

Server-side Python SDK for Vox-hosted WebRTC sessions.

This package is for backend applications that need to:

  • create RTC sessions over HTTP
  • attach to /v1/socket
  • join /rtc/{session_id}
  • send session.update, response.*, and server-to-browser client.event
  • observe RTC control events

It is intentionally narrow. It is not the general STT/TTS/text SDK.

Install

pip install vox-rtc-server pondsocket-client

The SDK uses the PondSocket Python client for the control-plane socket. Until pondsocket-client is published, install it from your local checkout or git ref. Authentication can be passed explicitly with api_key=... or through VOX_API_KEY.

Example

import asyncio
import os

from vox_rtc_server import (
    ClientEventEnvelope,
    SessionConfig,
    VoxRtcServerClient,
)


async def main() -> None:
    client = VoxRtcServerClient(
        http_base="https://vox.example.com",
        api_key=os.environ.get("VOX_API_KEY"),
    )

    bootstrap, session = await client.create_controlled_session()
    print("session:", bootstrap.session_id)

    session.on_transcript(lambda event: print("user said:", event.transcript))
    session.on_browser_event(lambda event: print("browser event:", event.event, event.payload))
    session.on_close(lambda event: print("browser disconnected:", event.reason))

    session.configure(
        SessionConfig(
            stt_model="parakeet-stt-onnx:tdt-0.6b-v3",
            tts_model="kokoro-tts-onnx:v1.0",
            voice="af_heart",
            turn_profile="browser_default",
            vad_backend="silero",
            turn_detector="livekit",
        )
    )

    session.send_text_response("Hello from Python.")
    session.send_client_event(
        ClientEventEnvelope(
            event="render.url",
            payload={"url": "https://example.com"},
        )
    )


asyncio.run(main())

send_client_event is server to browser. Browser-originated app events arrive through on_browser_event.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vox_rtc_server-0.1.4.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vox_rtc_server-0.1.4-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file vox_rtc_server-0.1.4.tar.gz.

File metadata

  • Download URL: vox_rtc_server-0.1.4.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vox_rtc_server-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1fbf80dd1a4c7d1fae728d3bea5c7b7b8260eb038bd2c174b31c5a73dc993af8
MD5 d533079a3bf2cb456c842a1ba299b09e
BLAKE2b-256 43e8aa96364ab7bff1ff9a561473cb8199f676c2152eedaddd44ceb6820617c2

See more details on using hashes here.

File details

Details for the file vox_rtc_server-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: vox_rtc_server-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vox_rtc_server-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 caeed3ada69921d1a855653582a6120890e007da489305c3c7d5329c8c4ad6f2
MD5 e0b824d6ca0f0fe12f06f967972ecd61
BLAKE2b-256 5a6e399abee5a6361a4b162133b25f773d3a26e94126a3c44c1dc0b2b4a2ed2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page