DEV Community

parmarjatin4911@gmail.com
parmarjatin4911@gmail.com

Posted on

ChatGPT Text to Speech API

ChatGPT Text to Speech API

import openai
client = openai.OpenAI()
speech_file_path = "speech.mp3"
response = client.audio.speech.create(
model="tts-1",
voice="alloy",
input="Hi Everyone, This is Mervin Praison"
)
response.stream_to_file(speech_file_path)

Top comments (0)