AI Personal Learning
and practical guidance

OpenAI Edge TTS: Free text-to-speech API utilizing Edge TTS, compatible with OpenAI formats

General Introduction

OpenAI Edge TTS is an open source project that provides an OpenAI-compatible native text-to-speech (TTS) API that uses Microsoft Edge's online text-to-speech service to allow users to generate high-quality speech output.OpenAI Edge TTS supports a wide range of speech options and playback speeds, and is capable of generating a wide range of audio formats. OpenAI Edge TTS supports a wide range of speech options and playback speeds, and can generate multiple audio formats. The service can be deployed via Docker or Python for quick and easy access.

Related items:edge-tts: Text-to-Speech Python Module | Free Text-to-Speech Service ,Edge TTS Worker: Deploying Microsoft Speech Synthesis APIs with Cloudflare, OpenAI Compatible Format and Wrapped Web Interface


OpenAI Edge TTS: Free text-to-speech API utilizing Edge TTS, compatible with OpenAI format-1

 

Function List

  • OpenAI Compatible Endpoints: Supports the same request structure and behavior as OpenAI TTS endpoints.
  • Multiple voice support: Mapping OpenAI speech to Edge TTS equivalent speech.
  • Flexible Audio Formats: Supports MP3, Opus, AAC, FLAC, WAV, PCM and many other audio formats.
  • Adjustable playback speed: The playback speed can be adjusted from 0.25x to 4.0x.
  • Direct selection of Edge TTS voice: You can use OpenAI voice mapping or specify any Edge TTS voice directly.

 

Using Help

Installation process

Deploying with Docker (recommended)

  1. clone warehouse::
   git clone https://github.com/travisvn/openai-edge-tts.git
cd openai-edge-tts
  1. Creating an environment variable file: Create the following in the project root directory .env file containing the following variables:
   API_KEY=your_api_key_here
PORT=5050
DEFAULT_VOICE=en-US-AndrewNeural
DEFAULT_RESPONSE_FORMAT=mp3
DEFAULT_SPEED=1.2
DEFAULT_LANGUAGE=en-US
REQUIRE_API_KEY=True
REMOVE_FILTER=False
EXPAND_API=True
  1. Run Docker Compose::
   docker compose up --build

To run in the background, use the -d Parameters:

   docker compose up -d

Deploying with Python

  1. clone warehouse::
   git clone https://github.com/travisvn/openai-edge-tts.git
cd openai-edge-tts
  1. Setting up a virtual environment::
   python3 -m venv venv
source venv/bin/activate
  1. Installation of dependencies::
   pip install -r requirements.txt
  1. Creating an environment variable file: Create the following in the project root directory .env file containing the above variables.
  2. Operations Server::
   python app/main.py

Instructions for use

  1. Accessing the API: After deployment is complete, the server will run http://localhost:5050The API endpoint can be accessed by sending an HTTP request. API endpoints can be accessed by sending HTTP requests /v1/audio/speechThe
  2. Generate Speech: sends a POST request to /v1/audio/speechThe request body contains the following JSON data:
   {
"text": "Hello, world!",
"voice": "en-US-AndrewNeural",
"format": "mp3", "speed": 1.0
"speed": 1.0
}
  1. Adjusting the playback speed: Modification speed parameter, ranging from 0.25 to 4.0.
  2. Select Voice: Use voice parameter specifies the voice, supported voices include alloy, echo, fable, onyx, nova, shimmermer etc.
  3. audio format: Use format parameter specifies the audio format, which supports mp3, opus, aac, flac, wav, pcm etc.

By following these steps, users can easily deploy and use the OpenAI Edge TTS service to generate high-quality text-to-speech output.

May not be reproduced without permission:Chief AI Sharing Circle " OpenAI Edge TTS: Free text-to-speech API utilizing Edge TTS, compatible with OpenAI formats

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish