As you may know, OpenAI offers a text-to-speech API service. However, using it typically requires a foreign credit card for payment and a VPN connection, which can be inconvenient.
Fortunately, a clever developer on GitHub has created a reverse-engineered project called ttsfm, achieving local free access by reverse engineering openai.fm
. You only need to install and launch ttsfm and fill in http://localhost:7000/v1
in the video translation software menu -- TTS Settings - OpenAI TTS to start using it.
In the future, if too many people use it and OpenAI can't handle the free access, it will definitely become invalid. But at least it's still usable now, so grab it while you can!
Here's how to install and launch it locally. You'll need to ensure you have a Python 3.8+ environment installed. If you don't have Python yet, click here to see how to configure it.
Download and Extract the Project Source Code
Open this address to download the ZIP package: https://github.com/dbccccccc/ttsfm
After downloading, extract it to a folder, for example, I extracted it to the D:/python/openaitts
directory. The result after extraction is shown in the figure.
Install Dependencies and Start
- Enter
cmd
in the folder's address bar and press Enter. In the opened terminal, enter the commandpython -m venv venv
and press Enter to create a virtual environment. As shown in the figure, avenv
folder will be added to the directory after success.
- Then, continue to execute the command
venv\scripts\activate
. After successful execution, the code(venv)
will be added to the front of the cmd terminal.
- Continue to execute the installation dependencies
pip install -r requirements.txt
If the execution is successful and no red errors appear, the installation is complete and you can start it.
Execute python server.py
. If the following appears, it means the startup was successful.
Fill in the API Address and Dub in pyVideoTrans
Open pyVideoTrans and find Menu -- TTS Settings - OpenAI TTS
- Fill in
http://localhost:7000/v1
in API URL. - Fill in SK arbitrarily, do not leave it blank.
- In the text box for filling in all models, make sure to fill in
tts-1,tts-1-hd,gpt-4o-mini-tts
. - Select
gpt-4o-mini-tts
in the model selection. - You can fill in voice effect prompts at will, such as
in an angry tone
.
After filling in, test it. Wait a moment, and if there are no accidents, you will hear the audio playback.
Then, you can go to the main interface to use it.
Given OpenAI's nature, it is estimated that this free access plan will not last long, so use it as soon as possible!