As everyone knows, OpenAI offers a text-to-speech API service, but using it requires a foreign credit card for payment and a VPN, which isn't very convenient.
A genius on GitHub created a reverse-engineered project called ttsfm. By reverse engineering openai.fm
, it enables local access for free. Simply install and start ttsfm, and then fill in http://localhost:7000/v1
in the video translation software's menu under TTS settings for OpenAI TTS to use 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 for now, so hurry up if you want to use it.
Below, I'll explain how to install and start it locally. You need to ensure that you already have a Python 3.8+ environment locally. If you don't have a Python environment yet, click here to see how to configure it.
Download the Project Source Code and Unzip It
Open this address to download the zip package: https://github.com/dbccccccc/ttsfm
After downloading, unzip it to a folder, for example, I unzipped it to the D:/python/openaitts
directory. The result after unzipping is as shown:
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. After success, avenv
folder will be added to the directory.
- 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 dependency installation
pip install -r requirements.txt
If the execution is successful without any red errors, 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, find the menu -- TTS Settings - OpenAI TTS.
- Fill in
http://localhost:7000/v1
in the API URL. - Fill in any value in SK, 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. - Voice effect prompts can be filled in arbitrarily, for example,
in an angry tone
.
After filling in, test it. Wait a moment, and if there are no accidents, you will hear an audio playback.
Then, you can use it on the main interface.
Given OpenAI's nature, this free access plan probably won't last long, so use it as soon as possible!