How Speech Engine works
mainThe Speech Engine allows you to build voice-powered AI agents. The ElevenLabs API connects to your server via WebSocket, where each connection represents one conversation. You provide the LLM responses, and ElevenLabs handles the speech generation.
There are two ways to host a Speech Engine server:
- Attach to an existing HTTP server: Use
elevenlabs.speechEngine.attach()to handle connections on a specific path within your existing web server (e.g., Express, Next.js). - Standalone server: Use
SpeechEngine.Serverto run a dedicated WebSocket server on a specific port.