Skip to content

akashdeepiim/tts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Model TTS Service

A unified Text-to-Speech service supporting OpenAI, Gemini, and Local (Coqui TTS/XTTS) models. Built with FastAPI.

Features

  • Unified API: Switch between providers (OpenAI, Gemini, Local) with a simple JSON parameter.
  • Local Model Support: run privately using Coqui XTTS (supports voice cloning and multi-language).
  • FastAPI: reliable, high-performance Python web framework.

Installation

  1. Clone the repository

    git clone https://github.com/akashdeepiim/tts.git
    cd tts-service
  2. Install Dependencies

    pip install -r requirements.txt

    Note: For local TTS support, ensure you have the necessary system libraries (e.g., espeak).

  3. Configuration Create a .env file in the root directory:

    OPENAI_API_KEY=your_openai_key
    GEMINI_API_KEY=your_gemini_key
    USE_GPU=True # Set to False if you don't have a GPU/Metal

Usage

Start the server:

python app/main.py

The API will run at http://localhost:8000.

Generate Audio

Endpoint: POST /v1/tts/generate

Example (OpenAI):

curl -X POST http://localhost:8000/v1/tts/generate \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello world!",
    "provider": "openai",
    "voice_id": "alloy"
  }' \
  --output output.mp3

Example (Local):

curl -X POST http://localhost:8000/v1/tts/generate \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello running locally.",
    "provider": "local",
    "voice_id": "default"
  }' \
  --output local.wav

List Models

Endpoint: GET /v1/tts/providers

curl http://localhost:8000/v1/tts/providers

Documentation

Interactive API documentation is available at http://localhost:8000/docs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages