tts ai
v1.0.4
The Text-to-Speech Library provides a simple unified interface for generating high-quality speech audio using top text-to-speech providers like OpenAI, Google Cloud, and ElevenLabs.
With just a few lines of code, you can produce natural human-like voice audio for your applications and products.
speak() methodpnpm add tts-ai
import { TtsOpenAI } from 'tts-ai';
const uploadToS3 = (audio: ArrayBuffer) => {
// upload
};
const tts = new TtsOpenAI({
apiKey: 'YOUR_API_KEY',
uploadHandler: uploadToS3,
});
await tts.speak('Hello world');
await tts.upload();OpenAi_TTS_API_KEY = YOUR_API_KEY
import { TtsOpenAI } from 'tts-ai';
const tts = new TtsOpenAI();
await tts.speak('Hello world');
await tts.save();See documentation for full usage details.
The library supports the following text-to-speech providers:
Contributions are welcome!
This project is licensed under the MIT license.