Overview
The Lightning v2 WebSocket API delivers state-of-the-art text-to-speech synthesis through a persistent WebSocket connection, providing ultra-low latency audio streaming for applications that demand real-time voice generation. Unlike traditional HTTP-based TTS APIs, this WebSocket implementation streams audio chunks as they’re processed, significantly reducing perceived latency and enabling seamless user experiences.Key Benefits
- Ultra-Low Latency: Audio chunks are delivered as soon as they’re generated, enabling near-instantaneous playback
- Real-Time Streaming: Continuous audio delivery without waiting for complete text processing
- High-Quality Synthesis: Advanced neural voice models with natural-sounding speech output
- Persistent Connection: Maintains connection for multiple requests, reducing connection overhead
- Interactive Applications: Perfect for chatbots, voice assistants, and live communication systems
Use Cases
- Voice Assistants: Real-time response generation for conversational AI
- Interactive Chatbots: Immediate audio feedback for user interactions
- Live Streaming: Real-time narration and commentary
- Accessibility Tools: Screen readers and text-to-speech applications
- Gaming: Dynamic voice generation for characters and narration
- Customer Service: Automated voice responses with natural speech patterns
Concurrency and Rate Limits
This WebSocket API is subject to concurrency limits to ensure optimal performance for all users. Here’s how it works:- 1 Concurrency Unit = 1 active TTS request that can be processed at any given time
- 5 WebSocket Connections can be established per concurrency unit
- Total Connections = Your concurrency limit × 5
- 1 concurrency = Up to 5 WebSocket connections, but only 1 active request
- 3 concurrency = Up to 15 WebSocket connections, but only 3 active requests simultaneously
- 5 concurrency = Up to 25 WebSocket connections, but only 5 active requests simultaneously
When multiple requests are sent simultaneously beyond your concurrency limit, additional requests will be rejected with an error. Implement proper error handling and request queuing to manage concurrency effectively.