https://github.com/yousefhany77/tts-ai
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.
https://github.com/yousefhany77/tts-ai
elevenlabs openai text-to-speech tts tts-api
Last synced: 26 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/yousefhany77/tts-ai
- Owner: yousefhany77
- License: mit
- Created: 2024-02-01T13:25:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-10T22:29:20.000Z (over 1 year ago)
- Last Synced: 2025-08-19T01:23:27.178Z (about 2 months ago)
- Topics: elevenlabs, openai, text-to-speech, tts, tts-api
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/tts-ai
- Size: 266 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
tts-ai
## Description
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.
## Features
- Unified API for multiple TTS providers
- Generate audio from text with `speak()` method
- Split long text into chunks automatically
- Switch voices and models easily
- Save generated audio to file
- Seamlessly concatenate audio fragments
- Handles provider authentication
- MIT license## Getting Started
### Install
```
pnpm add tts-ai
```### Usage
#### Without .env file
```ts
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();
```#### With .env file
`OpenAi_TTS_API_KEY = YOUR_API_KEY`
```ts
import { TtsOpenAI } from 'tts-ai';const tts = new TtsOpenAI();
await tts.speak('Hello world');
await tts.save();
```See [documentation](docs/README.md) for full usage details.
# Providers
The library supports the following text-to-speech providers:
- OpenAI
- Google Cloud
- ElevenLabs# Contributing
Contributions are welcome!
# License
This project is licensed under the [MIT license](LICENSE).