elevenlabs-js  by elevenlabs

Lifelike voice synthesis and AI agent SDK for Node.js

Created 2 years ago
424 stars

Top 69.1% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Summary

This Node.js library provides developers with a straightforward interface to integrate ElevenLabs' advanced text-to-speech (TTS) capabilities into their applications. It enables the creation of lifelike, multilingual voice experiences with minimal code, targeting developers building voice-enabled applications, AI agents, or content creation tools. The library offers access to various high-quality TTS models and a real-time Speech Engine for interactive voice applications.

How It Works

The library interacts with the ElevenLabs API, abstracting complex API calls into simple JavaScript functions. It supports multiple TTS models, including eleven_multilingual_v2 for broad language support and accent accuracy, eleven_flash_v2.5 for ultra-low latency and cost-efficiency, and eleven_turbo_v2.5 balancing quality and speed. A key feature is the Speech Engine, which facilitates real-time, bidirectional communication via WebSockets, allowing developers to connect their LLMs (e.g., OpenAI) to ElevenLabs for dynamic voice agent interactions. This can be integrated into existing HTTP servers or run as a standalone WebSocket server.

Quick Start & Requirements

  • Install: npm install @elevenlabs/elevenlabs-js or yarn add @elevenlabs/elevenlabs-js.
  • Prerequisites: MPV and ffmpeg are required for local audio playback. An ElevenLabs API key is necessary.
  • Runtime Compatibility: Node.js 15+, Vercel, Cloudflare Workers, Deno v1.25+, Bun 1.0+.

Highlighted Details

  • Offers multiple TTS models optimized for quality, latency, and multilingual support (up to 32 languages).
  • Supports real-time audio streaming for immediate playback as speech is generated.
  • Speech Engine enables building interactive, voice-powered AI agents by connecting LLM responses to ElevenLabs TTS via WebSocket.
  • Includes automatic retries with exponential backoff for transient API errors (e.g., 429, 5XX).
  • Configurable request timeouts, defaulting to 60 seconds.

Maintenance & Community

This library is programmatically generated. Direct code contributions are generally not merged as-is; users are encouraged to open issues to discuss potential changes before submitting pull requests. Contributions to the README documentation are welcomed. Specific community channels (like Discord/Slack) are not detailed in the provided text.

Licensing & Compatibility

The license type is not explicitly stated in the provided README. As an API client library, it is generally compatible with most JavaScript projects, but specific usage restrictions would depend on the ElevenLabs API terms of service and the library's underlying license.

Limitations & Caveats

Direct code contributions to the library are discouraged due to its generated nature, requiring prior discussion via issues. Local audio playback necessitates the installation of external dependencies: MPV and ffmpeg. The specific software license governing this library is not disclosed in the README.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
6
Issues (30d)
3
Star History
12 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.