Getting Started
This guide will get you up and running with the Voxta Gateway in under 5 minutes.
Prerequisites
- Python 3.10 or higher
- Voxta server running (default:
http://localhost:5384)
Installation
From PyPI (Recommended)
From Source
git clone https://github.com/dion-labs/voxta-gateway.git
cd voxta-gateway/main
pip install -e ".[dev]"
Running the Gateway
Basic Usage
With Custom Configuration
Using Uvicorn Directly
Verify It's Working
1. Check Health Endpoint
Expected response:
2. Check State
Expected response:
{
"connected": true,
"chat_active": false,
"ai_state": "idle",
"external_speaker_active": false,
"external_speaker_source": null,
"characters": []
}
3. Open Debug UI
Navigate to http://localhost:8081 in your browser to see the real-time debug interface.
Your First Client
The voxta-gateway package includes a GatewayClient that handles all the connection complexity for you:
import asyncio
from voxta_gateway import GatewayClient
async def main():
# Create client
client = GatewayClient(
gateway_url="http://localhost:8081",
client_id="my-first-client",
events=["chat_started", "chat_closed", "dialogue_received"]
)
# Handle events
@client.on("connected")
async def on_connected(state):
print(f"Connected! Chat active: {state.get('chat_active')}")
@client.on("chat_started")
async def on_chat_started(data):
print(f"Chat started with: {[c['name'] for c in data.get('characters', [])]}")
@client.on("dialogue_received")
async def on_dialogue(data):
print(f"[{data.get('source')}] {data.get('text')}")
# Run with automatic reconnection
print("Listening for events... (start a chat in Voxta)")
await client.start()
if __name__ == "__main__":
asyncio.run(main())
Run it:
The client automatically: - Connects and subscribes to events - Receives and tracks state - Reconnects on connection loss - Provides typed methods for sending dialogue, context, etc.
Configuration Reference
| Environment Variable | Default | Description |
|---|---|---|
VOXTA_URL |
http://localhost:5384 |
Voxta server URL |
GATEWAY_PORT |
8081 |
Port for the Gateway HTTP/WS server |
LOG_LEVEL |
INFO |
Logging level (DEBUG, INFO, WARNING, ERROR) |
Troubleshooting
"voxta_connected": false
The gateway couldn't connect to Voxta. Check that:
- Voxta is running
- The
VOXTA_URLis correct - No firewall is blocking the connection
WebSocket connection rejected
Make sure you send a subscription message as the first message:
No events received
- Check that a chat is active in Voxta
- Verify you're subscribed to the right events
- Check the Debug UI at
http://localhost:8081to see what events are flowing
Next Steps
- Building Clients - Learn best practices for robust clients
- API Reference - Explore all available endpoints and events