TTSFM mirrors OpenAI's TTS service, providing a compatible interface for text-to-speech conversion with multiple voice options for free.
⚠️ NOTICE: This project is no longer functional as the openai.fm demo website has been shut down.
TTSFM is a free, OpenAI-compatible text-to-speech API service that provides a complete solution for converting text to natural-sounding speech based on OpenAI's GPT-4o mini TTS. Built on top of the openai.fm backend, it offers a powerful Python SDK, RESTful API endpoints, and an intuitive web playground for easy testing and integration.
What TTSFM Can Do:
- 🎤 Multiple Voices: Choose from 11 OpenAI-compatible voices (alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse)
- 🎵 Flexible Audio Formats: Support for 6 audio formats (MP3, WAV, OPUS, AAC, FLAC, PCM)
- ⚡ Speed Control: Adjust playback speed from 0.25x to 4.0x for different use cases
- 📝 Long Text Support: Automatic text splitting and audio combining for content of any length
- 🔄 Real-time Streaming: WebSocket support for streaming audio generation
- 🐍 Python SDK: Easy-to-use synchronous and asynchronous clients
- 🌐 Web Playground: Interactive web interface for testing and experimentation
- 🐳 Docker Ready: Pre-built Docker images for instant deployment
- 🔍 Smart Detection: Automatic capability detection and helpful error messages
- 🤖 OpenAI Compatible: Drop-in replacement for OpenAI's TTS API
Key Features in v3.4.0:
- 🎯 Image variant detection (full vs slim Docker images)
- 🔍 Runtime capabilities API for feature availability checking
- ⚡ Speed adjustment with ffmpeg-based audio processing
- 🎵 Real format conversion for all 6 audio formats
- 📊 Enhanced error handling with clear, actionable messages
- 🐳 Dual Docker images optimized for different use cases
⚠️ Disclaimer: This project is intended for educational and research purposes only. It is a reverse-engineered implementation of the openai.fm service and should not be used for commercial purposes or in production environments. Users are responsible for ensuring compliance with applicable laws and terms of service.
pip install ttsfm # core client pip install ttsfm[web] # core client + web/server dependencies
TTSFM offers two Docker image variants to suit different needs:
docker run -p 8000:8000 dbcccc/ttsfm:latest
Includes ffmpeg for advanced features:
- ✅ All 6 audio formats (MP3, WAV, OPUS, AAC, FLAC, PCM)
- ✅ Speed adjustment (0.25x - 4.0x)
- ✅ Format conversion with ffmpeg
- ✅ MP3 auto-combine for long text
- ✅ WAV auto-combine for long text
docker run -p 8000:8000 dbcccc/ttsfm:slim
Minimal image without ffmpeg:
- ✅ Basic TTS functionality
- ✅ 2 audio formats (MP3, WAV only)
- ✅ WAV auto-combine for long text
- ❌ No speed adjustment
- ❌ No format conversion
- ❌ No MP3 auto-combine
The container exposes the web playground at http://localhost:8000 and an OpenAI-compatible endpoint at /v1/audio/speech.
Check available features:
curl http://localhost:8000/api/capabilities
from https://github.com/dbccccccc/ttsfm
-----------------------------------------------
Code for openai.fm, a demo for the OpenAI Speech API
OpenAI.fm is an interactive demo to showcase the new OpenAI text-to-speech models. It is built with NextJS and the Speech API.
For more information about text-to-speech using the OpenAI API, check out our documentation.
-
Set up the OpenAI API:
- If you're new to the OpenAI API, sign up for an account.
- Follow the Quickstart to retrieve your API key.
-
Clone the Repository:
git clone https://github.com/openai/openai-fm.git
Set the OpenAI API key:
2 options:
- Set the
OPENAI_API_KEYenvironment variable globally in your system - Set the
OPENAI_API_KEYenvironment variable in the project: Create a.envfile at the root of the project and add the following line (see.env.examplefor reference):
OPENAI_API_KEY=<your_api_key>
Install dependencies:
Run in the project root:
npm install
(Optional) Connect to a hosted database:
If you want to use the sharing feature, you need to connect to a hosted postgres database. You should set the environment variables in a .env file at the root of the project to connect to your database as shown in .env.example.
POSTGRES_URL="postgresql://username:password@host:port/database_name"
-
This step is not needed to run the application and only affects the sharing feature.
-
Run the app:
npm run dev
-
The app will be available at
http://localhost:3000.
Note
Be aware that if you deploy this app to a public server, you are responsible for any usage it may incur using your OpenAI API key.
from https://github.com/openai/openai-fm
-------------------------------------------------------
An Industrial-Level Controllable and Efficient Zero-Shot Text-To-Speech System
IndexTTS2 👈🏻
IndexTTS2: A Breakthrough in Emotionally Expressive and Duration-Controlled Auto-Regressive Zero-Shot Text-to-Speech
Existing autoregressive large-scale text-to-speech (TTS) models have advantages in speech naturalness, but their token-by-token generation mechanism makes it difficult to precisely control the duration of synthesized speech. This becomes a significant limitation in applications requiring strict audio-visual synchronization, such as video dubbing.
This paper introduces IndexTTS2, which proposes a novel, general, and autoregressive model-friendly method for speech duration control.
The method supports two generation modes: one explicitly specifies the number of generated tokens to precisely control speech duration; the other freely generates speech in an autoregressive manner without specifying the number of tokens, while faithfully reproducing the prosodic features of the input prompt.
Furthermore, IndexTTS2 achieves disentanglement between emotional expression and speaker identity, enabling independent control over timbre and emotion. In the zero-shot setting, the model can accurately reconstruct the target timbre (from the timbre prompt) while perfectly reproducing the specified emotional tone (from the style prompt).
To enhance speech clarity in highly emotional expressions, we incorporate GPT latent representations and design a novel three-stage training paradigm to improve the stability of the generated speech. Additionally, to lower the barrier for emotional control, we designed a soft instruction mechanism based on text descriptions by fine-tuning Qwen3, effectively guiding the generation of speech with the desired emotional orientation.
Finally, experimental results on multiple datasets show that IndexTTS2 outperforms state-of-the-art zero-shot TTS models in terms of word error rate, speaker similarity, and emotional fidelity. Audio samples are available at: IndexTTS2 demo page.
Tips: Please contact the authors for more detailed information. For commercial usage and cooperation, please contact indexspeech@bilibili.com.
IndexTTS2: The Future of Voice, Now Generating
Click the image to watch the IndexTTS2 introduction video.
QQ Group:663272642(No.4) 1013410623(No.5)
Discord:https://discord.gg/uT32E7KDmy
Email:indexspeech@bilibili.com
You are welcome to join our community! 🌏
欢迎大家来交流讨论!
Caution
Thank you for your support of the bilibili indextts project! Please note that the only official channel maintained by the core team is: https://github.com/index-tts/index-tts. Any other websites or services are not official, and we cannot guarantee their security, accuracy, or timeliness. For the latest updates, please always refer to this official repository.
2025/09/08🔥🔥🔥 We release IndexTTS-2 to the world!- The first autoregressive TTS model with precise synthesis duration control, supporting both controllable and uncontrollable modes. This functionality is not yet enabled in this release.
- The model achieves highly expressive emotional speech synthesis, with emotion-controllable capabilities enabled through multiple input modalities.
2025/05/14🔥🔥 We release IndexTTS-1.5, significantly improving the model's stability and its performance in the English language.2025/03/25🔥 We release IndexTTS-1.0 with model weights and inference code.2025/02/12🔥 We submitted our paper to arXiv, and released our demos and test sets.
Architectural overview of IndexTTS2, our state-of-the art speech model:
The key contributions of IndexTTS2 are summarized as follows:
- We propose a duration adaptation scheme for autoregressive TTS models. IndexTTS2 is the first autoregressive zero-shot TTS model to combine precise duration control with natural duration generation, and the method is scalable for any autoregressive large-scale TTS model.
- The emotional and speaker-related features are decoupled from the prompts, and a feature fusion strategy is designed to maintain semantic fluency and pronunciation clarity during emotionally rich expressions. Furthermore, a tool was developed for emotion control, utilizing natural language descriptions for the benefit of users.
- To address the lack of highly expressive speech data, we propose an effective training strategy, significantly enhancing the emotional expressiveness of zeroshot TTS to State-of-the-Art (SOTA) level.
- We will publicly release the code and pre-trained weights to facilitate future research and practical applications.
| HuggingFace | ModelScope |
|---|---|
| 😁 IndexTTS-2 | IndexTTS-2 |
| IndexTTS-1.5 | IndexTTS-1.5 |
| IndexTTS | IndexTTS |
The Git-LFS plugin must also be enabled on your current user account:
git lfs install
- Download this repository:
git clone https://github.com/index-tts/index-tts.git && cd index-tts
git lfs pull # download large repository files
- Install the uv package manager. It is required for a reliable, modern installation environment.
Tip
Quick & Easy Installation Method:
There are many convenient ways to install the uv command on your computer. Please check the link above to see all options. Alternatively, if you want a very quick and easy method, you can install it as follows:
pip install -U uv
Warning
We only support the uv installation method. Other tools, such as conda or pip, don't provide any guarantees that they will install the correct dependency versions. You will almost certainly have random bugs, error messages, missing GPU acceleration, and various other problems if you don't use uv. Please do not report any issues if you use non-standard installations, since almost all such issues are invalid.
Furthermore, uv is up to 115x faster than pip, which is another great reason to embrace the new industry-standard for Python project management.
- Install required dependencies:
We use uv to manage the project's dependency environment. The following command will automatically create a .venv project-directory and then installs the correct versions of Python and all required dependencies:
uv sync --all-extras
If the download is slow, please try a local mirror, for example any of these local mirrors in China (choose one mirror from the list below):
uv sync --all-extras --default-index "https://mirrors.aliyun.com/pypi/simple"
uv sync --all-extras --default-index "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
Tip
Available Extra Features:
--all-extras: Automatically adds every extra feature listed below. You can remove this flag if you want to customize your installation choices.--extra webui: Adds WebUI support (recommended).--extra deepspeed: Adds DeepSpeed support (may speed up inference on some systems).
Important
Important (Windows): The DeepSpeed library may be difficult to install for some Windows users. You can skip it by removing the --all-extras flag. If you want any of the other extra features above, you can manually add their specific feature flags instead.
Important (Linux/Windows): If you see an error about CUDA during the installation, please ensure that you have installed NVIDIA's CUDA Toolkit version 12.8 (or newer) on your system.
- Download the required models via uv tool:
Download via huggingface-cli:
uv tool install "huggingface-hub[cli,hf_xet]"
hf download IndexTeam/IndexTTS-2 --local-dir=checkpoints
Or download via modelscope:
uv tool install "modelscope"
modelscope download --model IndexTeam/IndexTTS-2 --local_dir checkpoints
Important
If the commands above aren't available, please carefully read the uv tool output. It will tell you how to add the tools to your system's path.
Note
In addition to the above models, some small models will also be automatically downloaded when the project is run for the first time. If your network environment has slow access to HuggingFace, it is recommended to execute the following command before running the code:
export HF_ENDPOINT="https://hf-mirror.com"
If you need to diagnose your environment to see which GPUs are detected, you can use our included utility to check your system:
uv run tools/gpu_check.py
uv run webui.py
Open your browser and visit http://127.0.0.1:7860 to see the demo.
You can also adjust the settings to enable features such as FP16 inference (lower VRAM usage), DeepSpeed acceleration, compiled CUDA kernels for speed, etc. All available options can be seen via the following command:
uv run webui.py -h
Have fun!
Important
It can be very helpful to use FP16 (half-precision) inference. It is faster and uses less VRAM, with a very small quality loss.
DeepSpeed may also speed up inference on some systems, but it could also make it slower. The performance impact is highly dependent on your specific hardware, drivers and operating system. Please try with and without it, to discover what works best on your personal system.
Lastly, be aware that all uv commands will automatically activate the correct per-project virtual environments. Do not manually activate any environments before running uv commands, since that could lead to dependency conflicts!
from


