Disclaimer: This project is for learning and testing purposes only. For production use, please use the official OpenAI TTS service at https://platform.openai.com/docs/guides/audio
TTSFM is a reverse-engineered API server that mirrors OpenAI's TTS service, providing a compatible interface for text-to-speech conversion with multiple voice options.
- Python 3.8 or higher
- pip (Python package manager)
- OR Docker
docker pull dbcccc/ttsfm:latest
docker run -p 7000:7000 dbcccc/ttsfm:latest
Note:
For Apple macOS, if port 7000 is occupied by the Control Center, you can use an alternative local port like 5051:
For Intel chips:
docker pull dbcccc/ttsfm:latest
docker run -p 5051:7000 dbcccc/ttsfm:latest
For Apple Silicon (M-series) chips, in the repository's current directory:
docker build -t ttsfm .
docker run -p 5051:7000 ttsfm
For Mac, access the web interface at http://localhost:5051
.
- Clone the repository:
git clone https://github.com/yourusername/ttsfm.git
cd ttsfm
- Install dependencies:
pip install -r requirements.txt
- The server will start automatically after running the docker command
- Access the web interface at
http://localhost:7000
- Start the server:
python server.py
-
Access the web interface at
http://localhost:7000
-
Use the API endpoint
Please refer to the deployed webpage for detailed information.
POST /v1/audio/speech
: Convert text to speechGET /v1/voices
: List available voices
The project includes a pressure test script to evaluate server performance under load. To use it:
# Basic test (10 requests, 2 concurrent connections)
python pressure_test.py
# Test with more requests and higher concurrency
python pressure_test.py -n 50 -c 10
# Test with different text lengths
python pressure_test.py -t short # Short text
python pressure_test.py -t medium # Medium text (default)
python pressure_test.py -t long # Long text
# Save generated audio files
python pressure_test.py -s
# Custom server URL
python pressure_test.py -u http://localhost:7000
Options:
-n, --num-requests
: Total number of requests to send (default: 10)-c, --concurrency
: Number of concurrent connections (default: 2)-t, --text-length
: Length of text to use (short/medium/long)-s, --save-audio
: Save generated audio files to test_output directory-u, --url
: Custom server URL (default: http://localhost:7000)
This project is licensed under the MIT License - see the LICENSE file for details.