Introduction
The Savants Voice API enables real-time, bidirectional voice conversations between your application and AI. The API uses a hybrid approach combining HTTP for authentication and WebSockets for real-time audio streaming.Architecture
The API follows a simple two-step process: Step 1: AuthenticationFlow Description
- Authentication Request: Flutter app sends API key and device ID to get JWT token
- Token Response: Server returns short-lived JWT token (1 minute expiry)
- WebSocket Connection: App connects to WebSocket endpoint with JWT token
- Connection Confirmation: Server confirms with
savant_voice_connectedmessage - Audio Streaming: Bidirectional PCM audio streaming begins
Base Configuration
| Environment | Base URL |
|---|---|
| Production | https://api.thesavants.ai |
| WebSocket | wss://api.thesavants.ai/voice-stream |
API Endpoints
Authentication
- POST
/api/websocket-voice/token- Request JWT for WebSocket connection
WebSocket
- WSS
/voice-stream- Real-time audio streaming endpoint
Authentication Flow
1
Request Token
POST to
/api/websocket-voice/token with API key and device ID2
Receive JWT
Server returns short-lived (1 minute) JWT token
3
WebSocket Auth
Send JWT as first message after WebSocket connection
4
Begin Streaming
Start bidirectional audio streaming
Data Flow
Client → Server
- Authentication Token (String): JWT for connection authorization
- Audio Data (Binary): PCM audio from microphone
Server → Client
- Connection Messages (JSON): Status and error messages
- Audio Data (Binary): PCM audio from AI
Audio Specifications
| Property | Value |
|---|---|
| Format | Raw PCM |
| Sample Rate | 16,000 Hz |
| Bit Depth | 16-bit |
| Channels | 1 (Mono) |
| Endianness | Little-Endian |
| Encoding | Signed Integer |
Rate Limits
| Resource | Limit |
|---|---|
| Token Requests | 60/minute per device |
| Concurrent Connections | 10 per device |
| Audio Streaming | No specific limit (bandwidth dependent) |
Error Handling
All errors follow a consistent format:SDK Support
| Language | Status | Package |
|---|---|---|
| Flutter/Dart | ✅ Official | Native implementation |
| JavaScript | 🚧 Planned | Coming soon |
| Python | 🚧 Planned | Coming soon |
Security
- Transport Security: All connections use TLS/SSL encryption
- Authentication: JWT-based token authentication
- Token Expiry: 1-minute token lifespan prevents replay attacks
- No Data Storage: Audio streams are not stored server-side
Versioning
Current API version: v1 The API uses URL-based versioning:Support
- Technical Documentation: This reference guide
- Integration Support: [email protected]
- Response Time: 24-48 hours for technical inquiries